diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2008-01-29 06:57:54 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2008-01-29 06:57:54 +0000 |
commit | ba75e6038f3f9af54bdeaf9feb1f4bd90c042f19 (patch) | |
tree | 3fe37150d6c954d49761f75482e749561982b00e /apps | |
parent | 1d095d1545fcbd74d201a5d63cee654fe9141187 (diff) | |
download | rockbox-ba75e6038f3f9af54bdeaf9feb1f4bd90c042f19.tar.gz rockbox-ba75e6038f3f9af54bdeaf9feb1f4bd90c042f19.zip |
Move the playlist catalog config into the standard config files. 1 less disk spinup when the playlist cataloge is used the first time.
The manual doesnt currently mention this setting (or ever did). use "playlist catalog directory:/path/to/Playlists" in the .cfg
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16181 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/playlist_catalog.c | 31 | ||||
-rw-r--r-- | apps/settings.h | 2 | ||||
-rw-r--r-- | apps/settings_list.c | 2 |
3 files changed, 10 insertions, 25 deletions
diff --git a/apps/playlist_catalog.c b/apps/playlist_catalog.c index f5c5bcb35b..c68371af49 100644 --- a/apps/playlist_catalog.c +++ b/apps/playlist_catalog.c | |||
@@ -40,8 +40,6 @@ | |||
40 | #include "filetypes.h" | 40 | #include "filetypes.h" |
41 | #include "debug.h" | 41 | #include "debug.h" |
42 | 42 | ||
43 | #define PLAYLIST_CATALOG_CFG ROCKBOX_DIR "/playlist_catalog.config" | ||
44 | #define PLAYLIST_CATALOG_DEFAULT_DIR "/Playlists" | ||
45 | #define MAX_PLAYLISTS 400 | 43 | #define MAX_PLAYLISTS 400 |
46 | #define PLAYLIST_DISPLAY_COUNT 10 | 44 | #define PLAYLIST_DISPLAY_COUNT 10 |
47 | 45 | ||
@@ -54,8 +52,7 @@ struct add_track_context { | |||
54 | /* keep track of most recently used playlist */ | 52 | /* keep track of most recently used playlist */ |
55 | static char most_recent_playlist[MAX_PATH]; | 53 | static char most_recent_playlist[MAX_PATH]; |
56 | 54 | ||
57 | /* directory where our playlists our stored (configured in | 55 | /* directory where our playlists our stored */ |
58 | PLAYLIST_CATALOG_CFG) */ | ||
59 | static char playlist_dir[MAX_PATH]; | 56 | static char playlist_dir[MAX_PATH]; |
60 | static int playlist_dir_length; | 57 | static int playlist_dir_length; |
61 | static bool playlist_dir_exists = false; | 58 | static bool playlist_dir_exists = false; |
@@ -67,31 +64,15 @@ static int initialize_catalog(void) | |||
67 | 64 | ||
68 | if (!initialized) | 65 | if (!initialized) |
69 | { | 66 | { |
70 | int f; | ||
71 | DIR* dir; | 67 | DIR* dir; |
72 | bool default_dir = true; | 68 | bool default_dir = true; |
73 | 69 | ||
74 | f = open(PLAYLIST_CATALOG_CFG, O_RDONLY); | 70 | |
75 | if (f >= 0) | 71 | /* directory config is of the format: "dir: /path/to/dir" */ |
72 | if (global_settings.playlist_catalog_dir[0]) | ||
76 | { | 73 | { |
77 | char buf[MAX_PATH+5]; | 74 | strcpy(playlist_dir, global_settings.playlist_catalog_dir); |
78 | 75 | default_dir = false; | |
79 | while (read_line(f, buf, sizeof(buf))) | ||
80 | { | ||
81 | char* name; | ||
82 | char* value; | ||
83 | |||
84 | /* directory config is of the format: "dir: /path/to/dir" */ | ||
85 | if (settings_parseline(buf, &name, &value) && | ||
86 | !strncasecmp(name, "dir:", strlen(name)) && | ||
87 | strlen(value) > 0) | ||
88 | { | ||
89 | strncpy(playlist_dir, value, strlen(value)); | ||
90 | default_dir = false; | ||
91 | } | ||
92 | } | ||
93 | |||
94 | close(f); | ||
95 | } | 76 | } |
96 | 77 | ||
97 | /* fall back to default directory if no or invalid config */ | 78 | /* fall back to default directory if no or invalid config */ |
diff --git a/apps/settings.h b/apps/settings.h index 179a3390d7..bdbe8d922e 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -74,6 +74,7 @@ struct opt_items { | |||
74 | #define CODECS_DIR ROCKBOX_DIR "/codecs" | 74 | #define CODECS_DIR ROCKBOX_DIR "/codecs" |
75 | #define RECPRESETS_DIR ROCKBOX_DIR "/recpresets" | 75 | #define RECPRESETS_DIR ROCKBOX_DIR "/recpresets" |
76 | #define FMPRESET_PATH ROCKBOX_DIR "/fmpresets" | 76 | #define FMPRESET_PATH ROCKBOX_DIR "/fmpresets" |
77 | #define PLAYLIST_CATALOG_DEFAULT_DIR "/Playlists" | ||
77 | 78 | ||
78 | #define VIEWERS_CONFIG ROCKBOX_DIR "/viewers.config" | 79 | #define VIEWERS_CONFIG ROCKBOX_DIR "/viewers.config" |
79 | #define CONFIGFILE ROCKBOX_DIR "/config.cfg" | 80 | #define CONFIGFILE ROCKBOX_DIR "/config.cfg" |
@@ -723,6 +724,7 @@ struct user_settings | |||
723 | int keyclick; /* keyclick volume */ | 724 | int keyclick; /* keyclick volume */ |
724 | int keyclick_repeats; /* keyclick on repeats */ | 725 | int keyclick_repeats; /* keyclick on repeats */ |
725 | #endif | 726 | #endif |
727 | unsigned char playlist_catalog_dir[MAX_FILENAME+1]; | ||
726 | }; | 728 | }; |
727 | 729 | ||
728 | /** global variables **/ | 730 | /** global variables **/ |
diff --git a/apps/settings_list.c b/apps/settings_list.c index b52044c933..ae998f85ed 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c | |||
@@ -1187,6 +1187,8 @@ const struct settings_list settings[] = { | |||
1187 | ID2P(LANG_OFF), ID2P(LANG_WEAK), ID2P(LANG_MODERATE), ID2P(LANG_STRONG)), | 1187 | ID2P(LANG_OFF), ID2P(LANG_WEAK), ID2P(LANG_MODERATE), ID2P(LANG_STRONG)), |
1188 | OFFON_SETTING(0, keyclick_repeats, LANG_KEYCLICK_REPEATS, false, "keyclick repeats", NULL), | 1188 | OFFON_SETTING(0, keyclick_repeats, LANG_KEYCLICK_REPEATS, false, "keyclick repeats", NULL), |
1189 | #endif /* CONFIG_CODEC == SWCODEC */ | 1189 | #endif /* CONFIG_CODEC == SWCODEC */ |
1190 | FILENAME_SETTING(0, playlist_catalog_dir, "playlist catalog directory", | ||
1191 | PLAYLIST_CATALOG_DEFAULT_DIR, "", "", MAX_FILENAME+1), | ||
1190 | }; | 1192 | }; |
1191 | 1193 | ||
1192 | const int nb_settings = sizeof(settings)/sizeof(*settings); | 1194 | const int nb_settings = sizeof(settings)/sizeof(*settings); |