summaryrefslogtreecommitdiffstats
path: root/testing/mp3info
diff options
context:
space:
mode:
authorCarlo Landmeter <clandmeter@gmail.com>2009-03-27 11:26:32 +0000
committerCarlo Landmeter <clandmeter@gmail.com>2009-03-27 11:26:32 +0000
commit5a9af1f3e07c6549b2ad3e757c7214389297e09f (patch)
tree898551b41e2604b86b78ba1904df708c587ce3ab /testing/mp3info
parent10fd03a31f63f1045ed6ab24f377d32dc5f50cce (diff)
downloadaports-5a9af1f3e07c6549b2ad3e757c7214389297e09f.tar.bz2
aports-5a9af1f3e07c6549b2ad3e757c7214389297e09f.tar.xz
testing/mp3info: new aport
Diffstat (limited to 'testing/mp3info')
-rw-r--r--testing/mp3info/APKBUILD27
-rw-r--r--testing/mp3info/escape_chars.patch138
2 files changed, 165 insertions, 0 deletions
diff --git a/testing/mp3info/APKBUILD b/testing/mp3info/APKBUILD
new file mode 100644
index 00000000..6a52c3b6
--- /dev/null
+++ b/testing/mp3info/APKBUILD
@@ -0,0 +1,27 @@
+# Contributor: Carlo Landmeter <clandmeter@gmail.com>
+# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
+pkgname=mp3info
+pkgver=0.8.5a
+pkgrel=0
+pkgdesc="An MP3 technical info viewer and ID3 1.x tag editor"
+url="http://www.ibiblio.org/mp3info/"
+license="GPL"
+depends="uclibc ncurses"
+makedepends="ncurses-dev"
+subpackages=""
+source="ftp://ftp.ibiblio.org/pub/linux/apps/sound/mp3-utils/mp3info/mp3info-0.8.5a.tgz
+escape_chars.patch"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ patch -p1 -i "$srcdir"/escape_chars.patch || return 1
+
+ make mp3info || return 1
+ install -Dm755 mp3info "$pkgdir"/usr/bin/mp3info
+ install -Dm644 mp3info.1 "$pkgdir"/usr/share/man/man1/mp3info.1
+
+}
+
+md5sums="cb7b619a10a40aaac2113b87bb2b2ea2 mp3info-0.8.5a.tgz
+d0be1068503056b775bf10f05a8497b8 escape_chars.patch"
diff --git a/testing/mp3info/escape_chars.patch b/testing/mp3info/escape_chars.patch
new file mode 100644
index 00000000..ec697a28
--- /dev/null
+++ b/testing/mp3info/escape_chars.patch
@@ -0,0 +1,138 @@
+--- orig/mp3info-0.8.5a/mp3info.c Mon Nov 6 04:03:17 2006
++++ mp3info-0.8.5a/mp3info.c Thu Mar 19 12:33:27 2009
+@@ -32,6 +32,7 @@
+ #undef __MAIN
+ #include <sys/stat.h>
+
++char *escape_chars=NULL;
+ char FILENAME_FORMAT_STRING[]="File: %F\n";
+ char ID3_FORMAT_STRING[]="Title: %-30t Track: %n\nArtist: %a\nAlbum: %-30l Year: %y\nComment: %-30c Genre: %g [%G]\n";
+ char TECH_FORMAT_STRING[]="Media Type: MPEG %2.1v Layer %L\nAudio: %r KB/s, %qKHz (%o)\nEmphasis: %e\nCRC: %E\nCopyright: %C\nOriginal: %O\nPadding: %p\nLength: %m:%02s\n";
+@@ -66,7 +67,7 @@
+
+
+
+- while ((c=getopt(argc,argv,"vhGidfxFt:a:l:y:c:n:g:p:r:"))!=-1) {
++ while ((c=getopt(argc,argv,"vhGidfxFmt:a:l:y:c:n:g:p:r:e:"))!=-1) {
+
+ switch(c) {
+ case 'v': /* View mode is now automatic when no changes are
+@@ -159,6 +160,12 @@
+ }
+ break;
+ case 'F': quickscan=0; break;
++ case 'e':
++ escape_chars = optarg;
++ break;
++ case 'm':
++ escape_chars = "'\"\b\n\r\t\\";
++ break;
+ }
+ }
+
+--- orig/mp3info-0.8.5a/mp3info.h Fri Nov 10 00:14:52 2006
++++ mp3info-0.8.5a/mp3info.h Thu Mar 19 10:42:07 2009
+@@ -111,6 +111,7 @@
+ extern int galphagenreindex [MAXGENRE+2];
+ #endif
+
++extern char *escape_chars;
+ void tagedit_curs(char *filename, int filenum, int fileoutof, id3tag *tag);
+
+
+--- orig/mp3info-0.8.5a/textfunc.c Mon Nov 6 08:59:12 2006
++++ mp3info-0.8.5a/textfunc.c Thu Mar 19 12:24:52 2009
+@@ -24,6 +24,7 @@
+ */
+
+ #include "mp3info.h"
++#include "libgen.h"
+
+ char *layer_text[] = {
+ "I", "II", "III"
+@@ -70,6 +71,8 @@
+ "\t-n track\tSpecify ID3 v1.1 track number\n"\
+ "\t-t title\tSpecify ID3 track title\n"\
+ "\t-y year\t\tSpecify ID3 copyright year\n\n"\
++ "\t-m\t\tMySQL safe output\n"\
++ "\t-e\t\tCharacters to escape\n"\
+ "\t-G\t\tDisplay valid genres\n"\
+ "\t-h\t\tDisplay this help page\n"\
+ "\t-x\t\tDisplay technical attributes of the MP3 file\n"\
+@@ -85,6 +88,7 @@
+ "\n\t\tConversion Specifiers\n\n"\
+ "\t\t%%f\tFilename without the path (string)\n"\
+ "\t\t%%F\tFilename with the path (string)\n"\
++ "\t\t%%d\tPath without filename (string)\n"\
+ "\t\t%%k\tFile size in KB (integer)\n"\
+ "\n\t\t%%a\tArtist (string)\n"\
+ "\t\t%%c\tComment (string)\n"\
+@@ -217,7 +221,27 @@
+ }
+ }
+
++/* const char *escape_chars = "'\"\b\n\r\t\\%_"; */
++/* escape the chars so its sql safe */
++char *escape_string(char *str)
++{
++ static char buf[8192];
++ char *src = str;
++ char *dest = buf;
+
++ /* we might want a cmdline flag to enable escaping */
++ if (escape_chars == NULL || str == NULL)
++ return str;
++
++ while (*src && dest < (buf + sizeof(buf) - 1)) {
++ if (strchr(escape_chars, *src))
++ *dest++ = '\\';
++ *dest++ = *src++;
++ }
++ *dest = '\0';
++ return buf;
++}
++
+ void format_output (char *format_string,mp3info *mp3, int vbr_report) {
+
+ char genre[40]="";
+@@ -242,16 +266,16 @@
+ mod[modlen]=0;
+ mod[modlen-1]='s';
+ switch (*code) {
+- case 't': printf(mod,mp3->id3.title); break;
++ case 't': printf(mod,escape_string(mp3->id3.title)); break;
+ case 'f': pos = (pos=strrchr(mp3->filename,'/')) ?
+ pos+1 : mp3->filename;
+- printf(mod,pos); break;
+- case 'F': printf(mod,mp3->filename); break;
+- case 'a': printf(mod,mp3->id3.artist); break;
+- case 'l': printf(mod,mp3->id3.album); break;
++ printf(mod,escape_string(pos)); break;
++ case 'F': printf(mod,escape_string(mp3->filename)); break;
++ case 'a': printf(mod,escape_string(mp3->id3.artist)); break;
++ case 'l': printf(mod,escape_string(mp3->id3.album)); break;
+ case 'k': mod[modlen-1] = 'd'; printf(mod,mp3->datasize / 1024); break;
+- case 'y': printf(mod,mp3->id3.year); break;
+- case 'c': printf(mod,mp3->id3.comment); break;
++ case 'y': printf(mod,escape_string(mp3->id3.year)); break;
++ case 'c': printf(mod,escape_string(mp3->id3.comment)); break;
+ case 'n': if(mp3->id3_isvalid && mp3->id3.track[0]) {
+ mod[modlen-1]='d';
+ printf(mod, (int) mp3->id3.track[0]);
+@@ -259,7 +283,7 @@
+ break;
+ case 'g': if(mp3->id3_isvalid) {
+ text_genre(mp3->id3.genre,genre);
+- printf(mod,genre);
++ printf(mod,escape_string(genre));
+ }
+ break;
+ case 'G': if(mp3->id3_isvalid) {
+@@ -348,6 +372,7 @@
+ }
+ break;
+ case '%': printf("%%"); break;
++ case 'd': printf(mod,escape_string(dirname(mp3->filename))); break;
+ default: printf("%%%c",*(code=percent+1)); break;
+ }
+ format=code+1;