# HG changeset patch # User William Pitcock # Date 1186746775 18000 # Node ID 230661b01dc77b177b6504205afc7e3938b4c4e2 # Parent c5bbf2c90ba38836e7f454a677c37e33df57043e vtx: new tuple API diff -r c5bbf2c90ba3 -r 230661b01dc7 src/vtx/about.c --- a/src/vtx/about.c Fri Aug 10 06:38:58 2007 -0500 +++ b/src/vtx/about.c Fri Aug 10 06:52:55 2007 -0500 @@ -4,7 +4,6 @@ #include #include -#include #include #include #include diff -r c5bbf2c90ba3 -r 230661b01dc7 src/vtx/info.c --- a/src/vtx/info.c Fri Aug 10 06:38:58 2007 -0500 +++ b/src/vtx/info.c Fri Aug 10 06:52:55 2007 -0500 @@ -1,7 +1,6 @@ #include #include #include -#include #include #include #include diff -r c5bbf2c90ba3 -r 230661b01dc7 src/vtx/vtx.c --- a/src/vtx/vtx.c Fri Aug 10 06:38:58 2007 -0500 +++ b/src/vtx/vtx.c Fri Aug 10 06:52:55 2007 -0500 @@ -21,9 +21,9 @@ #include #include -#include #include #include +#include #include #include @@ -92,36 +92,48 @@ return ret; } -TitleInput * +Tuple * vtx_get_song_tuple_from_vtx(const gchar *filename, ayemu_vtx_t *in) { - TitleInput *out = bmp_title_input_new(); + Tuple *out = tuple_new(); gchar *string; + gchar *scratch; - out->performer = g_strdup(in->hdr.author); - out->track_name = g_strdup(in->hdr.title); + tuple_associate_string(out, "artist", in->hdr.author); + tuple_associate_string(out, "title", in->hdr.title); - out->file_name = g_strdup(g_basename(filename)); - out->file_path = g_path_get_dirname(filename); - if ((string = strrchr(out->file_name, '.'))) - { - out->file_ext = string + 1; - *string = '\0'; - } + scratch = g_path_get_basename(filename); + tuple_associate_string(out, "file-name", scratch); + g_free(scratch); + + scratch = g_path_get_dirname(filename); + tuple_associate_string(out, "file-path", scratch); + g_free(scratch); - out->length = in->hdr.regdata_size / 14 * 1000 / 50; + tuple_associate_string(out, "file-ext", strrchr(filename, '.') + 1); + tuple_associate_int(out, "length", in->hdr.regdata_size / 14 * 1000 / 50); + + tuple_associate_string(out, "genre", (in->hdr.chiptype == AYEMU_AY)? "AY chiptunes" : "YM chiptunes"); + tuple_associate_string(out, "album", in->hdr.from); + tuple_associate_string(out, "game", in->hdr.from); + + tuple_associate_string(out, "quality", "sequenced"); + tuple_associate_string(out, "codec", in->hdr.tracker); + tuple_associate_string(out, "tracker", in->hdr.tracker); + + tuple_associate_int(out, "year", in->hdr.year); return out; } -TitleInput * +Tuple * vtx_get_song_tuple(gchar *filename) { ayemu_vtx_t tmp; if (ayemu_vtx_open (&tmp, filename)) { - TitleInput *ti = vtx_get_song_tuple_from_vtx(filename, &tmp); + Tuple *ti = vtx_get_song_tuple_from_vtx(filename, &tmp); ayemu_vtx_free(&tmp); return ti; } @@ -204,7 +216,7 @@ { gchar *filename = playback->filename; gchar *buf; - TitleInput *ti; + Tuple *ti; memset (&ay, 0, sizeof(ay)); @@ -232,8 +244,7 @@ seek_to = -1; ti = vtx_get_song_tuple_from_vtx(playback->filename, &vtx); - - buf = xmms_get_titlestring(xmms_get_gentitle_format(), ti); + buf = tuple_formatter_process_string(ti, cfg.gentitle_format); vtx_ip.set_info (buf, vtx.hdr.regdata_size / 14 * 1000 / 50, 14 * 50 * 8, freq, bits / 8); @@ -294,13 +305,13 @@ (*title) = NULL; if (ayemu_vtx_open (&tmp, filename)) { - TitleInput *ti = vtx_get_song_tuple_from_vtx(filename, &tmp); + Tuple *ti = vtx_get_song_tuple_from_vtx(filename, &tmp); - *title = xmms_get_titlestring(xmms_get_gentitle_format(), ti); - *length = ti->length; + *title = tuple_formatter_process_string(ti, cfg.gentitle_format); + *length = tuple_get_int(ti, "length"); ayemu_vtx_free (&tmp); - bmp_title_input_free(ti); + mowgli_object_unref(ti); } }