comparison src/xs_title.c @ 611:a751d2b85a7d

Merge in Tuple changes from Audacious-SID.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 01 Sep 2007 14:43:05 +0000
parents e795d8e73ebc
children ddae043e8e47
comparison
equal deleted inserted replaced
610:88bc61a2914f 611:a751d2b85a7d
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 */ 22 */
23 #include "xs_title.h" 23 #include "xs_title.h"
24 #include "xs_support.h" 24 #include "xs_support.h"
25 #include "xs_config.h" 25 #include "xs_config.h"
26 #ifdef AUDACIOUS_PLUGIN
27 #include <audacious/titlestring.h>
28 #else
29 #include <xmms/titlestring.h>
30 #endif
31
32 26
33 static void xs_path_split(gchar *path, gchar **tmpFilename, gchar **tmpFilePath, gchar **tmpFileExt) 27 static void xs_path_split(gchar *path, gchar **tmpFilename, gchar **tmpFilePath, gchar **tmpFileExt)
34 { 28 {
35 gchar *tmpStr; 29 gchar *tmpStr;
36 30
55 49
56 50
57 #if defined(HAVE_XMMSEXTRA) || defined(AUDACIOUS_PLUGIN) 51 #if defined(HAVE_XMMSEXTRA) || defined(AUDACIOUS_PLUGIN)
58 /* Tuple support 52 /* Tuple support
59 */ 53 */
60 static TitleInput * xs_get_titletuple(gchar *tmpFilename, gchar *tmpFilePath, 54 static t_xs_tuple * xs_get_titletuple(gchar *tmpFilename, gchar *tmpFilePath,
61 gchar *tmpFileExt, t_xs_tuneinfo *p, gint subTune) 55 gchar *tmpFileExt, t_xs_tuneinfo *p, gint subTune)
62 { 56 {
63 TitleInput *pResult; 57 t_xs_tuple *pResult;
64 58
65 #ifdef AUDACIOUS_PLUGIN 59 #ifdef AUDACIOUS_PLUGIN
66 pResult = bmp_title_input_new(); 60 pResult = tuple_new();
61 tuple_associate_string(pResult, "title", p->sidName);
62 tuple_associate_string(pResult, "artist", p->sidComposer);
63 tuple_associate_string(pResult, "file-name", tmpFilename);
64 tuple_associate_string(pResult, "file-ext", tmpFileExt);
65 tuple_associate_string(pResult, "file-path", tmpFilePath);
66 tuple_associate_int(pResult, "track-number", subTune);
67 tuple_associate_string(pResult, "genre", "SID-tune");
68 tuple_associate_string(pResult, "comment", p->sidCopyright);
67 #else 69 #else
68 pResult = (TitleInput *) g_malloc0(sizeof(TitleInput)); 70 pResult = (TitleInput *) g_malloc0(sizeof(TitleInput));
69 pResult->__size = XMMS_TITLEINPUT_SIZE; 71 pResult->__size = XMMS_TITLEINPUT_SIZE;
70 pResult->__version = XMMS_TITLEINPUT_VERSION; 72 pResult->__version = XMMS_TITLEINPUT_VERSION;
71 #endif
72 73
73 /* Create the input fields */ 74 /* Create the input fields */
74 pResult->file_name = tmpFilename; 75 pResult->file_name = tmpFilename;
75 pResult->file_ext = tmpFileExt; 76 pResult->file_ext = tmpFileExt;
76 pResult->file_path = tmpFilePath; 77 pResult->file_path = tmpFilePath;
82 pResult->date = g_strdup((p->sidModel == XS_SIDMODEL_6581) ? "SID6581" : "SID8580"); 83 pResult->date = g_strdup((p->sidModel == XS_SIDMODEL_6581) ? "SID6581" : "SID8580");
83 84
84 pResult->year = 0; 85 pResult->year = 0;
85 pResult->genre = g_strdup("SID-tune"); 86 pResult->genre = g_strdup("SID-tune");
86 pResult->comment = g_strdup(p->sidCopyright); 87 pResult->comment = g_strdup(p->sidCopyright);
87 88 #endif
88 return pResult; 89 return pResult;
89 } 90 }
90 91
91 #ifdef AUDACIOUS_PLUGIN 92 #ifdef AUDACIOUS_PLUGIN
92 TitleInput * xs_make_titletuple(t_xs_tuneinfo *p, gint subTune) 93 t_xs_tuple * xs_make_titletuple(t_xs_tuneinfo *p, gint subTune)
93 { 94 {
94 gchar *tmpFilename, *tmpFilePath, *tmpFileExt; 95 gchar *tmpFilename, *tmpFilePath, *tmpFileExt;
95 96
96 xs_path_split(p->sidFilename, &tmpFilename, &tmpFilePath, &tmpFileExt); 97 xs_path_split(p->sidFilename, &tmpFilename, &tmpFilePath, &tmpFileExt);
97 98
135 } else 136 } else
136 subInfo = NULL; 137 subInfo = NULL;
137 138
138 139
139 /* Check if the titles are overridden or not */ 140 /* Check if the titles are overridden or not */
140 #if defined(HAVE_XMMSEXTRA) || defined(AUDACIOUS_PLUGIN) 141 #if defined(AUDACIOUS_PLUGIN)
141 if (!xs_cfg.titleOverride) { 142 if (!xs_cfg.titleOverride) {
142 TitleInput *pTuple = xs_get_titletuple( 143 t_xs_tuple *pTuple = xs_get_titletuple(
144 tmpFilename, tmpFilePath, tmpFileExt, p, subTune);
145 pcResult = tuple_formatter_make_title_string(pTuple, get_gentitle_format());
146 tuple_free(pTuple);
147 } else
148 #elif defined(HAVE_XMMSEXTRA)
149 if (!xs_cfg.titleOverride) {
150 t_xs_tuple *pTuple = xs_get_titletuple(
143 tmpFilename, tmpFilePath, tmpFileExt, p, subTune); 151 tmpFilename, tmpFilePath, tmpFileExt, p, subTune);
144 152
145 pcResult = xmms_get_titlestring(xmms_get_gentitle_format(), pTuple); 153 pcResult = xmms_get_titlestring(xmms_get_gentitle_format(), pTuple);
146 154
147 g_free(pTuple->track_name); 155 g_free(pTuple->track_name);
149 g_free(pTuple->performer); 157 g_free(pTuple->performer);
150 g_free(pTuple->date); 158 g_free(pTuple->date);
151 g_free(pTuple->genre); 159 g_free(pTuple->genre);
152 g_free(pTuple->comment); 160 g_free(pTuple->comment);
153 g_free(pTuple); 161 g_free(pTuple);
154 } else 162 } else
155 #endif 163 #endif
156 { 164 {
157 /* Create the string */ 165 /* Create the string */
158 pcStr = xs_cfg.titleFormat; 166 pcStr = xs_cfg.titleFormat;
159 iIndex = 0; 167 iIndex = 0;