From: <ny...@us...> - 2007-02-10 05:41:19
|
Revision: 324 http://svn.sourceforge.net/pmplib/?rev=324&view=rev Author: nyaochi Date: 2007-02-09 21:41:20 -0800 (Fri, 09 Feb 2007) Log Message: ----------- Configurable paths for CUI version. New options -P (--playlist-source) and -s (--set) were added. We don't have to transfer source playlists to a player; EasyPMP can directly convert playlist file located on the PC. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/common/easypmp.h trunk/pmplib/frontend/easypmp/common/enumerate.c trunk/pmplib/frontend/easypmp/cui/main.c trunk/pmplib/frontend/easypmp/cui/option.c Modified: trunk/pmplib/frontend/easypmp/common/easypmp.h =================================================================== --- trunk/pmplib/frontend/easypmp/common/easypmp.h 2007-02-10 04:58:08 UTC (rev 323) +++ trunk/pmplib/frontend/easypmp/common/easypmp.h 2007-02-10 05:41:20 UTC (rev 324) @@ -97,6 +97,10 @@ char *mbs_strip_words; ucs2char_t** strip_words; int num_strip_words; + + char *path_to_pmp_music; + char *path_to_pmp_playlist; + char *path_to_playlist_source; } option_t; typedef struct { Modified: trunk/pmplib/frontend/easypmp/common/enumerate.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/enumerate.c 2007-02-10 04:58:08 UTC (rev 323) +++ trunk/pmplib/frontend/easypmp/common/enumerate.c 2007-02-10 05:41:20 UTC (rev 324) @@ -188,7 +188,11 @@ ed.instance = instance; // Decode the playlist path prefix for system path separators - filepath_combinepath(path, MAX_PATH, pmp->info.path_to_root, pmp->info.path_to_playlist); + if (opt->path_to_playlist_source) { + mbstoucs2(path, MAX_PATH, opt->path_to_playlist_source, strlen(opt->path_to_playlist_source)+1); + } else { + filepath_combinepath(path, MAX_PATH, pmp->info.path_to_root, pmp->info.path_to_playlist); + } filepath_addslash(path); filepath_decode(path); ret = find_file( Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-10 04:58:08 UTC (rev 323) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2007-02-10 05:41:20 UTC (rev 324) @@ -311,6 +311,14 @@ goto exit_main; } + // Modify the default setting. + if (opt.path_to_pmp_music) { + mbstoucs2(pmp->info.path_to_music, MAX_PATH, opt.path_to_pmp_music, strlen(opt.path_to_pmp_music)+1); + } + if (opt.path_to_pmp_playlist) { + mbstoucs2(pmp->info.path_to_playlist, MAX_PATH, opt.path_to_pmp_playlist, strlen(opt.path_to_pmp_playlist)+1); + } + // Generate open flag. if (opt.verb & MODE_DATABASE) { openflag |= PMPOF_MUSIC_DB_WRITE; Modified: trunk/pmplib/frontend/easypmp/cui/option.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/option.c 2007-02-10 04:58:08 UTC (rev 323) +++ trunk/pmplib/frontend/easypmp/cui/option.c 2007-02-10 05:41:20 UTC (rev 324) @@ -74,6 +74,7 @@ fprintf(fp, "\n"); fprintf(fp, "Playlist options:\n"); fprintf(fp, " -p, --playlist Convert playlist files\n"); + fprintf(fp, " -P, --playlist-source=VALUE Change the path to the source playlists\n"); fprintf(fp, " -r, --reconvert Discard the existing playlist files and reconvert\n"); fprintf(fp, " -f, --find-missing Correct playlists with corrupt references to media files\n"); fprintf(fp, " -i, --ignore-missing Continue a conversion even if a media file is missing\n"); @@ -105,9 +106,8 @@ fprintf(fp, " Note that a pathname ending with \"%c%c\" implies inclusion of its subdirs\n", PATHCHAR, PATHCHAR); fprintf(fp, "\n"); fprintf(fp, "Pathname variables:\n"); - fprintf(fp, " music Relative path to music directory\n"); - fprintf(fp, " playlistsrc Absolute path to the sources for playlist conversion\n"); - fprintf(fp, " playlistdst Relative path to the destinations for playlist conversion\n"); + fprintf(fp, " pmp_music Relative path to music directory\n"); + fprintf(fp, " pmp_playlist Relative path to playlist directory\n"); } void option_init(option_t* opt) @@ -153,6 +153,7 @@ {"repr-level", required_argument, 0, 'L'}, {"strip-words", required_argument, 0, 't'}, {"playlist", no_argument, 0, 'p'}, + {"playlist-source", no_argument, 0, 'P'}, {"reconvert", no_argument, 0, 'r'}, {"find-missing", no_argument, 0, 'f'}, {"ignore-missing", no_argument, 0, 'i'}, @@ -169,9 +170,9 @@ {NULL, 0, 0, 0} }; #ifndef _WIN32 - int c = getopt_long(argc, argv, "cuz:RL:t:prfild:xs:e:w:vh", long_options, &option_index); + int c = getopt_long(argc, argv, "cuz:RL:t:pP:rfild:xs:e:w:vh", long_options, &option_index); #else - int c = getopt_long(argc, argv, "cuz:RL:t:prfild:xs:vh", long_options, &option_index); + int c = getopt_long(argc, argv, "cuz:RL:t:pP:rfild:xs:vh", long_options, &option_index); #endif/*_WIN32*/ if (c == -1) { break; @@ -215,6 +216,10 @@ case 'p': opt->verb |= MODE_PLAYLIST; break; + case 'P': + free(opt->path_to_playlist_source); + opt->path_to_playlist_source = strdup(optarg); + break; case 'r': opt->verb |= MODE_PLAYLIST_RECONVERT; break; @@ -232,6 +237,17 @@ strcpy(opt->model, optarg); break; case 's': + if (strncmp("pmp_music:", optarg, 10) == 0) { + free(opt->path_to_pmp_music); + opt->path_to_pmp_music = strdup(optarg+10); + } else if (strncmp("pmp_playlist:", optarg, 13) == 0) { + free(opt->path_to_pmp_playlist); + opt->path_to_pmp_playlist = strdup(optarg+13); + } else { + fprintf(fpe, "Unrecognized variable: %s\n", optarg); + return -1; + break; + } break; #ifndef _WIN32 case 'e': This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |