From: <ny...@us...> - 2006-06-05 23:51:26
|
Revision: 44 Author: nyaochi Date: 2006-06-03 22:18:21 -0700 (Sat, 03 Jun 2006) ViewCVS: http://svn.sourceforge.net/pmplib/?rev=44&view=rev Log Message: ----------- Added a new option (--strip-words, -t) to configure a list of words to be stripped from artist names. Modified Paths: -------------- trunk/frontend/easypmp/common/database.c trunk/frontend/easypmp/common/easypmp.h trunk/frontend/easypmp/cui/option.c Modified: trunk/frontend/easypmp/common/database.c =================================================================== --- trunk/frontend/easypmp/common/database.c 2006-06-04 04:34:08 UTC (rev 43) +++ trunk/frontend/easypmp/common/database.c 2006-06-04 05:18:21 UTC (rev 44) @@ -378,3 +378,62 @@ pmpdb->release(pmpdb); return 0; } + + + +int easypmp_set_strip_words(option_t* opt, const ucs2char_t* str) +{ + size_t i; + const ucs2char_t *p = 0, *q = 0; + + /* + * This function parses a list of strip words specified by comma separated + * values (CSV) and stores them into the option_t instance. Escape by quatation + * mark, eg., "word, " is not allowed at this moment. + */ + + /* Free buffers allocated already. */ + for (i = 0;i < opt->num_strip_words;++i) { + ucs2free(opt->strip_words[i]); + } + ucs2free(opt->strip_words); + + if (str && *str) { + /* Count the number of strip words in str. */ + opt->num_strip_words = 1; + for (p = str;*p;++p) { + if (*p == ',') { + opt->num_strip_words++; + } + } + + /* Allocate an array to store strip words. */ + opt->strip_words = (ucs2char_t**)ucs2malloc(sizeof(ucs2char_t*) * opt->num_strip_words); + if (!opt->strip_words) { + return -1; + } + + /* Parse the list of strip words. */ + p = q = str; + for (i = 0;i < opt->num_strip_words;++i) { + opt->strip_words[i] = 0; + for (;;) { + if (*q == ',' || !*q) { + size_t length = (size_t)(q - p); + opt->strip_words[i] = (ucs2char_t*)ucs2malloc(sizeof(ucs2char_t) * (length+1)); + memset(opt->strip_words[i], 0, sizeof(ucs2char_t) * (length+1)); + ucs2ncpy(opt->strip_words[i], p, length); + opt->strip_words[i][length] = 0; + if (!*q) { + break; + } else { + p = q+1; + } + } + q++; + } + } + } + return 0; +} + Modified: trunk/frontend/easypmp/common/easypmp.h =================================================================== --- trunk/frontend/easypmp/common/easypmp.h 2006-06-04 04:34:08 UTC (rev 43) +++ trunk/frontend/easypmp/common/easypmp.h 2006-06-04 05:18:21 UTC (rev 44) @@ -153,6 +153,12 @@ ); int +easypmp_set_strip_words( + option_t* opt, + const ucs2char_t* str + ); + +int easypmp_playlist( const easypmp_filelist_t* playlists, const easypmp_filelist_t* musics, Modified: trunk/frontend/easypmp/cui/option.c =================================================================== --- trunk/frontend/easypmp/cui/option.c 2006-06-04 04:34:08 UTC (rev 43) +++ trunk/frontend/easypmp/cui/option.c 2006-06-04 05:18:21 UTC (rev 44) @@ -67,6 +67,7 @@ fprintf(fp, " -u, --update Update the existing media database incrementally\n"); fprintf(fp, " -R, --repr Output a database structure in plain text\n"); fprintf(fp, " -l, --repr-level=VAL Specify representation level\n"); + fprintf(fp, " -t, --strip-words=VAL Specify a list (CSV) of words to strip from artist names\n"); fprintf(fp, "\n"); fprintf(fp, "Playlist options:\n"); fprintf(fp, " -P, --playlist Convert playlist files in PLAYLIST directory\n"); @@ -93,42 +94,8 @@ static void set_strip_words(option_t* opt, const char *str) { - size_t i; - const char *p = 0, *q = 0; - - for (i = 0;i < opt->num_strip_words;++i) { - ucs2free(opt->strip_words[i]); - } - ucs2free(opt->strip_words); - - if (str && *str) { - opt->num_strip_words = 1; - for (p = str;*p;++p) { - if (*p == ',') { - opt->num_strip_words++; - } - } - - p = q = str; - opt->strip_words = (ucs2char_t**)ucs2malloc(sizeof(ucs2char_t*) * opt->num_strip_words); - for (i = 0;i < opt->num_strip_words;++i) { - opt->strip_words[i] = 0; - for (;;) { - if (*q == ',' || !*q) { - size_t length = mbstoucs2(0, 0, p, q-p); - opt->strip_words[i] = ucs2malloc(sizeof(ucs2char_t*) * length + 1); - mbstoucs2(opt->strip_words[i], length, p, q-p); - opt->strip_words[i][length] = 0; - if (!*q) { - break; - } else { - p = q+1; - } - } - q++; - } - } - } + ucs2char_t* ucs2str = mbsdupucs2(str); + easypmp_set_strip_words(opt, ucs2str); } int option_parse(option_t* opt, int argc, char *argv[], FILE *fpe) @@ -150,6 +117,7 @@ {"source", required_argument, 0, 'z'}, {"repr", no_argument, 0, 'R'}, {"repr-level", required_argument, 0, 'l'}, + {"strip-words", required_argument, 0, 't'}, {"playlist", no_argument, 0, 'P'}, {"music", no_argument, 0, 'M'}, {"reconvert", no_argument, 0, 'r'}, @@ -167,9 +135,9 @@ {NULL, 0, 0, 0} }; #ifndef _WIN32 - int c = getopt_long(argc, argv, "DuzRl:PMrfsjLd:e:w:Vh", long_options, &option_index); + int c = getopt_long(argc, argv, "DuzRl:t:PMrfsjLd:e:w:Vh", long_options, &option_index); #else - int c = getopt_long(argc, argv, "DuzRl:PMrfsjLd:Vh", long_options, &option_index); + int c = getopt_long(argc, argv, "DuzRl:t:PMrfsjLd:Vh", long_options, &option_index); #endif/*_WIN32*/ if (c == -1) { break; @@ -203,6 +171,9 @@ case 'l': opt->repr_level = atoi(optarg); break; + case 't': + set_strip_words(opt, optarg); + break; case 'P': opt->verb |= (MODE_PLAYLIST | MODE_PLAYLIST_PLAYLIST); break; @@ -227,7 +198,7 @@ case 'd': strcpy(opt->model, optarg); break; -#ifndef _WIN32 +#ifndef _WIN32 case 'e': opt->system_encoding = optarg; break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <suc...@us...> - 2006-06-25 02:19:57
|
Revision: 64 Author: sucknblow Date: 2006-06-24 19:19:51 -0700 (Sat, 24 Jun 2006) ViewCVS: http://svn.sourceforge.net/pmplib/?rev=64&view=rev Log Message: ----------- Changing command line options: -D/--database and -u/--update become -c/--create and -u/--update (so similar to tar). -P and -M are now lower case - often used options should be easier to type. -l becomes -L, so case is consistent with -R, the only option with which it becomes useful. -L becomes -l. Frequently used options are now documented in the man page. Modified Paths: -------------- trunk/frontend/easypmp/cui/easypmp.1 trunk/frontend/easypmp/cui/option.c Property Changed: ---------------- trunk/frontend/easypmp/cui/ Property changes on: trunk/frontend/easypmp/cui ___________________________________________________________________ Name: svn:ignore + Makefile.in Makefile .libs .deps easypmp Modified: trunk/frontend/easypmp/cui/easypmp.1 =================================================================== --- trunk/frontend/easypmp/cui/easypmp.1 2006-06-24 17:48:10 UTC (rev 63) +++ trunk/frontend/easypmp/cui/easypmp.1 2006-06-25 02:19:51 UTC (rev 64) @@ -1,5 +1,5 @@ .\" Hey, EMACS: -*- nroff -*- -.TH EASYPMP 1 "June 2, 2006" +.TH EASYPMP 1 "June 25, 2006" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -16,37 +16,141 @@ easypmp \- create music databases used by portable media players .SH SYNOPSIS .B easypmp -.R [ -.B -D -.R | -.B -u -.RI "] [" mount-point ] +.RB [ -c | -u "] [" -p "] [" -m "] [" -R " [" -L +.IR level "] ]" +.RI [ mount-point ] +.br +.BR "easypmp " [ -h | -v ] + .SH DESCRIPTION -.\" TeX users may be more comfortable with the \fB<whatever>\fP and -.\" \fI<whatever>\fP escape sequences to invode bold face and italics, -.\" respectively. - \fBeasypmp\fP is a command line utility used to create and maintain the -music database on a variety of portable music players. +music database on a variety of portable media players. -Many Portable music players allow the user to browse tracks by artist, -album, genre, pre-defined playlists etc. In order to do this +Many portable music players allow the user to browse tracks by artist, +album, genre, predefined playlists etc. In order to do this efficiently, they require a database of track information. Without this database, the player may require the user to browse tracks using only the directory structure. \fBeasypmp\fP exists to create that database, based on the tracks and playlists that are stored on the player. -.\".SH OPTIONS" -.\"These programs follow the usual GNU command line syntax, with long" -.\"options starting with two dashes (`-')." +Normally, \fBeasypmp\fP is able to detect the type of any supported +media player automatically. It does so by comparing the files and +directories found at the specified mount point with the list of files +it expects to find on each type of device that it supports. If no +mount point is specified, the current working directory is assumed to +be the mount point. + +In order to check that \fBeasypmp\fP can identify the type of media +player, the media player should be mounted as a USB device. The +program should then be run without any command line switches (although +the mount point should be specified if it is not the current +directory). If the device is recognised, \fBeasypmp\fP displays +information about the device, including the directories in which it +expects to find music and playlists on that device. If the device is +not recognised, an error message to this effect is shown. + + +.SH DEVICE SUPPORT +\fBeasypmp\fP currently only works with media players that can be +mounted as \fIUSB Mass Storage\fR (UMS) devices. Specifically, it +has been tested with the following devices: + + * iRiver H100 series + * iRiver H300 series + * iRiver H10 UMS + * iRiver H10 MTP (with emergency connect mode) + * iRiver H10Jr. UMS + * iRiver U10 UMS + * MEDION MDJuke220 + * MEDION MDJuke440 + * Samsung YH-820 + +Note that some of the iRiver devices listed above may not support UMS +as shipped. For example, in Europe and the United States, the iRiver +U10 ships with support for a proprietary file transfer protocol called +\fIMedia Transfer Protocol\fR (MTP). In order to use these devices +with \fBeasypmp\fP, it is necessary to re-program (or `flash') the +firmware on the device to make it support UMS. This can be +accomplished by running the iRiver firmware updater for iRiver +products. At the time of writing this works with T10, T20, T30, U10 +and N12 models, with the exception of 256MB and 2GB models in these +series. The firmware updater can be downloaded from: +.br + http://www.iriver.com/mtp/ + +Note that the iRiver firmware updater is a Windows program. The +program requires that your computer be connected to the Internet when +run, in order to download the latest firmware for the device. Please +note that updating the firmware on a device using this program will +erase any data already stored on the device. + +.SH OPTIONS +\fBeasypmp\fP follows the usual GNU command line syntax, with long +options starting with two dashes (`-'). .\"A summary of options is included below." -.\".TP" -.\".B \-h, \-\-help" -.\"Show summary of options." -.\".TP" -.\".B \-V, \-\-version" -.\"Show version of program." +.TP +.B \-c, \-\-create +Create a new music database from scratch. The music files in the +directory on the device used for storing music files is scanned +recursively for music files. For each file found, the meta-data +stored in that file - including the genre, artist, album and track +name - is read, and used to add a record for that file in the music +database stored on the device. +.TP +.B \-u, \-\-update +Update the music database stored on the device. This is similar to +the \fB-d\fP option, with the exception that, when an entry for a +given music file already exists in the database stored on the device, +the meta-data already stored in the database is not updated. + +Using this option means that \fBeasypmp\fP does not need to re-read +the meta-data in every music file on the device. Rather, it only has +to read the meta-data in music files that were not on the device the +last time the database was updated. Thus this option is a faster way +creating the music database when only a few tracks on the device have +been changed since the database was last created or updated. However, +if the meta-data in existing files has changed, this may not be +reflected in the database when using this option. +.TP +.B \-p, \-\-playlist +Many programs for playing music allow playlists to be created and +saved on disk, ready to be played later. Such playlists frequently +have a \fB.m3u\fP extension. However, the playlists saved by most +programs cannot be used directly on portable media players. Instead, +it is necessary to convert (or `compile') each playlist into a format +that the media player can read. + +When the \fB\-p\fP/\fB\-\-playlist\fP option is specified, +\fBeasypmp\fP will search the playlist directory on the device for +playlists that can be converted into a form that the media player can +read (see the \fBDESCRIPTION\fP section above for information on how +to determine the playlist directory for a particular media player). +.TP +.B \-m, \-\-music +The \fB\-m\fP/\fB\-\-music\fP option is similar to the +\fB\-p\fP/\fB\-\-playlist\fP option. However, instead of searching +the playlist directory on the media player for playlists, it searches +in the music directory on the player instead. +.TP +.B \-R, \-\-repr +Output a textual representation of the music database on standard +output. This option is seldom used: it may be useful for debugging +purposes, or if bored. +.TP +\fB \-L \fIlevel\fP, \-\-repr-level=\fIlevel\fP +Specifies the format of the textual representation of the music +database. This option is only meaningful if the \fB\-R\fP option is +used. The value of \fIlevel\fP should be an natural number: that is, +either 0 or a positive integer. The meaning of the given value +depends on the type of media player in use. Currently, the only +values of \fIlevel\fP that may produce different results are 0 and 1. +.TP +.B \-h, \-\-help +Show summary of options. +.TP +.B \-v, \-\-version +Show version of program. .SH EXAMPLES These examples assume a media player has been mounted as a normal USB disk using /media/sda as a mount point. Modified: trunk/frontend/easypmp/cui/option.c =================================================================== --- trunk/frontend/easypmp/cui/option.c 2006-06-24 17:48:10 UTC (rev 63) +++ trunk/frontend/easypmp/cui/option.c 2006-06-25 02:19:51 UTC (rev 64) @@ -63,22 +63,22 @@ fprintf(fp, "\n"); fprintf(fp, "Media database options:\n"); - fprintf(fp, " -D, --database Construct a media database\n"); + fprintf(fp, " -c, --create Construct a media database\n"); fprintf(fp, " -u, --update Update the existing media database incrementally\n"); fprintf(fp, " -R, --repr Output a database structure in plain text\n"); - fprintf(fp, " -l, --repr-level=VAL Specify representation level\n"); + fprintf(fp, " -L, --repr-level=VAL Specify representation level\n"); fprintf(fp, " -t, --strip-words=VAL Specify a list (CSV) of words to strip from artist names\n"); fprintf(fp, "\n"); fprintf(fp, "Playlist options:\n"); - fprintf(fp, " -P, --playlist Convert playlist files in PLAYLIST directory\n"); - fprintf(fp, " -M, --music Convert playlist files in MUSIC directory\n"); + fprintf(fp, " -p, --playlist Convert playlist files in PLAYLIST directory\n"); + fprintf(fp, " -m, --music Convert playlist files in MUSIC directory\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, " -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"); + fprintf(fp, " -l, --list-device Show the list of supported devices and exit\n"); fprintf(fp, " -d, --device Specify a device identifier for the player\n"); fprintf(fp, "\n"); #ifndef _WIN32 @@ -88,7 +88,7 @@ fprintf(fp, "\n"); #endif/*_WIN32*/ fprintf(fp, "Miscellaneous options:\n"); - fprintf(fp, " -V, --version Show version number and exit\n"); + fprintf(fp, " -v, --version Show version number and exit\n"); fprintf(fp, " -h, --help Show this help message and exit\n"); } @@ -112,39 +112,39 @@ int this_option_optind = optind ? optind : 1; int option_index = 0; static const struct option long_options[] = { - {"database", no_argument, 0, 'D'}, + {"create", no_argument, 0, 'c'}, {"update", no_argument, 0, 'u'}, {"source", required_argument, 0, 'z'}, {"repr", no_argument, 0, 'R'}, - {"repr-level", required_argument, 0, 'l'}, + {"repr-level", required_argument, 0, 'L'}, {"strip-words", required_argument, 0, 't'}, - {"playlist", no_argument, 0, 'P'}, - {"music", no_argument, 0, 'M'}, + {"playlist", no_argument, 0, 'p'}, + {"music", no_argument, 0, 'm'}, {"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'}, + {"list-device", no_argument, 0, 'l'}, {"device", required_argument, 0, 'd'}, #ifndef _WIN32 {"encoding", required_argument, 0, 'e'}, {"tagencoding", required_argument, 0, 'w'}, #endif/*_WIN32*/ - {"version", no_argument, 0, 'V'}, + {"version", no_argument, 0, 'v'}, {"help", no_argument, 0, 'h'}, {NULL, 0, 0, 0} }; #ifndef _WIN32 - int c = getopt_long(argc, argv, "DuzRl:t:PMrfsjLd:e:w:Vh", long_options, &option_index); + int c = getopt_long(argc, argv, "cuzRL:t:pmrfsjlD:e:w:vh", long_options, &option_index); #else - int c = getopt_long(argc, argv, "DuzRl:t:PMrfsjLd:Vh", long_options, &option_index); + int c = getopt_long(argc, argv, "cuzRL:t:pmrfsjlD:vh", long_options, &option_index); #endif/*_WIN32*/ if (c == -1) { break; } switch (c) { - case 'D': + case 'c': opt->verb |= MODE_DATABASE; break; case 'u': @@ -168,16 +168,16 @@ case 'R': opt->verb |= MODE_DATABASE_REPR; break; - case 'l': + case 'L': opt->repr_level = atoi(optarg); break; case 't': set_strip_words(opt, optarg); break; - case 'P': + case 'p': opt->verb |= (MODE_PLAYLIST | MODE_PLAYLIST_PLAYLIST); break; - case 'M': + case 'm': opt->verb |= (MODE_PLAYLIST | MODE_PLAYLIST_MUSIC); break; case 'r': @@ -192,7 +192,7 @@ case 'j': opt->verb |= MODE_PLAYLIST_JSPL; break; - case 'L': + case 'l': opt->verb |= MODE_LIST_DEVICES; break; case 'd': @@ -206,7 +206,7 @@ opt->music_encoding = optarg; break; #endif/*_WIN32*/ - case 'V': + case 'v': opt->verb |= MODE_VERSION; break; case 'h': This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <suc...@us...> - 2006-06-25 18:19:53
|
Revision: 70 Author: sucknblow Date: 2006-06-25 11:19:48 -0700 (Sun, 25 Jun 2006) ViewCVS: http://svn.sourceforge.net/pmplib/?rev=70&view=rev Log Message: ----------- Install manual page. -D option became -d --- forgot some of the changes required for this. Make -u option do "database mode". Modified Paths: -------------- trunk/frontend/easypmp/cui/Makefile.am trunk/frontend/easypmp/cui/option.c Modified: trunk/frontend/easypmp/cui/Makefile.am =================================================================== --- trunk/frontend/easypmp/cui/Makefile.am 2006-06-25 06:10:55 UTC (rev 69) +++ trunk/frontend/easypmp/cui/Makefile.am 2006-06-25 18:19:48 UTC (rev 70) @@ -1,7 +1,7 @@ # $Id$ bin_PROGRAMS = easypmp -man_MANS = +man_MANS = easypmp.1 EXTRA_DIST = ${man_MANS} getopt.c getopt1.c easypmp_SOURCES = \ Modified: trunk/frontend/easypmp/cui/option.c =================================================================== --- trunk/frontend/easypmp/cui/option.c 2006-06-25 06:10:55 UTC (rev 69) +++ trunk/frontend/easypmp/cui/option.c 2006-06-25 18:19:48 UTC (rev 70) @@ -135,9 +135,9 @@ {NULL, 0, 0, 0} }; #ifndef _WIN32 - int c = getopt_long(argc, argv, "cuzRL:t:pmrfsjlD:e:w:vh", long_options, &option_index); + int c = getopt_long(argc, argv, "cuzRL:t:pmrfsjld:e:w:vh", long_options, &option_index); #else - int c = getopt_long(argc, argv, "cuzRL:t:pmrfsjlD:vh", long_options, &option_index); + int c = getopt_long(argc, argv, "cuzRL:t:pmrfsjld:vh", long_options, &option_index); #endif/*_WIN32*/ if (c == -1) { break; @@ -148,7 +148,7 @@ opt->verb |= MODE_DATABASE; break; case 'u': - opt->verb |= MODE_DATABASE_UPDATE; + opt->verb |= (MODE_DATABASE | MODE_DATABASE_UPDATE); break; case 'z': if (strcmp(optarg, "m") == 0) opt->media_info_source = GMIF_TAG; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2006-07-02 11:51:42
|
Revision: 106 Author: nyaochi Date: 2006-07-02 04:51:36 -0700 (Sun, 02 Jul 2006) ViewCVS: http://svn.sourceforge.net/pmplib/?rev=106&view=rev Log Message: ----------- I was surprised to see that the code did not use the character encodings specified by -w and -e options. The previous code was fixed to CP932 (Shift_JIS Japanese) encoding, which is compatible with US-ASCII. Modified Paths: -------------- trunk/frontend/easypmp/cui/main.c trunk/frontend/easypmp/cui/option.c Modified: trunk/frontend/easypmp/cui/main.c =================================================================== --- trunk/frontend/easypmp/cui/main.c 2006-07-02 11:21:46 UTC (rev 105) +++ trunk/frontend/easypmp/cui/main.c 2006-07-02 11:51:36 UTC (rev 106) @@ -217,11 +217,11 @@ #ifndef _WIN32 if (opt.system_encoding) { + set_encoding(opt.system_encoding); } - set_encoding("CP932"); if (opt.music_encoding) { + set_encoding_music(opt.music_encoding); } - set_encoding_music("CP932"); #endif/*_WIN32*/ /* Obtain the path to root directory (path_to_root) from the command line if any. */ Modified: trunk/frontend/easypmp/cui/option.c =================================================================== --- trunk/frontend/easypmp/cui/option.c 2006-07-02 11:21:46 UTC (rev 105) +++ trunk/frontend/easypmp/cui/option.c 2006-07-02 11:51:36 UTC (rev 106) @@ -203,9 +203,11 @@ break; #ifndef _WIN32 case 'e': - opt->system_encoding = optarg; + free(opt->system_encoding); + opt->system_encoding = strdup(optarg); break; case 'w': + free(opt->music_encoding); opt->music_encoding = optarg; break; #endif/*_WIN32*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2006-07-02 12:05:08
|
Revision: 107 Author: nyaochi Date: 2006-07-02 05:04:58 -0700 (Sun, 02 Jul 2006) ViewCVS: http://svn.sourceforge.net/pmplib/?rev=107&view=rev Log Message: ----------- Added initialization interface for option_t. Modified Paths: -------------- trunk/frontend/easypmp/cui/main.c trunk/frontend/easypmp/cui/option.c trunk/frontend/easypmp/cui/option.h trunk/frontend/easypmp/win32gui/easypmp_win32gui.vcproj Modified: trunk/frontend/easypmp/cui/main.c =================================================================== --- trunk/frontend/easypmp/cui/main.c 2006-07-02 11:51:36 UTC (rev 106) +++ trunk/frontend/easypmp/cui/main.c 2006-07-02 12:04:58 UTC (rev 107) @@ -204,6 +204,9 @@ setlocale(LC_ALL, ""); + // Initialize option values. + option_init(&opt); + // Show copyright information. fprintf(fpe, APPLICATION_S " " VERSION_S " " COPYRIGHT_S "\n"); fprintf(fpe, "\n"); @@ -348,6 +351,7 @@ pmp->release(pmp); pmphelp_finish(pmphelp); + option_finish(&opt); return ret; @@ -360,5 +364,6 @@ pmphelp_finish(pmphelp); pmphelp = NULL; } + option_finish(&opt); return ret; } Modified: trunk/frontend/easypmp/cui/option.c =================================================================== --- trunk/frontend/easypmp/cui/option.c 2006-07-02 11:51:36 UTC (rev 106) +++ trunk/frontend/easypmp/cui/option.c 2006-07-02 12:04:58 UTC (rev 107) @@ -101,15 +101,32 @@ easypmp_set_strip_words(opt, ucs2str); } -int option_parse(option_t* opt, int argc, char *argv[], FILE *fpe) +void option_init(option_t* opt) { - int used_args = 0; - memset(opt, 0, sizeof(*opt)); + // Set default values here. opt->media_info_source |= (GMIF_TAG | GMIF_STRIP_ARTIST); set_strip_words(opt, "the "); +} +void option_finish(option_t* opt) +{ + int i; + + for (i = 0;i < opt->num_strip_words;++i) { + ucs2free(opt->strip_words[i]); + } + ucs2free(opt->strip_words); + free(opt->system_encoding); + free(opt->music_encoding); + memset(opt, 0, sizeof(*opt)); +} + +int option_parse(option_t* opt, int argc, char *argv[], FILE *fpe) +{ + int used_args = 0; + /* Parse the command-line arguments. */ for (;;) { int this_option_optind = optind ? optind : 1; Modified: trunk/frontend/easypmp/cui/option.h =================================================================== --- trunk/frontend/easypmp/cui/option.h 2006-07-02 11:51:36 UTC (rev 106) +++ trunk/frontend/easypmp/cui/option.h 2006-07-02 12:04:58 UTC (rev 107) @@ -25,7 +25,9 @@ #ifndef __OPTION_H__ #define __OPTION_H__ +void option_init(option_t* opt); +void option_finish(option_t* opt); +int option_parse(option_t* opt, int argc, char *argv[], FILE *fpe); void option_usage(FILE *fp, const char *argv0); -int option_parse(option_t* opt, int argc, char *argv[], FILE *fpe); #endif/*__OPTION_H__*/ Modified: trunk/frontend/easypmp/win32gui/easypmp_win32gui.vcproj =================================================================== --- trunk/frontend/easypmp/win32gui/easypmp_win32gui.vcproj 2006-07-02 11:51:36 UTC (rev 106) +++ trunk/frontend/easypmp/win32gui/easypmp_win32gui.vcproj 2006-07-02 12:04:58 UTC (rev 107) @@ -201,6 +201,9 @@ <File RelativePath=".\res\processing.ico"> </File> + <File + RelativePath=".\res\queuing.ico"> + </File> </Filter> <Filter Name="common"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ny...@us...> - 2006-07-27 16:07:55
|
Revision: 132 Author: nyaochi Date: 2006-07-27 09:07:48 -0700 (Thu, 27 Jul 2006) ViewCVS: http://svn.sourceforge.net/pmplib/?rev=132&view=rev Log Message: ----------- Fix for stripping preceding words in artist names: - We must not call any string conversion routine from the option parser since the character encoding has not been decided yet. - The previous implementation could not parse CSV values correctly. Modified Paths: -------------- trunk/frontend/easypmp/common/database.c trunk/frontend/easypmp/common/easypmp.h trunk/frontend/easypmp/cui/main.c trunk/frontend/easypmp/cui/option.c Modified: trunk/frontend/easypmp/common/database.c =================================================================== --- trunk/frontend/easypmp/common/database.c 2006-07-26 15:11:46 UTC (rev 131) +++ trunk/frontend/easypmp/common/database.c 2006-07-27 16:07:48 UTC (rev 132) @@ -429,11 +429,10 @@ memset(opt->strip_words[i], 0, sizeof(ucs2char_t) * (length+1)); ucs2ncpy(opt->strip_words[i], p, length); opt->strip_words[i][length] = 0; - if (!*q) { - break; - } else { + if (*q) { p = q+1; } + break; } q++; } Modified: trunk/frontend/easypmp/common/easypmp.h =================================================================== --- trunk/frontend/easypmp/common/easypmp.h 2006-07-26 15:11:46 UTC (rev 131) +++ trunk/frontend/easypmp/common/easypmp.h 2006-07-27 16:07:48 UTC (rev 132) @@ -91,6 +91,7 @@ char model[128]; char *system_encoding; char *music_encoding; + char *mbs_strip_words; ucs2char_t** strip_words; int num_strip_words; } option_t; Modified: trunk/frontend/easypmp/cui/main.c =================================================================== --- trunk/frontend/easypmp/cui/main.c 2006-07-26 15:11:46 UTC (rev 131) +++ trunk/frontend/easypmp/cui/main.c 2006-07-27 16:07:48 UTC (rev 132) @@ -233,6 +233,13 @@ } #endif/*_WIN32*/ + /* Set words to be stripped from artist names. */ + if (opt.mbs_strip_words) { + ucs2char_t* ucs2str = mbsdupucs2(opt.mbs_strip_words); + easypmp_set_strip_words(&opt, ucs2str); + ucs2free(ucs2str); + } + /* Obtain the path to root directory (path_to_root) from the command line if any. */ if (used_args < argc) { size_t length = strlen(argv[used_args]); Modified: trunk/frontend/easypmp/cui/option.c =================================================================== --- trunk/frontend/easypmp/cui/option.c 2006-07-26 15:11:46 UTC (rev 131) +++ trunk/frontend/easypmp/cui/option.c 2006-07-27 16:07:48 UTC (rev 132) @@ -99,12 +99,6 @@ fprintf(fp, " -h, --help Show this help message and exit\n"); } -static void set_strip_words(option_t* opt, const char *str) -{ - ucs2char_t* ucs2str = mbsdupucs2(str); - easypmp_set_strip_words(opt, ucs2str); -} - static char *get_default_encoding() { const char *encoding = getenv("CHARSET"); @@ -123,9 +117,9 @@ // Set default values here. opt->media_info_source |= (GMIF_TAG | GMIF_STRIP_ARTIST); - set_strip_words(opt, "the "); opt->system_encoding = get_default_encoding(); opt->music_encoding = get_default_encoding(); + opt->mbs_strip_words = strdup("the "); } void option_finish(option_t* opt) @@ -145,7 +139,11 @@ { int used_args = 0; - /* Parse the command-line arguments. */ + /* + * Parse the command-line arguments. + * We must not use the charaset conversion routine from this function + * since the character encoding has not been decided at this moment. + */ for (;;) { int this_option_optind = optind ? optind : 1; int option_index = 0; @@ -210,7 +208,8 @@ opt->repr_level = atoi(optarg); break; case 't': - set_strip_words(opt, optarg); + free(opt->mbs_strip_words); + opt->mbs_strip_words = strdup(optarg); break; case 'p': opt->verb |= (MODE_PLAYLIST | MODE_PLAYLIST_PLAYLIST); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <suc...@us...> - 2006-07-29 21:56:48
|
Revision: 152 Author: sucknblow Date: 2006-07-29 14:56:41 -0700 (Sat, 29 Jul 2006) ViewCVS: http://svn.sourceforge.net/pmplib/?rev=152&view=rev Log Message: ----------- Don't show JSPL options where not supported. -j/--jspl are still accepted when not supported, but their use produces a warning. Modified Paths: -------------- trunk/frontend/easypmp/cui/main.c trunk/frontend/easypmp/cui/option.c Modified: trunk/frontend/easypmp/cui/main.c =================================================================== --- trunk/frontend/easypmp/cui/main.c 2006-07-29 20:54:17 UTC (rev 151) +++ trunk/frontend/easypmp/cui/main.c 2006-07-29 21:56:41 UTC (rev 152) @@ -346,9 +346,15 @@ if (opt.verb & MODE_PLAYLIST) { // Read the database for JSPL. if ((opt.verb & MODE_PLAYLIST_JSPL) && (!records)) { +#ifdef HAVE_JSAPI_H easypmp_database_read(pmp, &opt, &records, &num_records, easypmp_progress, NULL); +#else + fprintf(fpe, "Warning: Ignoring -j/--jspl option. This version of easypmp\n"); + fprintf(fpe, " was built without support for JavaScript playlists.\n"); +#endif } easypmp_playlist(&playlists, &musics, pmp, &opt, records, num_records, easypmp_progress, NULL); + } if (opt.verb & MODE_DATABASE_REPR) { database_dump(pmp, fpo, opt.repr_level); Modified: trunk/frontend/easypmp/cui/option.c =================================================================== --- trunk/frontend/easypmp/cui/option.c 2006-07-29 20:54:17 UTC (rev 151) +++ trunk/frontend/easypmp/cui/option.c 2006-07-29 21:56:41 UTC (rev 152) @@ -82,7 +82,9 @@ 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"); +#ifdef HAVE_JSAPI_H fprintf(fp, " -j, --jspl Enable JavaScript playlist (JSPL)\n"); +#endif fprintf(fp, "\n"); fprintf(fp, "Player options:\n"); fprintf(fp, " -l, --list-device Show the list of supported devices and exit\n"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |