From: <ny...@us...> - 2006-04-16 14:48:43
|
Revision: 9 Author: nyaochi Date: 2006-04-16 07:47:55 -0700 (Sun, 16 Apr 2006) ViewCVS: http://svn.sourceforge.net/pmplib/?rev=9&view=rev Log Message: ----------- Added an option to enable JSPL. Read the media database automatically when JSPL is enabled. Modified Paths: -------------- trunk/frontend/easypmp/common/database.c trunk/frontend/easypmp/common/easypmp.h trunk/frontend/easypmp/common/enumerate.c trunk/frontend/easypmp/common/playlist.c trunk/frontend/easypmp/cui/main.c trunk/frontend/easypmp/cui/option.c trunk/frontend/easypmp/win32gui/easypmp_win32gui.rc trunk/frontend/easypmp/win32gui/maindlg.h trunk/frontend/easypmp/win32gui/preference.h trunk/frontend/easypmp/win32gui/processingdlg.h trunk/frontend/easypmp/win32gui/resource.h trunk/include/playlist.h trunk/lib/playlist/playlist.c Modified: trunk/frontend/easypmp/common/database.c =================================================================== --- trunk/frontend/easypmp/common/database.c 2006-04-05 13:57:51 UTC (rev 8) +++ trunk/frontend/easypmp/common/database.c 2006-04-16 14:47:55 UTC (rev 9) @@ -115,60 +115,8 @@ * Read the existing database for update processing mode. */ if (opt->verb & MODE_DATABASE_UPDATE) { - // Create a database engine. - res = pmp->create_instance_db(pmp, &pmpdb); - if (!pmpdb) { - result = MAKE_PMP_ERROR(res); - goto error_exit; - } - - // Start reading a database. - if (progress(instance, EASYPMPDBP_READ | EASYPMPSP_START, 0, 0, NULL) != 0) { - result = EASYPMPE_CANCEL; - goto error_exit; - } - - // Read the existing database. - res = pmpdb->read(pmpdb); - if (res != 0) { - result = MAKE_PMP_ERROR(res); - goto error_exit; - } - - // Obtain the number of records in the database. - res = pmpdb->get(pmpdb, NULL, &num_old_records); - if (res != 0) { - result = MAKE_PMP_ERROR(res); - goto error_exit; - } - - // Allocate an array for the records. - old_records = malloc(sizeof(pmp_record_t) * num_old_records); - if (!old_records) { - result = EASYPMPE_INSUFFICIENT_MEMORY; - goto error_exit; - } - - // Obtain the records from the database. - res = pmpdb->get(pmpdb, old_records, &num_old_records); - if (res != 0) { - result = MAKE_PMP_ERROR(res); - goto error_exit; - } - - // Sort the records for binary search. - qsort(old_records, num_old_records, sizeof(pmp_record_t), comp_filename); - - // Release the database instance. - if (pmpdb) { - pmpdb->release(pmpdb); - pmpdb = NULL; - } - - if (progress(instance, EASYPMPDBP_READ | EASYPMPSP_END, num_old_records, 0, NULL) != 0) { - result = EASYPMPE_CANCEL; - goto error_exit; - } + // + easypmp_database_read(pmp, opt, &old_records, &num_old_records, progress, instance); } else { if (progress(instance, EASYPMPDBP_READ | EASYPMPSP_SKIPPED, 0, 0, NULL) != 0) { result = EASYPMPE_CANCEL; @@ -319,6 +267,98 @@ return result; } + + +int +easypmp_database_read( + pmp_t* pmp, + const option_t* opt, + pmp_record_t** ptr_records, + uint32_t* ptr_num_records, + easypmp_progress_t progress, + void *instance +) +{ + int result = 0; + result_t res = 0; + pmpdb_t* pmpdb = NULL; + + /* + * Read the existing database for update processing mode. + */ + // Create a database engine. + res = pmp->create_instance_db(pmp, &pmpdb); + if (!pmpdb) { + result = MAKE_PMP_ERROR(res); + goto error_exit; + } + + // Start reading a database. + if (progress(instance, EASYPMPDBP_READ | EASYPMPSP_START, 0, 0, NULL) != 0) { + result = EASYPMPE_CANCEL; + goto error_exit; + } + + // Read the existing database. + res = pmpdb->read(pmpdb); + if (res != 0) { + result = MAKE_PMP_ERROR(res); + goto error_exit; + } + + // Obtain the number of records in the database. + res = pmpdb->get(pmpdb, NULL, ptr_num_records); + if (res != 0) { + result = MAKE_PMP_ERROR(res); + goto error_exit; + } + + // Allocate an array for the records. + (*ptr_records) = malloc(sizeof(pmp_record_t) * (*ptr_num_records)); + if (!(*ptr_records)) { + result = EASYPMPE_INSUFFICIENT_MEMORY; + goto error_exit; + } + + // Obtain the records from the database. + res = pmpdb->get(pmpdb, *ptr_records, ptr_num_records); + if (res != 0) { + result = MAKE_PMP_ERROR(res); + goto error_exit; + } + + // Sort the records for binary search. + qsort(*ptr_records, *ptr_num_records, sizeof(pmp_record_t), comp_filename); + + // Release the database instance. + if (pmpdb) { + pmpdb->release(pmpdb); + pmpdb = NULL; + } + + if (progress(instance, EASYPMPDBP_READ | EASYPMPSP_END, *ptr_num_records, 0, NULL) != 0) { + result = EASYPMPE_CANCEL; + goto error_exit; + } + + return result; + +error_exit: + /* + * Free allocated memory. + */ + if ((*ptr_records)) { + uint32_t i; + for (i = 0;i < *ptr_num_records;++i) { + pmp_record_finish(&((*ptr_records)[i])); + } + free((*ptr_records)); + } + return result; +} + + + int database_dump(pmp_t* pmp, FILE *fp, int level) { pmpdb_t* pmpdb = NULL; Modified: trunk/frontend/easypmp/common/easypmp.h =================================================================== --- trunk/frontend/easypmp/common/easypmp.h 2006-04-05 13:57:51 UTC (rev 8) +++ trunk/frontend/easypmp/common/easypmp.h 2006-04-16 14:47:55 UTC (rev 9) @@ -74,6 +74,7 @@ MODE_PLAYLIST_RECONVERT = 0x00000100, MODE_PLAYLIST_FIND = 0x00000200, MODE_PLAYLIST_SKIP = 0x00000400, + MODE_PLAYLIST_JSPL = 0x00000800, MODE_LIST_DEVICES = 0x00001000, MODE_HELP = 0x00010000, MODE_VERSION = 0x00020000, @@ -140,6 +141,16 @@ ); int +easypmp_database_read( + pmp_t* pmp, + const option_t* opt, + pmp_record_t** ptr_records, + uint32_t* ptr_num_records, + easypmp_progress_t progress, + void *instance +); + +int easypmp_playlist( const easypmp_filelist_t* playlists, const easypmp_filelist_t* musics, Modified: trunk/frontend/easypmp/common/enumerate.c =================================================================== --- trunk/frontend/easypmp/common/enumerate.c 2006-04-05 13:57:51 UTC (rev 8) +++ trunk/frontend/easypmp/common/enumerate.c 2006-04-16 14:47:55 UTC (rev 9) @@ -37,6 +37,7 @@ #include <easypmp.h> typedef struct { + const option_t* opt; easypmp_filelist_t* fl; pmp_t* pmp; easypmp_enumerate_progress_t proc; @@ -94,6 +95,7 @@ fl->elements = NULL; memset(&ed, 0, sizeof(ed)); + ed.opt = opt; ed.fl = fl; ed.pmp = pmp; ed.proc = proc; @@ -107,8 +109,9 @@ enumerate_dat_t* ed = (enumerate_dat_t*)instance; pmp_t* pmp = ed->pmp; easypmp_filelist_t* fl = ed->fl; + int flag = (ed->opt->verb & MODE_PLAYLIST_JSPL) ? PLAYLIST_JSPL : 0; - if (playlist_is_supported(found_file)) { + if (playlist_is_supported(found_file, flag)) { // Supported music file. easypmp_filename_t* new_filename = NULL; @@ -154,6 +157,7 @@ fl->elements = NULL; memset(&ed, 0, sizeof(ed)); + ed.opt = opt; ed.fl = fl; ed.pmp = pmp; ed.proc = proc; Modified: trunk/frontend/easypmp/common/playlist.c =================================================================== --- trunk/frontend/easypmp/common/playlist.c 2006-04-05 13:57:51 UTC (rev 8) +++ trunk/frontend/easypmp/common/playlist.c 2006-04-16 14:47:55 UTC (rev 9) @@ -106,7 +106,7 @@ playlist_normalize_prepare(mediafiles, musics->num_elements); // Start playlist conversion. - if (progress(instance, EASYPMPPLP_CONVERT | EASYPMPSP_START, musics->num_elements, 0, NULL) != 0) { + if (progress(instance, EASYPMPPLP_CONVERT | EASYPMPSP_START, playlists->num_elements, 0, NULL) != 0) { result = EASYPMPE_CANCEL; goto error_exit; } @@ -128,10 +128,19 @@ goto error_exit; } - // Read the source playlist + // Initialize playlist(s) instance. playlist_init(&pls); - if (playlist_read(&pls, src, opt->path_to_include, records, num_records, callback_from_playlist, &cd) != 0) { + // Read the source playlist. + if (playlist_read( + &pls, + src, + opt->path_to_include, + opt->verb & MODE_PLAYLIST_JSPL ? records : NULL, + num_records, + callback_from_playlist, + &cd + ) != 0) { result = EASYPMPE_PLAYLIST_READ; goto error_exit; } Modified: trunk/frontend/easypmp/cui/main.c =================================================================== --- trunk/frontend/easypmp/cui/main.c 2006-04-05 13:57:51 UTC (rev 8) +++ trunk/frontend/easypmp/cui/main.c 2006-04-16 14:47:55 UTC (rev 9) @@ -306,6 +306,10 @@ easypmp_database(&musics, pmp, &opt, &records, &num_records, easypmp_progress, NULL); } if (opt.verb & MODE_PLAYLIST) { + // Read the database for JSPL. + if ((opt.verb & MODE_PLAYLIST_JSPL) && (!records)) { + easypmp_database_read(pmp, &opt, &records, &num_records, easypmp_progress, NULL); + } easypmp_playlist(&playlists, &musics, pmp, &opt, records, num_records, easypmp_progress, NULL); } if (opt.verb & MODE_DATABASE_REPR) { Modified: trunk/frontend/easypmp/cui/option.c =================================================================== --- trunk/frontend/easypmp/cui/option.c 2006-04-05 13:57:51 UTC (rev 8) +++ trunk/frontend/easypmp/cui/option.c 2006-04-16 14:47:55 UTC (rev 9) @@ -74,6 +74,7 @@ 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, " -s, --skip-missing Continue a conversion even if a media file is missing\n"); + fprintf(fp, " -j, --jspl Enable JavaScript playlist (JSPL)\n"); fprintf(fp, "\n"); fprintf(fp, "Player options:\n"); fprintf(fp, " -L, --list-device Show the list of supported devices and exit\n"); @@ -126,6 +127,7 @@ {"reconvert", no_argument, 0, 'r'}, {"find-missing", no_argument, 0, 'f'}, {"skip-missing", no_argument, 0, 's'}, + {"jspl", no_argument, 0, 'j'}, {"list-device", no_argument, 0, 'L'}, {"device", required_argument, 0, 'd'}, #ifndef _WIN32 @@ -137,9 +139,9 @@ {NULL, 0, 0, 0} }; #ifndef _WIN32 - int c = getopt_long(argc, argv, "DuzRl:PMrfsLd:e:w:Vh", long_options, &option_index); + int c = getopt_long(argc, argv, "DuzRl:PMrfsjLd:e:w:Vh", long_options, &option_index); #else - int c = getopt_long(argc, argv, "DuzRl:PMrfsLd:Vh", long_options, &option_index); + int c = getopt_long(argc, argv, "DuzRl:PMrfsjLd:Vh", long_options, &option_index); #endif/*_WIN32*/ if (c == -1) { break; @@ -188,6 +190,9 @@ case 's': opt->verb |= MODE_PLAYLIST_SKIP; break; + case 'j': + opt->verb |= MODE_PLAYLIST_JSPL; + break; case 'L': opt->verb |= MODE_LIST_DEVICES; break; Modified: trunk/frontend/easypmp/win32gui/easypmp_win32gui.rc =================================================================== --- trunk/frontend/easypmp/win32gui/easypmp_win32gui.rc 2006-04-05 13:57:51 UTC (rev 8) +++ trunk/frontend/easypmp/win32gui/easypmp_win32gui.rc 2006-04-16 14:47:55 UTC (rev 9) @@ -84,73 +84,75 @@ // Dialog // -IDD_PREFERENCE DIALOGEX 0, 0, 263, 234 +IDD_PREFERENCE DIALOGEX 0, 0, 263, 246 STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU CAPTION "EasyPMP [Win32 GUI]" FONT 8, "MS Shell Dlg", 400, 0, 0x80 BEGIN - DEFPUSHBUTTON "OK",IDOK,144,210,48,12 - PUSHBUTTON "Cancel",IDCANCEL,204,210,48,12 + DEFPUSHBUTTON "OK",IDOK,144,222,48,12 + PUSHBUTTON "Cancel",IDCANCEL,204,222,48,12 GROUPBOX "Media database",IDC_STATIC,12,12,240,48 CONTROL "&None",IDC_RADIO_DATABASE,"Button",BS_AUTORADIOBUTTON | - WS_GROUP,24,25,72,8 - CONTROL "&Update",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,96,25, + WS_GROUP,24,24,72,8 + CONTROL "&Update",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,96,24, 72,8 - CONTROL "&Rebuild",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,168,25, + CONTROL "&Rebuild",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,168,24, 72,8 - GROUPBOX "Playlist conversion",IDC_STATIC,12,66,240,59 + GROUPBOX "Playlist conversion",IDC_STATIC,12,66,240,72 CONTROL "N&one",IDC_RADIO_PLAYLIST,"Button",BS_AUTORADIOBUTTON | - WS_GROUP,24,79,72,8 - CONTROL "&Update",IDC_RADIO5,"Button",BS_AUTORADIOBUTTON,96,79, + WS_GROUP,24,78,72,8 + CONTROL "&Update",IDC_RADIO5,"Button",BS_AUTORADIOBUTTON,96,78, 72,8 CONTROL "Re&convert",IDC_RADIO6,"Button",BS_AUTORADIOBUTTON,168, - 79,72,8 - LTEXT "Playlist folder(s):",IDC_STATIC,24,95,72,8 + 78,72,8 + LTEXT "Playlist folder(s):",IDC_STATIC,24,96,72,8 CONTROL "&Music",IDC_CHECK_PL_MUSIC,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,96,95,72,8 + WS_TABSTOP,96,96,72,8 CONTROL "&Playlist",IDC_CHECK_PL_PLAYLIST,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,168,95,72,8 - LTEXT "Conversion option:",IDC_STATIC,24,106,72,8 + BS_AUTOCHECKBOX | WS_TABSTOP,168,96,72,8 + LTEXT "Conversion option:",IDC_STATIC,24,108,72,8 CONTROL "&Find missing",IDC_CHECK_PL_FIND,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,96,106,72,8 + BS_AUTOCHECKBOX | WS_TABSTOP,96,108,72,8 CONTROL "&Skip missing",IDC_CHECK_PL_SKIP,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,168,106,72,8 - GROUPBOX "Portable Player Device",IDC_STATIC,12,130,240,72 - LTEXT "&Location:",IDC_STATIC,24,143,42,12,SS_CENTERIMAGE - COMBOBOX IDC_COMBO_DEVICE_LOCATION,78,143,42,36,CBS_DROPDOWNLIST | + BS_AUTOCHECKBOX | WS_TABSTOP,168,108,72,8 + GROUPBOX "Portable Player Device",IDC_STATIC,12,144,240,72 + LTEXT "&Location:",IDC_STATIC,24,156,42,12,SS_CENTERIMAGE + COMBOBOX IDC_COMBO_DEVICE_LOCATION,78,156,42,36,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "&Identifier:",IDC_STATIC,24,162,42,12,SS_CENTERIMAGE - COMBOBOX IDC_COMBO_DEVICE_ID,78,162,162,36,CBS_DROPDOWNLIST | + LTEXT "&Identifier:",IDC_STATIC,24,174,42,12,SS_CENTERIMAGE + COMBOBOX IDC_COMBO_DEVICE_ID,78,174,162,36,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Description:",IDC_STATIC,24,180,42,12,SS_CENTERIMAGE + LTEXT "Description:",IDC_STATIC,24,192,42,12,SS_CENTERIMAGE CONTROL "E&ject the player on completion",IDC_CHECK_SAFEREMOVE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,210,120,12 - LTEXT "\x83X\x83^\x83e\x83B\x83b\x83N",IDC_STATIC_PLAYER_DESCRIPTION,78,178,162, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,222,120,12 + LTEXT "\x83X\x83^\x83e\x83B\x83b\x83N",IDC_STATIC_PLAYER_DESCRIPTION,78,192,162, 12,0,WS_EX_CLIENTEDGE CONTROL "Sa&ve log",IDC_CHECK_SAVE_LOG,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,168,143,66,12 + WS_TABSTOP,168,156,66,12 LTEXT "Source of media information (&z):",IDC_STATIC,24,42,108, 12 COMBOBOX IDC_COMBO_MEDIAINFO_SOURCE,138,42,102,36, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + CONTROL "Use &JavaScript playlist (JSPL)",IDC_CHECK_PL_JSPL, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,96,120,144,8 END -IDD_PROCESSING DIALOGEX 0, 0, 263, 234 +IDD_PROCESSING DIALOGEX 0, 0, 263, 246 STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU CAPTION "EasyPMP [Win32 GUI]" FONT 8, "MS Shell Dlg", 400, 0, 0x80 BEGIN - DEFPUSHBUTTON "OK",IDOK,144,210,48,12,NOT WS_VISIBLE - PUSHBUTTON "Cancel",IDCANCEL,204,210,48,12 + DEFPUSHBUTTON "OK",IDOK,144,222,48,12,NOT WS_VISIBLE + PUSHBUTTON "Cancel",IDCANCEL,204,222,48,12 CONTROL "",IDC_LIST_PROGRESS,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | - WS_BORDER,12,12,240,78 - EDITTEXT IDC_EDIT_LOG,12,90,240,114,ES_MULTILINE | ES_AUTOHSCROLL | + WS_BORDER,12,12,240,84 + EDITTEXT IDC_EDIT_LOG,12,96,240,120,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL CONTROL "E&ject the player on completion",IDC_CHECK_SAFEREMOVE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,210,120,12 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,222,120,12 CONTROL "Don't &close",IDC_CHECK_DONT_CLOSE,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,144,210,48,12 + BS_AUTOCHECKBOX | WS_TABSTOP,144,222,48,12 END @@ -167,7 +169,7 @@ LEFTMARGIN, 7 RIGHTMARGIN, 256 TOPMARGIN, 7 - BOTTOMMARGIN, 227 + BOTTOMMARGIN, 239 END IDD_PROCESSING, DIALOG @@ -175,7 +177,7 @@ LEFTMARGIN, 7 RIGHTMARGIN, 256 TOPMARGIN, 7 - BOTTOMMARGIN, 227 + BOTTOMMARGIN, 239 END END #endif // APSTUDIO_INVOKED Modified: trunk/frontend/easypmp/win32gui/maindlg.h =================================================================== --- trunk/frontend/easypmp/win32gui/maindlg.h 2006-04-05 13:57:51 UTC (rev 8) +++ trunk/frontend/easypmp/win32gui/maindlg.h 2006-04-16 14:47:55 UTC (rev 9) @@ -70,6 +70,7 @@ DDX_CHECK(IDC_CHECK_PL_MUSIC, m_setting.bConvertInMusic) DDX_CHECK(IDC_CHECK_PL_FIND, m_setting.bSearchMissing) DDX_CHECK(IDC_CHECK_PL_SKIP, m_setting.bSkipMissing) + DDX_CHECK(IDC_CHECK_PL_JSPL, m_setting.bJSPL) DDX_CHECK(IDC_CHECK_SAVE_LOG, m_setting.bSaveLog) DDX_CHECK(IDC_CHECK_SAFEREMOVE, m_setting.bSafelyRemove) END_DDX_MAP() Modified: trunk/frontend/easypmp/win32gui/preference.h =================================================================== --- trunk/frontend/easypmp/win32gui/preference.h 2006-04-05 13:57:51 UTC (rev 8) +++ trunk/frontend/easypmp/win32gui/preference.h 2006-04-16 14:47:55 UTC (rev 9) @@ -33,6 +33,7 @@ BOOL bConvertInMusic; BOOL bSearchMissing; BOOL bSkipMissing; + BOOL bJSPL; CString strPlayerLocation; CString strPlayerIdentifier; CString strPlayerDescription; @@ -50,6 +51,7 @@ bConvertInMusic = TRUE; bSearchMissing = TRUE; bSkipMissing = FALSE; + bJSPL = FALSE; strPlayerLocation = _T(""); // Initialize empty. strPlayerIdentifier = _T(""); // Initialize empty. strPlayerDescription = _T(""); // Initialize empty. @@ -100,6 +102,7 @@ persistBool(bConvertInMusic, _T("Playlist"), _T("ConvertMusic"), szSettingFile, storing); persistBool(bSearchMissing, _T("Playlist"), _T("SearchMissing"), szSettingFile, storing); persistBool(bSkipMissing, _T("Playlist"), _T("SkipMissing"), szSettingFile, storing); + persistBool(bJSPL, _T("Playlist"), _T("JSPL"), szSettingFile, storing); persistString(strPlayerLocation, _T("Player"), _T("Location"), szSettingFile, storing); persistString(strPlayerIdentifier, _T("Player"), _T("Identifier"), szSettingFile, storing); persistBool(bSafelyRemove, _T("General"), _T("SafelyRemove"), szSettingFile, storing); Modified: trunk/frontend/easypmp/win32gui/processingdlg.h =================================================================== --- trunk/frontend/easypmp/win32gui/processingdlg.h 2006-04-05 13:57:51 UTC (rev 8) +++ trunk/frontend/easypmp/win32gui/processingdlg.h 2006-04-16 14:47:55 UTC (rev 9) @@ -275,11 +275,16 @@ if (m_preference.bConvertInPlaylist) opt.verb |= MODE_PLAYLIST_PLAYLIST; if (m_preference.bSearchMissing) opt.verb |= MODE_PLAYLIST_FIND; if (m_preference.bSkipMissing) opt.verb |= MODE_PLAYLIST_SKIP; + if (m_preference.bJSPL) opt.verb |= MODE_PLAYLIST_JSPL; // Set path to the root folder. m_preference.GetPathToPlayerRoot(str); ucs2cpy(opt.path_to_root, T2CW(str)); + // Set path to the include folder. + ::GetModuleFileNameW(_Module.GetModuleInstance(), opt.path_to_include, MAX_PATH); + ::PathRemoveFileSpecW(opt.path_to_include); + // Set model if (!m_preference.strPlayerIdentifier.IsEmpty()) { strcpy(opt.model, T2CA(m_preference.strPlayerIdentifier)); @@ -365,6 +370,11 @@ } } if (opt.verb & MODE_PLAYLIST) { + if ((opt.verb & MODE_PLAYLIST_JSPL) && (!records)) { + setState(PHASE_DATABASE_READ, STATE_PROCESSING); + easypmp_database_read(pmp, &opt, &records, &num_records, easypmp_progress, this); + setState(PHASE_DATABASE_READ, STATE_DONE); + } result = easypmp_playlist(&playlists, &musics, pmp, &opt, records, num_records, easypmp_progress, this); if (result != 0) { goto error_exit; Modified: trunk/frontend/easypmp/win32gui/resource.h =================================================================== --- trunk/frontend/easypmp/win32gui/resource.h 2006-04-05 13:57:51 UTC (rev 8) +++ trunk/frontend/easypmp/win32gui/resource.h 2006-04-16 14:47:55 UTC (rev 9) @@ -24,6 +24,8 @@ #define IDC_CHECK_SAVE_LOG 1012 #define IDC_COMBO_DEVICE_ID2 1013 #define IDC_COMBO_MEDIAINFO_SOURCE 1013 +#define IDC_CHECK_PL_FIND2 1014 +#define IDC_CHECK_PL_JSPL 1014 #define IDC_EDIT_LOG 1019 #define IDC_CHECK_SAFEREMOVE 1020 #define IDC_STATIC_PLAYER_DESCRIPTION 1021 Modified: trunk/include/playlist.h =================================================================== --- trunk/include/playlist.h 2006-04-05 13:57:51 UTC (rev 8) +++ trunk/include/playlist.h 2006-04-16 14:47:55 UTC (rev 9) @@ -37,6 +37,11 @@ struct tag_pmp_record_t; typedef struct tag_pmp_record_t pmp_record_t; enum { + PLAYLIST_NONE = 0, + PLAYLIST_JSPL = 1, +}; + +enum { PLCALLBACK_NONE, PLCALLBACK_JSPL_MESSAGE, PLCALLBACK_JSPL_ERROR, @@ -134,7 +139,8 @@ PLAYLISTAPI int playlist_is_supported( - const ucs2char_t* filename + const ucs2char_t* filename, + int flag ); PLAYLISTAPI Modified: trunk/lib/playlist/playlist.c =================================================================== --- trunk/lib/playlist/playlist.c 2006-04-05 13:57:51 UTC (rev 8) +++ trunk/lib/playlist/playlist.c 2006-04-16 14:47:55 UTC (rev 9) @@ -81,7 +81,7 @@ return playlist_m3u_read(pls, filename, 1); } else if (filepath_hasext(filename, ucs2cs_pls)) { return playlist_pls_read(pls, filename); - } else if (filepath_hasext(filename, ucs2cs_jspl)) { + } else if (records && filepath_hasext(filename, ucs2cs_jspl)) { return playlist_jspl_read(pls, filename, path_to_include, records, num_records, callback, instance); } else { return -1; @@ -129,13 +129,15 @@ return 0; } -int playlist_is_supported(const ucs2char_t* filename) +int playlist_is_supported(const ucs2char_t* filename, int flag) { int ret = 0; ret |= filepath_hasext(filename, ucs2cs_m3u); ret |= filepath_hasext(filename, ucs2cs_m3u8); ret |= filepath_hasext(filename, ucs2cs_pls); - ret |= filepath_hasext(filename, ucs2cs_jspl); + if (flag & PLAYLIST_JSPL) { + ret |= filepath_hasext(filename, ucs2cs_jspl); + } return ret; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |