Mercurial > audlegacy-plugins
changeset 1432:e6eab0c725cd
Branch merge madness.
author | Tony Vroon <chainsaw@gentoo.org> |
---|---|
date | Fri, 10 Aug 2007 14:02:18 +0100 |
parents | 6b1f888a4c52 (diff) b274ac478607 (current diff) |
children | 60305596b899 |
files | |
diffstat | 8 files changed, 48 insertions(+), 108 deletions(-) [+] |
line wrap: on
line diff
--- a/src/aac/src/libmp4.c Fri Aug 10 07:45:36 2007 -0500 +++ b/src/aac/src/libmp4.c Fri Aug 10 14:02:18 2007 +0100 @@ -333,8 +333,7 @@ mp4ff_callback_t *mp4cb = g_malloc0(sizeof(mp4ff_callback_t)); VFSFile *mp4fh; mp4ff_t *mp4file; - Tuple *ti = tuple_new(); - gchar *scratch; + Tuple *ti = tuple_new_from_filename(fn); gboolean remote = str_has_prefix_nocase(filename, "http:") || str_has_prefix_nocase(filename, "https:"); @@ -348,15 +347,6 @@ tuple_associate_string(ti, "title", vfs_get_metadata(mp4fh, "track-name")); tuple_associate_string(ti, "album", vfs_get_metadata(mp4fh, "stream-name")); - scratch = g_path_get_basename(fn); - tuple_associate_string(ti, "file-name", scratch); - g_free(scratch); - - scratch = g_path_get_dirname(fn); - tuple_associate_string(ti, "file-path", scratch); - g_free(scratch); - - tuple_associate_string(ti, "file-ext", extname(fn)); tuple_associate_string(ti, "codec", "Advanced Audio Coding (AAC)"); tuple_associate_string(ti, "quality", "lossy"); @@ -414,39 +404,41 @@ msDuration = ((float)numSamples * (float)(framesize - 1.0)/(float)samplerate) * 1000; - mp4ff_meta_get_title(mp4file, scratch); - tuple_associate_string(ti, "title", scratch); - g_free(scratch); - - mp4ff_meta_get_album(mp4file, scratch); - tuple_associate_string(ti, "title", scratch); - g_free(scratch); - - mp4ff_meta_get_artist(mp4file, scratch); - tuple_associate_string(ti, "artist", scratch); - g_free(scratch); - - mp4ff_meta_get_genre(mp4file, scratch); - tuple_associate_string(ti, "genre", scratch); - g_free(scratch); - - mp4ff_meta_get_date(mp4file, &tmpval); - + mp4ff_meta_get_title(mp4file, &tmpval); if (tmpval) { - input->year = atoi(tmpval); + tuple_associate_string(ti, "title", tmpval); + free(tmpval); + } + + mp4ff_meta_get_album(mp4file, &tmpval); + if (tmpval) + { + tuple_associate_string(ti, "title", tmpval); free(tmpval); } - scratch = g_path_get_basename(fn); - tuple_associate_string(ti, "file-name", scratch); - g_free(scratch); + mp4ff_meta_get_artist(mp4file, &tmpval); + if (tmpval) + { + tuple_associate_string(ti, "artist", tmpval); + free(tmpval); + } - scratch = g_path_get_dirname(fn); - tuple_associate_string(ti, "file-path", scratch); - g_free(scratch); + mp4ff_meta_get_genre(mp4file, &tmpval); + if (tmpval) + { + tuple_associate_string(ti, "genre", tmpval); + free(tmpval); + } - tuple_associate_string(ti, "file-ext", extname(fn)); + mp4ff_meta_get_date(mp4file, &tmpval); + if (tmpval) + { + tuple_associate_int(ti, "year", atoi(tmpval)); + free(tmpval); + } + tuple_associate_string(ti, "codec", "Advanced Audio Coding (AAC)"); tuple_associate_string(ti, "quality", "lossy");
--- a/src/alac/plugin.c Fri Aug 10 07:45:36 2007 -0500 +++ b/src/alac/plugin.c Fri Aug 10 14:02:18 2007 +0100 @@ -119,8 +119,7 @@ Tuple *build_tuple_from_demux(demux_res_t *demux_res, char *path) { - Tuple *ti = tuple_new(); - gchar *scratch; + Tuple *ti = tuple_new_from_filename(path); if (demux_res->tuple.art != NULL) tuple_associate_string(ti, "artist", demux_res->tuple.art); @@ -135,15 +134,6 @@ if (demux_res->tuple.day != NULL) tuple_associate_int(ti, "year", atoi(demux_res->tuple.day)); - scratch = g_path_get_basename(path); - tuple_associate_string(ti, "file-name", scratch); - g_free(scratch); - - scratch = g_path_get_dirname(path); - tuple_associate_string(ti, "file-path", scratch); - g_free(scratch); - - tuple_associate_string(ti, "file-ext", extname(path)); tuple_associate_string(ti, "codec", "Apple Lossless (ALAC)"); tuple_associate_string(ti, "quality", "lossless");
--- a/src/sexypsf/plugin.c Fri Aug 10 07:45:36 2007 -0500 +++ b/src/sexypsf/plugin.c Fri Aug 10 14:02:18 2007 +0100 @@ -225,9 +225,7 @@ PSFINFO *tmp = sexypsf_getpsfinfo(fn); if (tmp->length) { - gchar *scratch; - - tuple = tuple_new(); + tuple = tuple_new_from_filename(fn); tuple_associate_int(tuple, "length", tmp->length); tuple_associate_string(tuple, "artist", tmp->artist); tuple_associate_string(tuple, "album", tmp->game); @@ -241,14 +239,6 @@ tuple_associate_string(tuple, "dumper", tmp->psfby); tuple_associate_string(tuple, "comment", tmp->comment); - scratch = g_path_get_basename(fn); - tuple_associate_string(tuple, "file-name", scratch); - g_free(scratch); - - scratch = g_path_get_dirname(fn); - tuple_associate_string(tuple, "file-path", scratch); - g_free(scratch); - sexypsf_freepsfinfo(tmp); }
--- a/src/vtx/vtx.c Fri Aug 10 07:45:36 2007 -0500 +++ b/src/vtx/vtx.c Fri Aug 10 14:02:18 2007 +0100 @@ -95,22 +95,12 @@ Tuple * vtx_get_song_tuple_from_vtx(const gchar *filename, ayemu_vtx_t *in) { - Tuple *out = tuple_new(); + Tuple *out = tuple_new_from_filename(filename); gchar *string; - gchar *scratch; tuple_associate_string(out, "artist", in->hdr.author); tuple_associate_string(out, "title", in->hdr.title); - 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); - - 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");
--- a/src/wav/wav-sndfile.c Fri Aug 10 07:45:36 2007 -0500 +++ b/src/wav/wav-sndfile.c Fri Aug 10 14:02:18 2007 +0100 @@ -37,10 +37,12 @@ #include <math.h> #include <stdio.h> -#include <audacious/plugin.h> -#include <audacious/util.h> -#include <audacious/titlestring.h> -#include <audacious/i18n.h> +#include "audacious/plugin.h" +#include "audacious/util.h" +#include "audacious/i18n.h" +#include "audacious/main.h" +#include "audacious/tuple.h" +#include "audacious/tuple_formatter.h" #include "audacious/output.h" #include "wav-sndfile.h" @@ -328,19 +330,15 @@ (*title) = get_title(filename); } -static TitleInput* +static Tuple* get_song_tuple (gchar *filename) { - gchar *realfn = NULL; - TitleInput *tuple = bmp_title_input_new(); + Tuple *ti = tuple_new_from_filename(filename); + tuple_associate_string(ti, "codec", "libsndfile"); + tuple_associate_string(ti, "quality", "lossless"); + tuple_associate_int(ti, "length", get_song_length(filename)); - realfn = g_filename_from_uri(filename, NULL, NULL); - tuple->file_name = g_path_get_basename(realfn ? realfn : filename); - tuple->file_path = g_path_get_dirname(realfn ? realfn : filename); - tuple->length = get_song_length(filename); - g_free(realfn); realfn = NULL; - - return tuple; + return ti; } static void wav_about(void)
--- a/src/wav/wav-sndfile.h Fri Aug 10 07:45:36 2007 -0500 +++ b/src/wav/wav-sndfile.h Fri Aug 10 14:02:18 2007 +0100 @@ -31,7 +31,7 @@ static void play_stop (InputPlayback *playback); static void file_seek (InputPlayback *playback, int time); static void get_song_info (char *filename, char **title, int *length); -static TitleInput* get_song_tuple (gchar *filename); +static Tuple* get_song_tuple (gchar *filename); static void wav_about (void); static void play_pause (InputPlayback *playback, gshort p); static void file_mseek (InputPlayback *playback, gulong millisecond);
--- a/src/wav/wav.c Fri Aug 10 07:45:36 2007 -0500 +++ b/src/wav/wav.c Fri Aug 10 14:02:18 2007 +0100 @@ -210,17 +210,7 @@ gchar *title; gchar *scratch; - tuple = tuple_new(); - - scratch = g_path_get_basename(filename); - tuple_associate_string(tuple, "file-name", scratch); - g_free(scratch); - - tuple_associate_string(tuple, "file-ext", get_extension(filename)); - - scratch = g_path_get_dirname(filename); - tuple_associate_string(tuple, "file-path", scratch); - g_free(scratch); + tuple = tuple_new_from_filename(filename); tuple_associate_string(tuple, "codec", "RIFF/WAV Audio (ADPCM)"); tuple_associate_string(tuple, "quality", "lossless");
--- a/src/wma/wma.c Fri Aug 10 07:45:36 2007 -0500 +++ b/src/wma/wma.c Fri Aug 10 14:02:18 2007 +0100 @@ -245,22 +245,12 @@ static Tuple *wma_get_song_tuple(gchar * filename) { - Tuple *ti = tuple_new(); + Tuple *ti = tuple_new_from_filename(filename); AVFormatContext *in = NULL; - gchar *scratch; if (av_open_input_file(&in, str_twenty_to_space(filename), NULL, 0, NULL) < 0) return NULL; - scratch = g_path_get_basename(filename); - tuple_associate_string(ti, "file-name", scratch); - g_free(scratch); - - scratch = g_path_get_dirname(filename); - tuple_associate_string(ti, "file-path", scratch); - g_free(scratch); - - tuple_associate_string(ti, "file-ext", extname(filename)); tuple_associate_string(ti, "codec", "Windows Media Audio (WMA)"); tuple_associate_string(ti, "quality", "lossy"); @@ -285,7 +275,7 @@ av_close_input_file(in); - return tuple; + return ti; } static gchar *get_song_title(AVFormatContext *in, gchar * filename)