Mercurial > audlegacy-plugins
annotate src/sid/xs_title.c @ 1212:36cc5e56246e trunk
Added title changes event for songchange plugin
author | Giacomo Lozito <james@develia.org> |
---|---|
date | Fri, 06 Jul 2007 17:37:21 +0200 |
parents | 6c3c7b841382 |
children | c6947f95fd2a |
rev | line source |
---|---|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
2 XMMS-SID - SIDPlay input plugin for X MultiMedia System (XMMS) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
3 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
4 Titlestring handling |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
5 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
6 Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org> |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
7 (C) Copyright 1999-2007 Tecnic Software productions (TNSP) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
8 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
9 This program is free software; you can redistribute it and/or modify |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
10 it under the terms of the GNU General Public License as published by |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
11 the Free Software Foundation; either version 2 of the License, or |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
12 (at your option) any later version. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
13 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
14 This program is distributed in the hope that it will be useful, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
15 but WITHOUT ANY WARRANTY; without even the implied warranty of |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
17 GNU General Public License for more details. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
18 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
19 You should have received a copy of the GNU General Public License along |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
20 with this program; if not, write to the Free Software Foundation, Inc., |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
22 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
23 #include "xs_title.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
24 #include "xs_support.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
25 #include "xs_config.h" |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
26 #ifdef AUDACIOUS_PLUGIN |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
27 #include <audacious/titlestring.h> |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
28 #else |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
29 #include <xmms/titlestring.h> |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
30 #endif |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
31 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
32 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
33 static void xs_path_split(gchar *path, gchar **tmpFilename, gchar **tmpFilePath, gchar **tmpFileExt) |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
34 { |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
35 gchar *tmpStr; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
36 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
37 /* Split the filename into path */ |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
38 *tmpFilePath = g_strdup(path); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
39 tmpStr = xs_strrchr(*tmpFilePath, '/'); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
40 if (tmpStr) tmpStr[1] = 0; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
41 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
42 /* Filename */ |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
43 *tmpFilename = xs_strrchr(path, '/'); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
44 if (*tmpFilename) |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
45 *tmpFilename = g_strdup(*tmpFilename + 1); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
46 else |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
47 *tmpFilename = g_strdup(path); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
48 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
49 tmpStr = xs_strrchr(*tmpFilename, '.'); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
50 tmpStr[0] = 0; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
51 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
52 /* Extension */ |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
53 *tmpFileExt = xs_strrchr(path, '.'); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
54 } |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
55 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
56 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
57 #if defined(HAVE_XMMSEXTRA) || defined(AUDACIOUS_PLUGIN) |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
58 /* Tuple support |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
59 */ |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
60 static TitleInput * xs_get_titletuple(gchar *tmpFilename, gchar *tmpFilePath, |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
61 gchar *tmpFileExt, t_xs_tuneinfo *p, gint subTune) |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
62 { |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
63 TitleInput *pResult; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
64 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
65 #ifdef AUDACIOUS_PLUGIN |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
66 pResult = bmp_title_input_new(); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
67 #else |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
68 pResult = (TitleInput *) g_malloc0(sizeof(TitleInput)); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
69 pResult->__size = XMMS_TITLEINPUT_SIZE; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
70 pResult->__version = XMMS_TITLEINPUT_VERSION; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
71 #endif |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
72 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
73 /* Create the input fields */ |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
74 pResult->file_name = tmpFilename; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
75 pResult->file_ext = tmpFileExt; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
76 pResult->file_path = tmpFilePath; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
77 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
78 pResult->track_name = g_strdup(p->sidName); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
79 pResult->track_number = subTune; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
80 pResult->album_name = NULL; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
81 pResult->performer = g_strdup(p->sidComposer); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
82 pResult->date = g_strdup((p->sidModel == XS_SIDMODEL_6581) ? "SID6581" : "SID8580"); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
83 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
84 pResult->year = 0; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
85 pResult->genre = g_strdup("SID-tune"); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
86 pResult->comment = g_strdup(p->sidCopyright); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
87 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
88 return pResult; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
89 } |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
90 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
91 #ifdef AUDACIOUS_PLUGIN |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
92 TitleInput * xs_make_titletuple(t_xs_tuneinfo *p, gint subTune) |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
93 { |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
94 gchar *tmpFilename, *tmpFilePath, *tmpFileExt; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
95 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
96 xs_path_split(p->sidFilename, &tmpFilename, &tmpFilePath, &tmpFileExt); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
97 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
98 return xs_get_titletuple(tmpFilename, tmpFilePath, tmpFileExt, p, subTune); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
99 } |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
100 #endif |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
101 #endif |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
102 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
103 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
104 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
105 * Create a title string based on given information and settings. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
106 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
107 #define VPUTCH(MCH) \ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
108 if (iIndex < XS_BUF_SIZE) tmpBuf[iIndex++] = MCH; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
109 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
110 #define VPUTSTR(MSTR) { \ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
111 if (MSTR) { \ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
112 if ((iIndex + strlen(MSTR) + 1) < XS_BUF_SIZE) { \ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
113 strcpy(&tmpBuf[iIndex], MSTR); \ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
114 iIndex += strlen(MSTR); \ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
115 } else \ |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
116 iIndex = XS_BUF_SIZE; \ |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
117 } \ |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
118 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
119 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
120 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
121 gchar *xs_make_titlestring(t_xs_tuneinfo *p, gint subTune) |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
122 { |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
123 gchar *tmpFilename, *tmpFilePath, *tmpFileExt, |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
124 *pcStr, *pcResult, tmpStr[XS_BUF_SIZE], tmpBuf[XS_BUF_SIZE]; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
125 t_xs_subtuneinfo *subInfo; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
126 gint iIndex; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
127 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
128 /* Get filename parts */ |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
129 xs_path_split(p->sidFilename, &tmpFilename, |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
130 &tmpFilePath, &tmpFileExt); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
131 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
132 /* Get sub-tune information */ |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
133 if ((subTune > 0) && (subTune <= p->nsubTunes)) { |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
134 subInfo = &(p->subTunes[subTune - 1]); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
135 } else |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
136 subInfo = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
137 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
138 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
139 /* Check if the titles are overridden or not */ |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
140 #if defined(HAVE_XMMSEXTRA) || defined(AUDACIOUS_PLUGIN) |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
141 if (!xs_cfg.titleOverride) { |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
142 TitleInput *pTuple = xs_get_titletuple( |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
143 tmpFilename, tmpFilePath, tmpFileExt, p, subTune); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
144 |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
145 pcResult = xmms_get_titlestring(xmms_get_gentitle_format(), pTuple); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
146 |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
147 g_free(pTuple->track_name); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
148 g_free(pTuple->album_name); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
149 g_free(pTuple->performer); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
150 g_free(pTuple->date); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
151 g_free(pTuple->genre); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
152 g_free(pTuple->comment); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
153 g_free(pTuple); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
154 } else |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
155 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
156 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
157 /* Create the string */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
158 pcStr = xs_cfg.titleFormat; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
159 iIndex = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
160 while (*pcStr && (iIndex < XS_BUF_SIZE)) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
161 if (*pcStr == '%') { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
162 pcStr++; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
163 switch (*pcStr) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
164 case '%': |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
165 VPUTCH('%'); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
166 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
167 case 'f': |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
168 VPUTSTR(tmpFilename); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
169 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
170 case 'F': |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
171 VPUTSTR(tmpFilePath); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
172 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
173 case 'e': |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
174 VPUTSTR(tmpFileExt); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
175 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
176 case 'p': |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
177 VPUTSTR(p->sidComposer); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
178 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
179 case 't': |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
180 VPUTSTR(p->sidName); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
181 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
182 case 'c': |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
183 VPUTSTR(p->sidCopyright); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
184 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
185 case 's': |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
186 VPUTSTR(p->sidFormat); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
187 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
188 case 'm': |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
189 switch (p->sidModel) { |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
190 case XS_SIDMODEL_6581: |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
191 VPUTSTR("6581"); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
192 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
193 case XS_SIDMODEL_8580: |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
194 VPUTSTR("8580"); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
195 break; |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
196 case XS_SIDMODEL_ANY: |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
197 VPUTSTR("ANY"); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
198 break; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
199 default: |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
200 VPUTSTR("?"); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
201 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
202 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
203 break; |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
204 case 'C': |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
205 if (subInfo && (subInfo->tuneSpeed > 0)) { |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
206 switch (subInfo->tuneSpeed) { |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
207 case XS_CLOCK_PAL: |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
208 VPUTSTR("PAL"); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
209 break; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
210 case XS_CLOCK_NTSC: |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
211 VPUTSTR("NTSC"); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
212 break; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
213 case XS_CLOCK_ANY: |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
214 VPUTSTR("ANY"); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
215 break; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
216 case XS_CLOCK_VBI: |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
217 VPUTSTR("VBI"); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
218 break; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
219 case XS_CLOCK_CIA: |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
220 VPUTSTR("CIA"); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
221 break; |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
222 default: |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
223 g_snprintf(tmpStr, XS_BUF_SIZE, |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
224 "%iHz", subInfo->tuneSpeed); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
225 VPUTSTR(tmpStr); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
226 } |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
227 } else |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
228 VPUTSTR("?"); |
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
229 break; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
230 case 'n': |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
231 g_snprintf(tmpStr, XS_BUF_SIZE, "%i", subTune); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
232 VPUTSTR(tmpStr); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
233 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
234 case 'N': |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
235 g_snprintf(tmpStr, XS_BUF_SIZE, "%i", p->nsubTunes); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
236 VPUTSTR(tmpStr); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
237 break; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
238 } |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
239 } else |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
240 VPUTCH(*pcStr); |
735
6c3c7b841382
[svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents:
12
diff
changeset
|
241 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
242 pcStr++; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
243 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
244 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
245 tmpBuf[iIndex] = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
246 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
247 /* Make resulting string */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
248 pcResult = g_strdup(tmpBuf); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
249 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
250 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
251 /* Free temporary strings */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
252 g_free(tmpFilename); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
253 g_free(tmpFilePath); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
254 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
255 return pcResult; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
256 } |