From: <ny...@us...> - 2007-01-26 01:12:09
|
Revision: 279 http://svn.sourceforge.net/pmplib/?rev=279&view=rev Author: nyaochi Date: 2007-01-25 17:12:08 -0800 (Thu, 25 Jan 2007) Log Message: ----------- Synchronize the CUI frontend with the latest playlist API. Modified Paths: -------------- trunk/pmplib/frontend/easypmp/common/easypmp.h trunk/pmplib/frontend/easypmp/common/enumerate.c trunk/pmplib/frontend/easypmp/common/playlist.c trunk/pmplib/frontend/easypmp/cui/main.c trunk/pmplib/frontend/easypmp/cui/option.c trunk/pmplib/include/pmp.h trunk/pmplib/lib/pmp/pmp.c trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c Modified: trunk/pmplib/frontend/easypmp/common/easypmp.h =================================================================== --- trunk/pmplib/frontend/easypmp/common/easypmp.h 2007-01-26 00:37:56 UTC (rev 278) +++ trunk/pmplib/frontend/easypmp/common/easypmp.h 2007-01-26 01:12:08 UTC (rev 279) @@ -73,8 +73,6 @@ MODE_DATABASE_UPDATE = 0x00000002, MODE_DATABASE_REPR = 0x00000004, MODE_PLAYLIST = 0x00000010, - MODE_PLAYLIST_PLAYLIST = 0x00000020, - MODE_PLAYLIST_MUSIC = 0x00000040, MODE_PLAYLIST_RECONVERT = 0x00000100, MODE_PLAYLIST_FIND = 0x00000200, MODE_PLAYLIST_SKIP = 0x00000400, @@ -155,9 +153,9 @@ int easypmp_playlist( + pmp_t* pmp, const easypmp_filelist_t* playlists, const easypmp_filelist_t* musics, - pmp_t* pmp, const option_t* opt, pmp_music_record_t* records, uint32_t num_records, Modified: trunk/pmplib/frontend/easypmp/common/enumerate.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/enumerate.c 2007-01-26 00:37:56 UTC (rev 278) +++ trunk/pmplib/frontend/easypmp/common/enumerate.c 2007-01-26 01:12:08 UTC (rev 279) @@ -186,28 +186,15 @@ ed.proc = proc; ed.instance = instance; - if (opt->verb & MODE_PLAYLIST_PLAYLIST) { - // Decode the playlist path prefix for system path separators - filepath_combinepath(path, MAX_PATH, pmp->info.path_to_root, pmp->info.path_to_playlist); - filepath_decode(path); - ret = find_file( - path, - pmp->info.playlist_flag & PMPPF_RECURSIVE ? 1 : 0, - found_playlist_file, - &ed - ); - } - if (opt->verb & MODE_PLAYLIST_MUSIC) { - // Decode the playlist path prefix for system path separators - filepath_combinepath(path, MAX_PATH, pmp->info.path_to_root, pmp->info.path_to_music); - filepath_decode(path); - ret = find_file( - path, - pmp->info.music_flag & PMPMF_RECURSIVE ? 1 : 0, - found_playlist_file, - &ed - ); - } + // Decode the playlist path prefix for system path separators + filepath_combinepath(path, MAX_PATH, pmp->info.path_to_root, pmp->info.path_to_playlist); + filepath_decode(path); + ret = find_file( + path, + pmp->info.playlist_flag & PMPPF_RECURSIVE ? 1 : 0, + found_playlist_file, + &ed + ); return ret; } Modified: trunk/pmplib/frontend/easypmp/common/playlist.c =================================================================== --- trunk/pmplib/frontend/easypmp/common/playlist.c 2007-01-26 00:37:56 UTC (rev 278) +++ trunk/pmplib/frontend/easypmp/common/playlist.c 2007-01-26 01:12:08 UTC (rev 279) @@ -36,11 +36,6 @@ #include <easypmp.h> -/** - * \addtogroup common - * @{ - */ - typedef struct { void *instance; easypmp_progress_t progress; @@ -64,9 +59,9 @@ int easypmp_playlist( + pmp_t* pmp, const easypmp_filelist_t* playlists, const easypmp_filelist_t* musics, - pmp_t* pmp, const option_t* opt, pmp_music_record_t* records, uint32_t num_records, @@ -83,7 +78,6 @@ int num_pmppls = 0; result_t res = 0; callback_data_t cd; - ucs2char_t dstpath[MAX_PATH]; cd.instance = instance; cd.progress = progress; @@ -91,8 +85,6 @@ // Query the interface to music. music = pmp->music; - filepath_combinepath(dstpath, MAX_PATH, pmp->info.path_to_root, pmp->info.path_to_playlist); - // Convert easypmp_filelist_t array to playlist_mediafile_t array. mediafiles = calloc(musics->num_elements, sizeof(playlist_mediafile_t)); if (musics->num_elements > 0 && !mediafiles) { @@ -157,16 +149,9 @@ pmp_playlist_t* pmppl = NULL; // Generate a destination filename. - filepath_combinepath(dst, MAX_PATH, dstpath, filepath_skippath(pl->name)); + ucs2cpy(dst, filepath_skippath(pl->name)); filepath_remove_extension(dst); - // Skipping the existing playlist - if (!(opt->verb & MODE_PLAYLIST_RECONVERT)) { - if (filepath_file_exists(dst) && filepath_compare_lastupdate(src, dst) <= 0) { - continue; - } - } - // Skip an empty playlist. if (pl->num_entries == 0) { if (progress(instance, EASYPMPP_PLAYLIST_CONVERT | EASYPMPSP_SKIP_PLAYLIST, i, 0, src) != 0) { @@ -227,6 +212,8 @@ result = EASYPMPE_INSUFFICIENT_MEMORY; goto error_exit; } + + // Store the playlist. for (j = 0, n = 0;j < pl->num_entries;++j) { if (pl->entries[j].valid && pl->entries[j].filename[0]) { pmppl->entries[n] = ucs2dup(pl->entries[j].filename); @@ -239,6 +226,7 @@ } } + // Set playlists. music->set_playlists(music, pmppls, num_pmppls); // Finish playlist conversion. @@ -255,5 +243,3 @@ free(mediafiles); return result; } -/** @} */ - Modified: trunk/pmplib/frontend/easypmp/cui/main.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/main.c 2007-01-26 00:37:56 UTC (rev 278) +++ trunk/pmplib/frontend/easypmp/cui/main.c 2007-01-26 01:12:08 UTC (rev 279) @@ -378,7 +378,7 @@ fprintf(fpe, " was built without support for JavaScript playlists.\n"); } #endif - easypmp_playlist(&playlists, &musics, pmp, &opt, records, num_records, easypmp_progress, NULL); + easypmp_playlist(pmp, &playlists, &musics, &opt, records, num_records, easypmp_progress, NULL); } // Dump the database if specified. Modified: trunk/pmplib/frontend/easypmp/cui/option.c =================================================================== --- trunk/pmplib/frontend/easypmp/cui/option.c 2007-01-26 00:37:56 UTC (rev 278) +++ trunk/pmplib/frontend/easypmp/cui/option.c 2007-01-26 01:12:08 UTC (rev 279) @@ -222,7 +222,7 @@ opt->mbs_strip_words = strdup(optarg); break; case 'p': - opt->verb |= (MODE_PLAYLIST | MODE_PLAYLIST_PLAYLIST); + opt->verb |= MODE_PLAYLIST; break; case 'r': opt->verb |= MODE_PLAYLIST_RECONVERT; Modified: trunk/pmplib/include/pmp.h =================================================================== --- trunk/pmplib/include/pmp.h 2007-01-26 00:37:56 UTC (rev 278) +++ trunk/pmplib/include/pmp.h 2007-01-26 01:12:08 UTC (rev 279) @@ -617,7 +617,7 @@ PMPAPI void pmplib_playlist_init(pmp_playlist_t* playlist); PMPAPI void pmplib_playlist_finish(pmp_playlist_t* playlist); -PMPAPI void pmplib_playlist_copy(pmp_playlist_t* dst, const pmp_playlist_t* src); +PMPAPI void pmplib_playlist_clone(pmp_playlist_t* dst, const pmp_playlist_t* src); /** * @} Modified: trunk/pmplib/lib/pmp/pmp.c =================================================================== --- trunk/pmplib/lib/pmp/pmp.c 2007-01-26 00:37:56 UTC (rev 278) +++ trunk/pmplib/lib/pmp/pmp.c 2007-01-26 01:12:08 UTC (rev 279) @@ -95,7 +95,7 @@ ucs2free(playlist->name); } -void pmplib_playlist_copy(pmp_playlist_t* dst, const pmp_playlist_t* src) +void pmplib_playlist_clone(pmp_playlist_t* dst, const pmp_playlist_t* src) { int i; Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-26 00:37:56 UTC (rev 278) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-26 01:12:08 UTC (rev 279) @@ -676,6 +676,7 @@ static result_t pmpmusic_set_playlists(pmp_music_t* music, const pmp_playlist_t* playlists, uint32_t num_playlists) { uint32_t i, j; + static const ucs2char_t rootdir[] = {PATHCHAR,0}; static const ucs2char_t plp_ext[] = {'.','p','l','p',0}; pmp_music_internal_t* pmpmi = (pmp_music_internal_t*)music->instance; @@ -697,10 +698,9 @@ ucs2cpy(filepath, src->name); ucs2cat(filepath, plp_ext); + dst->filename = ucs2dup(filepath); - dst->filename = ucs2dup(filepath_skippath(filepath)); - - filepath_remove_filespec(filepath); + filepath_combinepath(filepath, MAX_PATH, rootdir, music->pmp->info.path_to_playlist); filepath_addslash(filepath); dst->filepath = ucs2dup(filepath_skipdrive(filepath, music->pmp->info.path_to_root)); filepath_slash(dst->filepath); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |