From e19d33dfba7f37810936ef2845a00b816ffed70f Mon Sep 17 00:00:00 2001 From: Antoine Jacquet Date: Wed, 17 Jan 2007 00:00:00 +0100 Subject: [PATCH] version 0.36 (by Hank Barta) * added .pla output (to work with Sansa e200 series player) * fix segmentation fault with backslash option (patch by Antoine Jacquet) --- CHANGELOG | 4 ++++ README | 4 ++-- fapg.1 | 8 ++++++-- fapg.c | 40 +++++++++++++++++++++++++++++++++++----- 4 files changed, 47 insertions(+), 9 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 32497e0..af891f2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,9 @@ Change log file for FAPG +version 0.36 (2007-01-17) (by Hank Barta) + * Added .pla output (to work with Sansa e200 series player) + * Fix segmentation fault with backslash option (patch by Antoine Jacquet) + version 0.35 (2006-02-08) (by Andreas Neuper) * BUG fix: no more ampersand in RSS feeds are passed * BUG fix: no more spaces or non-printables in links of RSS feeds diff --git a/README b/README index d48459a..9a2ec11 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -FAPG 0.35 (Fast Audio Playlist Generator) +FAPG 0.36 (Fast Audio Playlist Generator) site: http://royale.zerezo.com/fapg/ mail: royale@zerezo.com @@ -7,7 +7,7 @@ make make install usage: -fapg [-b|--backslash] [-d|--debug] [-f|--format=m3u|pls|html|rss] [-g|--genre=#:#:...] [-o|--output=/path/to/file.m3u] [-p|--prefix=/the/prefix] [-r|--recursive] [-w|--windows] [-x|--exclude=#:#:...] [-c|--command=] /path/to/mp3/dir1 [/path/to/mp3/dir2 ...] +fapg [-b|--backslash] [-d|--debug] [-f|--format=m3u|pls|html|rss|pla] [-g|--genre=#:#:...] [-o|--output=/path/to/file.m3u] [-p|--prefix=/the/prefix] [-r|--recursive] [-w|--windows] [-x|--exclude=#:#:...] [-c|--command=] /path/to/mp3/dir1 [/path/to/mp3/dir2 ...] - backslash : replace the '/' with '\' in Unix path. - debug : display useful messages if the program fails ;) - format : choose which format of playlist you want to generate (default is m3u). diff --git a/fapg.1 b/fapg.1 index c7ca1ff..88b48d5 100644 --- a/fapg.1 +++ b/fapg.1 @@ -1,7 +1,7 @@ .\" Process this file with .\" groff -man -Tascii foo.1 .\" -.TH FAPG 1 "APRIL 2004" Linux "User Manuals" +.TH FAPG 1 "JANUARY 2007" Linux "User Manuals" .SH NAME fapg \- Fast Audio Playlist Generator @@ -32,7 +32,7 @@ formats. Replace the '/' with '\' in Unix path. .IP -d|--debug Display useful messages if the program fails ;) -.IP -f|--format=m3u|pls|html|rss +.IP -f|--format=m3u|pls|html|rss|pla Choose which format of playlist you want to generate (default is m3u). .IP -g|--genre=#:#:... Choose which genres (numerical values only) will be included in the generated playlist (default is all). @@ -72,6 +72,10 @@ A playlist that contains all your classical tracks may receive the genres to inc Generate a podcasting XML file using an external program rss.sh to generate a detailed description: .B fapg --output=dir.xml -f rss -c /usr/local/bin/rss.sh -r --prefix=http://thisserver/basedir path/to/mp3 + +Generate a playlist that will work on a Sansa e200 series MP3 player: +.B fapg -f pla -o /path/to/playlist.pla /path/to/all/music + if command starts with .I intern the build-in description (Author,Title,Link) is generated. diff --git a/fapg.c b/fapg.c index 19eb30a..0ec3835 100644 --- a/fapg.c +++ b/fapg.c @@ -1,7 +1,3 @@ -/* - * FAPG - */ -#define VERSION "0.35" /* * FAPG means Fast Audio Playlist Generator. * It is a tool to generate list of audio files (Wav, MP3, Ogg, etc) @@ -42,6 +38,7 @@ #include #include "genres.h" +#define VERSION "0.36" #define MP3_BASE 1024 #define OGG_BASE 1024*10 #define MAX 1024*200 /* 200ko for ID3 with JPEG images in it */ @@ -220,12 +217,18 @@ unsigned char *iso2web[256] = { void usage() { fprintf(stderr, - "Usage >> fapg [-b|--backslash] [-d|--debug] [-f|--format=m3u|pls|html|rss] [-g|--genre=#:#:...] [-n|--nohardlink] [-o|--output=/path/to/file.m3u] [-p|--prefix=/the/prefix] [-r|--recursive] [-w|--windows] [-c|--command=] [-x|--exclude=#:#:...] /path/to/mp3/dir1 [/path/to/mp3/dir2 ...]\n"); + "Usage >> fapg [-b|--backslash] [-d|--debug] [-f|--format=m3u|pls|html|rss|pla] [-g|--genre=#:#:...] [-n|--nohardlink] [-o|--output=/path/to/file.m3u] [-p|--prefix=/the/prefix] [-r|--recursive] [-w|--windows] [-c|--command=] [-x|--exclude=#:#:...] /path/to/mp3/dir1 [/path/to/mp3/dir2 ...]\n"); exit(1); } #define mywebputchar(x) { fputs(iso2web[(unsigned char)winorunix[(unsigned char)x]], stdout); } #define myputchar(x) { putchar(basemap[(unsigned char)winorunix[(unsigned char)x]]); } +/* #define myplaputchar(x) { putchar(basemap[(unsigned char)winorunix[(unsigned char)x]]);putchar('\0');} */ +void myplaputchar(const char x) +{ + putchar(basemap[(unsigned char)winorunix[(unsigned char)x]]); + putchar('\0'); +} void mywebputstr(const char *c) { @@ -235,6 +238,20 @@ void mywebputstr(const char *c) } } +void myplaputstr(const char *c) +{ + while(*c != 0) { + if( *c == '/') + myplaputchar('\\'); /* translate slash to backslash */ + else + myplaputchar(*c); + c++; + /* remove multiple slashes "//" when parsing a directory ending with a "/" */ + while(*c == '/' && c[1] == '/') + c++; + } +} + void myputstr(const char *c) { while(*c != 0) { @@ -381,6 +398,8 @@ void parse_options(int argc, char **argv) format = 2; else if(strcmp(optarg, "rss") == 0) format = 3; + else if(strcmp(optarg, "pla") == 0) + format = 4; else usage(); break; @@ -920,6 +939,7 @@ void parse_file(unsigned char *newpath) // there are no tag infos read // use file name to state substitute it char *c = strrchr(newpath, separator); + if (c == NULL) c = newpath; strcpy(artist, ++c); // arbitrarily use the first '-' // to separate artist and title @@ -1017,6 +1037,11 @@ void parse_file(unsigned char *newpath) printf("\t%s", eol); } break; + case 4: // printing output for Sansa players + myplaputstr("HARP, "); + myplaputstr(newpath); + myplaputstr(eol); + break; } } } @@ -1113,6 +1138,11 @@ int main(int argc, char **argv) basemap = noand; } break; + case 4: + { + eol = "\r\n"; + myplaputstr( "PLP PLAYLIST\r\nVERSION 1.20\r\n\r\n" ); + } } for(; optind < argc; optind++) { parse_directory(argv[optind]); -- 2.20.1