diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2011-07-20 14:11:15 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2011-07-20 14:11:15 +0000 |
commit | 97a4c1efa473e40b4dd7287571f3b1c9caaba97d (patch) | |
tree | 384bb5b81d5c4c5b6098bff835af9a7cc75161de /apps/playlist_catalog.c | |
parent | 4983d052a0d73340d09086a796b4ccbb45dfd88b (diff) | |
download | rockbox-97a4c1efa473e40b4dd7287571f3b1c9caaba97d.tar.gz rockbox-97a4c1efa473e40b4dd7287571f3b1c9caaba97d.tar.bz2 rockbox-97a4c1efa473e40b4dd7287571f3b1c9caaba97d.zip |
FS#11808 - Major playlist handling changes (on disk playlists)
* Playlists are treated similar to directories in the browser, they now open in the viewer when selected instead of automatically starting the playlist.
* Make the "Playlists" main menu item useful, it now displays the playlist catalog (and has been renamed accordingly)
* Default to storing playlists in the catalog
* Add a UI to move the catalog directory
(other minor stuff too)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30177 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/playlist_catalog.c')
-rw-r--r-- | apps/playlist_catalog.c | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/apps/playlist_catalog.c b/apps/playlist_catalog.c index 9d4d707c08..3687681b66 100644 --- a/apps/playlist_catalog.c +++ b/apps/playlist_catalog.c @@ -43,6 +43,8 @@ #include "debug.h" #include "playlist_catalog.h" #include "talk.h" +#include "playlist_viewer.h" +#include "bookmark.h" /* Use for recursive directory search */ struct add_track_context { @@ -59,9 +61,9 @@ static int playlist_dir_length; static bool playlist_dir_exists = false; /* Retrieve playlist directory from config file and verify it exists */ +static bool initialized = false; static int initialize_catalog(void) { - static bool initialized = false; if (!initialized) { @@ -110,6 +112,27 @@ static int initialize_catalog(void) return 0; } +void catalog_set_directory(const char* directory) +{ + if (directory == NULL) + { + global_settings.playlist_catalog_dir[0] = '\0'; + } + else + { + strcpy(global_settings.playlist_catalog_dir, directory); + } + initialized = false; + initialize_catalog(); +} + +const char* catalog_get_directory(void) +{ + if (initialize_catalog() == -1) + return ""; + return playlist_dir; +} + /* Display all playlists in catalog. Selected "playlist" is returned. If "view" mode is set then we're not adding anything into playlist. */ static int display_playlists(char* playlist, bool view) @@ -126,6 +149,8 @@ static int display_playlists(char* playlist, bool view) browse.buf = selected_playlist; browse.bufsize = sizeof(selected_playlist); +restart: + browse.flags &= ~BROWSE_SELECTED; rockbox_browse(&browse); if (browse.flags & BROWSE_SELECTED) @@ -135,9 +160,12 @@ static int display_playlists(char* playlist, bool view) if (view) { - char *filename = strrchr(selected_playlist, '/')+1; - /* In view mode, selecting a playlist starts playback */ - ft_play_playlist(selected_playlist, playlist_dir, filename); + + if (!bookmark_autoload(selected_playlist)) + { + if (playlist_viewer_ex(selected_playlist) == PLAYLIST_VIEWER_CANCEL) + goto restart; + } result = 0; } else @@ -311,8 +339,6 @@ bool catalog_add_to_a_playlist(const char* sel, int sel_attr, snprintf(playlist, MAX_PATH, "%s/%s.m3u8", playlist_dir, (name!=NULL && (sel_attr & ATTR_DIRECTORY))?name+1:""); - if (kbd_input(playlist, MAX_PATH)) - return false; } else strcpy(playlist, m3u8name); @@ -323,6 +349,9 @@ bool catalog_add_to_a_playlist(const char* sel, int sel_attr, strcat(playlist, "8"); else if(len <= 5 || strcasecmp(&playlist[len-5], ".m3u8")) strcat(playlist, ".m3u8"); + + if (kbd_input(playlist, MAX_PATH)) + return false; } else { |