1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Jonathan Gordon 2008-01-29 06:57:54 +00:00
parent 1d095d1545
commit ba75e6038f
3 changed files with 10 additions and 25 deletions

View file

@ -40,8 +40,6 @@
#include "filetypes.h" #include "filetypes.h"
#include "debug.h" #include "debug.h"
#define PLAYLIST_CATALOG_CFG ROCKBOX_DIR "/playlist_catalog.config"
#define PLAYLIST_CATALOG_DEFAULT_DIR "/Playlists"
#define MAX_PLAYLISTS 400 #define MAX_PLAYLISTS 400
#define PLAYLIST_DISPLAY_COUNT 10 #define PLAYLIST_DISPLAY_COUNT 10
@ -54,8 +52,7 @@ struct add_track_context {
/* keep track of most recently used playlist */ /* keep track of most recently used playlist */
static char most_recent_playlist[MAX_PATH]; static char most_recent_playlist[MAX_PATH];
/* directory where our playlists our stored (configured in /* directory where our playlists our stored */
PLAYLIST_CATALOG_CFG) */
static char playlist_dir[MAX_PATH]; static char playlist_dir[MAX_PATH];
static int playlist_dir_length; static int playlist_dir_length;
static bool playlist_dir_exists = false; static bool playlist_dir_exists = false;
@ -67,31 +64,15 @@ static int initialize_catalog(void)
if (!initialized) if (!initialized)
{ {
int f;
DIR* dir; DIR* dir;
bool default_dir = true; bool default_dir = true;
f = open(PLAYLIST_CATALOG_CFG, O_RDONLY);
if (f >= 0) /* directory config is of the format: "dir: /path/to/dir" */
if (global_settings.playlist_catalog_dir[0])
{ {
char buf[MAX_PATH+5]; strcpy(playlist_dir, global_settings.playlist_catalog_dir);
default_dir = false;
while (read_line(f, buf, sizeof(buf)))
{
char* name;
char* value;
/* directory config is of the format: "dir: /path/to/dir" */
if (settings_parseline(buf, &name, &value) &&
!strncasecmp(name, "dir:", strlen(name)) &&
strlen(value) > 0)
{
strncpy(playlist_dir, value, strlen(value));
default_dir = false;
}
}
close(f);
} }
/* fall back to default directory if no or invalid config */ /* fall back to default directory if no or invalid config */

View file

@ -74,6 +74,7 @@ struct opt_items {
#define CODECS_DIR ROCKBOX_DIR "/codecs" #define CODECS_DIR ROCKBOX_DIR "/codecs"
#define RECPRESETS_DIR ROCKBOX_DIR "/recpresets" #define RECPRESETS_DIR ROCKBOX_DIR "/recpresets"
#define FMPRESET_PATH ROCKBOX_DIR "/fmpresets" #define FMPRESET_PATH ROCKBOX_DIR "/fmpresets"
#define PLAYLIST_CATALOG_DEFAULT_DIR "/Playlists"
#define VIEWERS_CONFIG ROCKBOX_DIR "/viewers.config" #define VIEWERS_CONFIG ROCKBOX_DIR "/viewers.config"
#define CONFIGFILE ROCKBOX_DIR "/config.cfg" #define CONFIGFILE ROCKBOX_DIR "/config.cfg"
@ -723,6 +724,7 @@ struct user_settings
int keyclick; /* keyclick volume */ int keyclick; /* keyclick volume */
int keyclick_repeats; /* keyclick on repeats */ int keyclick_repeats; /* keyclick on repeats */
#endif #endif
unsigned char playlist_catalog_dir[MAX_FILENAME+1];
}; };
/** global variables **/ /** global variables **/

View file

@ -1187,6 +1187,8 @@ const struct settings_list settings[] = {
ID2P(LANG_OFF), ID2P(LANG_WEAK), ID2P(LANG_MODERATE), ID2P(LANG_STRONG)), ID2P(LANG_OFF), ID2P(LANG_WEAK), ID2P(LANG_MODERATE), ID2P(LANG_STRONG)),
OFFON_SETTING(0, keyclick_repeats, LANG_KEYCLICK_REPEATS, false, "keyclick repeats", NULL), OFFON_SETTING(0, keyclick_repeats, LANG_KEYCLICK_REPEATS, false, "keyclick repeats", NULL),
#endif /* CONFIG_CODEC == SWCODEC */ #endif /* CONFIG_CODEC == SWCODEC */
FILENAME_SETTING(0, playlist_catalog_dir, "playlist catalog directory",
PLAYLIST_CATALOG_DEFAULT_DIR, "", "", MAX_FILENAME+1),
}; };
const int nb_settings = sizeof(settings)/sizeof(*settings); const int nb_settings = sizeof(settings)/sizeof(*settings);