diff -ruN xmms-scrobbler-0.3.8.1.org/Makefile.in xmms-scrobbler-0.3.8.1/Makefile.in --- xmms-scrobbler-0.3.8.1.org/Makefile.in 2005-02-27 11:37:07.000000000 +0900 +++ xmms-scrobbler-0.3.8.1/Makefile.in 2005-03-15 21:46:50.000000000 +0900 @@ -78,7 +78,7 @@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ -LIBS = `curl-config --libs` -lmusicbrainz -lm -lstdc++ +LIBS = `curl-config --libs` -lmusicbrainz -lm -lstdc++ -ljconv -lguess LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ diff -ruN xmms-scrobbler-0.3.8.1.org/queue.c xmms-scrobbler-0.3.8.1/queue.c --- xmms-scrobbler-0.3.8.1.org/queue.c 2005-02-21 04:10:28.000000000 +0900 +++ xmms-scrobbler-0.3.8.1/queue.c 2005-03-15 21:48:28.000000000 +0900 @@ -6,6 +6,12 @@ #include "queue.h" #include "fmt.h" +/* yaz */ +#include "config.h" +#include +#include +#include + static item_t *q_queue = NULL; static item_t *q_queue_last = NULL; static int q_nitems; @@ -22,13 +28,29 @@ free(item); } +#define yazdebug 0 void q_put(metatag_t *meta, int len) { item_t *item; - +#if yazdebug + char *euc=NULL, *codeset=NULL; /* yaz */ + + setlocale(LC_ALL, ""); + codeset = nl_langinfo(CODESET); + printf("yaz codeset=%s\n", codeset); + /* yaz */ + euc = jconv_strdup_conv_autodetect(meta->artist, codeset, "UTF-8"); + pdebug(fmt_vastr("yaz artist=%s\n", euc), DEBUG); + free(euc); + euc = jconv_strdup_conv_autodetect(meta->title, codeset, "UTF-8"); + pdebug(fmt_vastr("yaz title=%s\n", euc), DEBUG); + free(euc); + free(codeset); +#endif item = malloc(sizeof(item_t)); item->artist = fmt_escape(meta->artist); - item->title = fmt_escape(meta->title); + item->title = fmt_escape(meta->title); + item->utctime = fmt_escape(fmt_timestr(time(NULL), 1)); snprintf(item->len, sizeof(item->len), "%d", len); if(meta->mb == NULL) diff -ruN xmms-scrobbler-0.3.8.1.org/tags/id3v1.c xmms-scrobbler-0.3.8.1/tags/id3v1.c --- xmms-scrobbler-0.3.8.1.org/tags/id3v1.c 2005-02-21 04:11:01.000000000 +0900 +++ xmms-scrobbler-0.3.8.1/tags/id3v1.c 2005-03-15 18:54:21.000000000 +0900 @@ -31,6 +31,9 @@ #include "include/unicode.h" #define BUFFER_SIZE 4096 +#include +#include + static void cleanID3v1(unsigned char *data, size_t size) { int i; @@ -92,28 +95,36 @@ fread(data, 1, 30, fp); cleanID3v1(data, 30); // id3v1->title = realloc(id3v1->title, 31); - if(strcmp(data, "")) - iso88591_to_utf8(data, strlen(data), &id3v1->title); + if(strcmp(data, "")){ + id3v1->title = jconv_strdup_conv_autodetect(data, "UTF-8", + guess_jp(data, strlen(data))); + } else id3v1->title = NULL; fread(data, 1, 30, fp); cleanID3v1(data, 30); - if(strcmp(data, "")) - iso88591_to_utf8(data, strlen(data), &id3v1->artist); + if(strcmp(data, "")){ + id3v1->artist = jconv_strdup_conv_autodetect(data, "UTF-8", + guess_jp(data, strlen(data))); + } else id3v1->artist = NULL; fread(data, 1, 30, fp); cleanID3v1(data, 30); - if(strcmp(data, "")) - iso88591_to_utf8(data, strlen(data), &id3v1->album); + if(strcmp(data, "")){ + id3v1->album = jconv_strdup_conv_autodetect(data, "UTF-8", + guess_jp(data, strlen(data))); + } else id3v1->album = NULL; data = realloc(data, 5); *(data + 4) = '\0'; fread(data, 1, 4, fp); cleanID3v1(data, 4); - if(strcmp(data, "")) - iso88591_to_utf8(data, strlen(data), &id3v1->year); + if(strcmp(data, "")){ +// iso88591_to_utf8(data, strlen(data), &id3v1->year); + id3v1->year = strndup(data, 4); + } else id3v1->year = NULL; data = realloc(data, 31); diff -ruN xmms-scrobbler-0.3.8.1.org/tags/id3v2.c xmms-scrobbler-0.3.8.1/tags/id3v2.c --- xmms-scrobbler-0.3.8.1.org/tags/id3v2.c 2005-02-21 04:11:22.000000000 +0900 +++ xmms-scrobbler-0.3.8.1/tags/id3v2.c 2005-03-15 21:59:46.000000000 +0900 @@ -31,6 +31,9 @@ #include "include/unicode.h" #define BUFFER_SIZE 4096 +#include +#include + id3_lookup_t id3v22_lookup[] = { {"BUF", ID3V22_BUF}, {"CNT", ID3V22_CNT}, {"COM", ID3V22_COM}, @@ -410,26 +413,37 @@ framedata->len -= unsync->count; free(unsync); } - if(encoding == 0x00) + if(encoding == 0x00) //iso8859-1 { + pdebug("yaz encoding=00\n", DEBUG); if(utf != NULL) free(utf); - iso88591_to_utf8(data, framedata->len - 1, &utf); +#if 0 + utf = jconv_strdup_conv_autodetect(data, "EUC-JP", + guess_jp(data, strlen(data))); + pdebug(fmt_vastr("yaz debug case 00: %s\n", utf), DEBUG); + free(utf); +#endif + utf = jconv_strdup_conv_autodetect(data, "UTF-8", + guess_jp(data, strlen(data))); } - else if(encoding == 0x01) + else if(encoding == 0x01) //UTF-16 with BOM { + pdebug("yaz encoding=01\n", DEBUG); if(utf != NULL) free(utf); - utf16bom_to_utf8(data, framedata->len - 1, &utf); + utf = jconv_strdup_conv_autodetect(data, "UTF-8", "UTF-16"); } - else if(encoding == 0x02) + else if(encoding == 0x02) //UTF-16BE { + pdebug("yaz encoding=02\n", DEBUG); if(utf != NULL) free(utf); - utf16be_to_utf8(data, framedata->len - 1, &utf); + utf = jconv_strdup_conv_autodetect(data, "UTF-8", "UTF-16BE"); } - else if(encoding == 0x03) + else if(encoding == 0x03) //UTF-8 { + pdebug("yaz encoding=03\n", DEBUG); utf = realloc(utf, framedata->len); strcpy(utf, data); } diff -ruN xmms-scrobbler-0.3.8.1.org/xmms_scrobbler.c xmms-scrobbler-0.3.8.1/xmms_scrobbler.c --- xmms-scrobbler-0.3.8.1.org/xmms_scrobbler.c 2005-02-21 10:25:47.000000000 +0900 +++ xmms-scrobbler-0.3.8.1/xmms_scrobbler.c 2005-03-15 19:18:02.000000000 +0900 @@ -28,6 +28,10 @@ #include "fmt.h" #include "tags/include/unicode.h" +/* yaz */ +#include +#include + #define XS_CS xmms_scrobbler.xmms_session typedef struct submit_t @@ -446,9 +450,19 @@ if(meta->artist != NULL && meta->title != NULL) { + char *codeset, *artist, *title; + + setlocale(LC_ALL, ""); + codeset = nl_langinfo(CODESET); + artist = jconv_strdup_conv_autodetect(meta->artist, codeset, "UTF-8"); + title = jconv_strdup_conv_autodetect(meta->title, codeset, "UTF-8"); + pdebug(fmt_vastr( "submitting artist: %s, title: %s", - meta->artist, meta->title), DEBUG); + artist, title), DEBUG); +// meta->artist, meta->title), DEBUG); + free(codeset); free(artist); free(title); + sc_addentry(m_scrobbler, meta, dosubmit.len/1000); }