annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
217
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /*
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 XMMS-SID - SIDPlay input plugin for X MultiMedia System (XMMS)
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 Titlestring handling
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5
324
dd201740a720 Changed copyright text.
Matti Hamalainen <ccr@tnsp.org>
parents: 233
diff changeset
6 Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org>
422
d2e6682d3ef8 Copyright year update
Matti Hamalainen <ccr@tnsp.org>
parents: 412
diff changeset
7 (C) Copyright 1999-2007 Tecnic Software productions (TNSP)
217
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 This program is free software; you can redistribute it and/or modify
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 it under the terms of the GNU General Public License as published by
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 the Free Software Foundation; either version 2 of the License, or
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 (at your option) any later version.
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 This program is distributed in the hope that it will be useful,
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 GNU General Public License for more details.
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18
412
7f694e5a1493 Updated GNU GPL (new FSF address) and some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
19 You should have received a copy of the GNU General Public License along
7f694e5a1493 Updated GNU GPL (new FSF address) and some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
20 with this program; if not, write to the Free Software Foundation, Inc.,
7f694e5a1493 Updated GNU GPL (new FSF address) and some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
217
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 */
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 #include "xs_title.h"
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24 #include "xs_support.h"
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 #include "xs_config.h"
540
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
26
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
27 static void xs_path_split(gchar *path, gchar **tmpFilename, gchar **tmpFilePath, gchar **tmpFileExt)
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
28 {
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
29 gchar *tmpStr;
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
30
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
31 /* Split the filename into path */
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
32 *tmpFilePath = g_strdup(path);
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
33 tmpStr = xs_strrchr(*tmpFilePath, '/');
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
34 if (tmpStr) tmpStr[1] = 0;
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
35
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
36 /* Filename */
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
37 *tmpFilename = xs_strrchr(path, '/');
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
38 if (*tmpFilename)
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
39 *tmpFilename = g_strdup(*tmpFilename + 1);
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
40 else
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
41 *tmpFilename = g_strdup(path);
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
42
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
43 tmpStr = xs_strrchr(*tmpFilename, '.');
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
44 tmpStr[0] = 0;
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
45
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
46 /* Extension */
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
47 *tmpFileExt = xs_strrchr(path, '.');
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
48 }
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
49
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
50
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
51 #if defined(HAVE_XMMSEXTRA) || defined(AUDACIOUS_PLUGIN)
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
52 /* Tuple support
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
53 */
611
a751d2b85a7d Merge in Tuple changes from Audacious-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 541
diff changeset
54 static t_xs_tuple * xs_get_titletuple(gchar *tmpFilename, gchar *tmpFilePath,
540
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
55 gchar *tmpFileExt, t_xs_tuneinfo *p, gint subTune)
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
56 {
611
a751d2b85a7d Merge in Tuple changes from Audacious-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 541
diff changeset
57 t_xs_tuple *pResult;
a751d2b85a7d Merge in Tuple changes from Audacious-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 541
diff changeset
58
540
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
59 #ifdef AUDACIOUS_PLUGIN
611
a751d2b85a7d Merge in Tuple changes from Audacious-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 541
diff changeset
60 pResult = tuple_new();
a751d2b85a7d Merge in Tuple changes from Audacious-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 541
diff changeset
61 tuple_associate_string(pResult, "title", p->sidName);
a751d2b85a7d Merge in Tuple changes from Audacious-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 541
diff changeset
62 tuple_associate_string(pResult, "artist", p->sidComposer);
a751d2b85a7d Merge in Tuple changes from Audacious-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 541
diff changeset
63 tuple_associate_string(pResult, "file-name", tmpFilename);
a751d2b85a7d Merge in Tuple changes from Audacious-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 541
diff changeset
64 tuple_associate_string(pResult, "file-ext", tmpFileExt);
a751d2b85a7d Merge in Tuple changes from Audacious-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 541
diff changeset
65 tuple_associate_string(pResult, "file-path", tmpFilePath);
a751d2b85a7d Merge in Tuple changes from Audacious-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 541
diff changeset
66 tuple_associate_int(pResult, "track-number", subTune);
a751d2b85a7d Merge in Tuple changes from Audacious-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 541
diff changeset
67 tuple_associate_string(pResult, "genre", "SID-tune");
a751d2b85a7d Merge in Tuple changes from Audacious-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 541
diff changeset
68 tuple_associate_string(pResult, "comment", p->sidCopyright);
540
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
69 #else
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
70 pResult = (TitleInput *) g_malloc0(sizeof(TitleInput));
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
71 pResult->__size = XMMS_TITLEINPUT_SIZE;
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
72 pResult->__version = XMMS_TITLEINPUT_VERSION;
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
73
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
74 /* Create the input fields */
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
75 pResult->file_name = tmpFilename;
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
76 pResult->file_ext = tmpFileExt;
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
77 pResult->file_path = tmpFilePath;
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
78
541
e795d8e73ebc More Audacious compatibility glue.
Matti Hamalainen <ccr@tnsp.org>
parents: 540
diff changeset
79 pResult->track_name = g_strdup(p->sidName);
540
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
80 pResult->track_number = subTune;
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
81 pResult->album_name = NULL;
541
e795d8e73ebc More Audacious compatibility glue.
Matti Hamalainen <ccr@tnsp.org>
parents: 540
diff changeset
82 pResult->performer = g_strdup(p->sidComposer);
e795d8e73ebc More Audacious compatibility glue.
Matti Hamalainen <ccr@tnsp.org>
parents: 540
diff changeset
83 pResult->date = g_strdup((p->sidModel == XS_SIDMODEL_6581) ? "SID6581" : "SID8580");
540
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
84
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
85 pResult->year = 0;
541
e795d8e73ebc More Audacious compatibility glue.
Matti Hamalainen <ccr@tnsp.org>
parents: 540
diff changeset
86 pResult->genre = g_strdup("SID-tune");
e795d8e73ebc More Audacious compatibility glue.
Matti Hamalainen <ccr@tnsp.org>
parents: 540
diff changeset
87 pResult->comment = g_strdup(p->sidCopyright);
611
a751d2b85a7d Merge in Tuple changes from Audacious-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 541
diff changeset
88 #endif
540
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
89 return pResult;
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
90 }
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
91
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
92 #ifdef AUDACIOUS_PLUGIN
611
a751d2b85a7d Merge in Tuple changes from Audacious-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 541
diff changeset
93 t_xs_tuple * xs_make_titletuple(t_xs_tuneinfo *p, gint subTune)
540
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
94 {
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
95 gchar *tmpFilename, *tmpFilePath, *tmpFileExt;
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
96
541
e795d8e73ebc More Audacious compatibility glue.
Matti Hamalainen <ccr@tnsp.org>
parents: 540
diff changeset
97 xs_path_split(p->sidFilename, &tmpFilename, &tmpFilePath, &tmpFileExt);
540
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
98
541
e795d8e73ebc More Audacious compatibility glue.
Matti Hamalainen <ccr@tnsp.org>
parents: 540
diff changeset
99 return xs_get_titletuple(tmpFilename, tmpFilePath, tmpFileExt, p, subTune);
540
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
100 }
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
101 #endif
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
102 #endif
217
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
103
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
104
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
105 /*
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
106 * Create a title string based on given information and settings.
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
107 */
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
108 #define VPUTCH(MCH) \
392
b09d74eb71e6 Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents: 377
diff changeset
109 if (iIndex < XS_BUF_SIZE) tmpBuf[iIndex++] = MCH;
b09d74eb71e6 Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents: 377
diff changeset
110
217
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
111 #define VPUTSTR(MSTR) { \
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
112 if (MSTR) { \
372
1222cff759c6 Titlestring tag %N for number of subtunes; Removed "SID" from SID model
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
113 if ((iIndex + strlen(MSTR) + 1) < XS_BUF_SIZE) { \
217
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
114 strcpy(&tmpBuf[iIndex], MSTR); \
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
115 iIndex += strlen(MSTR); \
392
b09d74eb71e6 Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents: 377
diff changeset
116 } else \
372
1222cff759c6 Titlestring tag %N for number of subtunes; Removed "SID" from SID model
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
117 iIndex = XS_BUF_SIZE; \
392
b09d74eb71e6 Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents: 377
diff changeset
118 } \
b09d74eb71e6 Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents: 377
diff changeset
119 }
217
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
120
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
121
402
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
122 gchar *xs_make_titlestring(t_xs_tuneinfo *p, gint subTune)
217
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
123 {
540
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
124 gchar *tmpFilename, *tmpFilePath, *tmpFileExt,
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
125 *pcStr, *pcResult, tmpStr[XS_BUF_SIZE], tmpBuf[XS_BUF_SIZE];
402
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
126 t_xs_subtuneinfo *subInfo;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
127 gint iIndex;
217
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
128
540
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
129 /* Get filename parts */
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
130 xs_path_split(p->sidFilename, &tmpFilename,
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
131 &tmpFilePath, &tmpFileExt);
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
132
402
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
133 /* Get sub-tune information */
472
3f02945a0c48 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 422
diff changeset
134 if ((subTune > 0) && (subTune <= p->nsubTunes)) {
3f02945a0c48 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 422
diff changeset
135 subInfo = &(p->subTunes[subTune - 1]);
402
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
136 } else
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
137 subInfo = NULL;
217
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
138
540
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
139
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
140 /* Check if the titles are overridden or not */
611
a751d2b85a7d Merge in Tuple changes from Audacious-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 541
diff changeset
141 #if defined(AUDACIOUS_PLUGIN)
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
142 if (!xs_cfg.titleOverride) {
611
a751d2b85a7d Merge in Tuple changes from Audacious-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 541
diff changeset
143 t_xs_tuple *pTuple = xs_get_titletuple(
a751d2b85a7d Merge in Tuple changes from Audacious-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 541
diff changeset
144 tmpFilename, tmpFilePath, tmpFileExt, p, subTune);
a751d2b85a7d Merge in Tuple changes from Audacious-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 541
diff changeset
145 pcResult = tuple_formatter_make_title_string(pTuple, get_gentitle_format());
a751d2b85a7d Merge in Tuple changes from Audacious-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 541
diff changeset
146 tuple_free(pTuple);
a751d2b85a7d Merge in Tuple changes from Audacious-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 541
diff changeset
147 } else
a751d2b85a7d Merge in Tuple changes from Audacious-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 541
diff changeset
148 #elif defined(HAVE_XMMSEXTRA)
a751d2b85a7d Merge in Tuple changes from Audacious-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 541
diff changeset
149 if (!xs_cfg.titleOverride) {
a751d2b85a7d Merge in Tuple changes from Audacious-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 541
diff changeset
150 t_xs_tuple *pTuple = xs_get_titletuple(
540
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
151 tmpFilename, tmpFilePath, tmpFileExt, p, subTune);
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
152
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
153 pcResult = xmms_get_titlestring(xmms_get_gentitle_format(), pTuple);
541
e795d8e73ebc More Audacious compatibility glue.
Matti Hamalainen <ccr@tnsp.org>
parents: 540
diff changeset
154
e795d8e73ebc More Audacious compatibility glue.
Matti Hamalainen <ccr@tnsp.org>
parents: 540
diff changeset
155 g_free(pTuple->track_name);
e795d8e73ebc More Audacious compatibility glue.
Matti Hamalainen <ccr@tnsp.org>
parents: 540
diff changeset
156 g_free(pTuple->album_name);
e795d8e73ebc More Audacious compatibility glue.
Matti Hamalainen <ccr@tnsp.org>
parents: 540
diff changeset
157 g_free(pTuple->performer);
e795d8e73ebc More Audacious compatibility glue.
Matti Hamalainen <ccr@tnsp.org>
parents: 540
diff changeset
158 g_free(pTuple->date);
e795d8e73ebc More Audacious compatibility glue.
Matti Hamalainen <ccr@tnsp.org>
parents: 540
diff changeset
159 g_free(pTuple->genre);
e795d8e73ebc More Audacious compatibility glue.
Matti Hamalainen <ccr@tnsp.org>
parents: 540
diff changeset
160 g_free(pTuple->comment);
540
3e4901a89f3d Audacious kludging.
Matti Hamalainen <ccr@tnsp.org>
parents: 498
diff changeset
161 g_free(pTuple);
611
a751d2b85a7d Merge in Tuple changes from Audacious-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 541
diff changeset
162 } else
217
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
163 #endif
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
164 {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
165 /* Create the string */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
166 pcStr = xs_cfg.titleFormat;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
167 iIndex = 0;
372
1222cff759c6 Titlestring tag %N for number of subtunes; Removed "SID" from SID model
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
168 while (*pcStr && (iIndex < XS_BUF_SIZE)) {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
169 if (*pcStr == '%') {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
170 pcStr++;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
171 switch (*pcStr) {
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
172 case '%':
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
173 VPUTCH('%');
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
174 break;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
175 case 'f':
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
176 VPUTSTR(tmpFilename);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
177 break;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
178 case 'F':
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
179 VPUTSTR(tmpFilePath);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
180 break;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
181 case 'e':
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
182 VPUTSTR(tmpFileExt);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
183 break;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
184 case 'p':
402
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
185 VPUTSTR(p->sidComposer);
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
186 break;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
187 case 't':
402
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
188 VPUTSTR(p->sidName);
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
189 break;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
190 case 'c':
402
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
191 VPUTSTR(p->sidCopyright);
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
192 break;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
193 case 's':
402
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
194 VPUTSTR(p->sidFormat);
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
195 break;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
196 case 'm':
402
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
197 switch (p->sidModel) {
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
198 case XS_SIDMODEL_6581:
372
1222cff759c6 Titlestring tag %N for number of subtunes; Removed "SID" from SID model
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
199 VPUTSTR("6581");
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
200 break;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
201 case XS_SIDMODEL_8580:
372
1222cff759c6 Titlestring tag %N for number of subtunes; Removed "SID" from SID model
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
202 VPUTSTR("8580");
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
203 break;
479
99f05a74de5b Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
204 case XS_SIDMODEL_ANY:
99f05a74de5b Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
205 VPUTSTR("ANY");
99f05a74de5b Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
206 break;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
207 default:
402
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
208 VPUTSTR("?");
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
209 break;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
210 }
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
211 break;
479
99f05a74de5b Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
212 case 'C':
402
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
213 if (subInfo && (subInfo->tuneSpeed > 0)) {
479
99f05a74de5b Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
214 switch (subInfo->tuneSpeed) {
99f05a74de5b Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
215 case XS_CLOCK_PAL:
99f05a74de5b Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
216 VPUTSTR("PAL");
99f05a74de5b Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
217 break;
99f05a74de5b Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
218 case XS_CLOCK_NTSC:
99f05a74de5b Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
219 VPUTSTR("NTSC");
99f05a74de5b Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
220 break;
99f05a74de5b Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
221 case XS_CLOCK_ANY:
99f05a74de5b Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
222 VPUTSTR("ANY");
99f05a74de5b Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
223 break;
99f05a74de5b Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
224 case XS_CLOCK_VBI:
99f05a74de5b Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
225 VPUTSTR("VBI");
99f05a74de5b Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
226 break;
99f05a74de5b Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
227 case XS_CLOCK_CIA:
99f05a74de5b Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
228 VPUTSTR("CIA");
99f05a74de5b Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
229 break;
99f05a74de5b Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
230 default:
99f05a74de5b Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
231 g_snprintf(tmpStr, XS_BUF_SIZE,
99f05a74de5b Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
232 "%iHz", subInfo->tuneSpeed);
99f05a74de5b Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
233 VPUTSTR(tmpStr);
99f05a74de5b Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
234 }
402
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
235 } else
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
236 VPUTSTR("?");
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
237 break;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
238 case 'n':
472
3f02945a0c48 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 422
diff changeset
239 g_snprintf(tmpStr, XS_BUF_SIZE, "%i", subTune);
372
1222cff759c6 Titlestring tag %N for number of subtunes; Removed "SID" from SID model
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
240 VPUTSTR(tmpStr);
1222cff759c6 Titlestring tag %N for number of subtunes; Removed "SID" from SID model
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
241 break;
1222cff759c6 Titlestring tag %N for number of subtunes; Removed "SID" from SID model
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
242 case 'N':
402
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 392
diff changeset
243 g_snprintf(tmpStr, XS_BUF_SIZE, "%i", p->nsubTunes);
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
244 VPUTSTR(tmpStr);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
245 break;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
246 }
498
9d5e04cd0c97 Remove useless block.
Matti Hamalainen <ccr@tnsp.org>
parents: 482
diff changeset
247 } else
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
248 VPUTCH(*pcStr);
498
9d5e04cd0c97 Remove useless block.
Matti Hamalainen <ccr@tnsp.org>
parents: 482
diff changeset
249
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
250 pcStr++;
217
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
251 }
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
252
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
253 tmpBuf[iIndex] = 0;
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
254
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
255 /* Make resulting string */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
256 pcResult = g_strdup(tmpBuf);
217
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
257 }
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
258
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
259 /* Free temporary strings */
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
260 g_free(tmpFilename);
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
261 g_free(tmpFilePath);
217
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
262
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
263 return pcResult;
217
c1a5b5cf2f28 Titlestring handling
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
264 }