Mercurial > audlegacy
comparison src/audtool/audtool_handlers_playlist.c @ 3873:f3341c2d6b9e
audacious remote functions:
- playlist_ins_url_string() and playlist_enqueue_to_temp() have been implemented.
- now get_version() returns audacious version instead of protocol version.
audtool:
- now argc check works properly.
- some cleanups.
author | Yoshiki Yazawa <yaz@cc.rim.or.jp> |
---|---|
date | Tue, 30 Oct 2007 22:12:47 +0900 |
parents | 964413953abd |
children | 1792ab581321 |
comparison
equal
deleted
inserted
replaced
3872:b02853ac8466 | 3873:f3341c2d6b9e |
---|---|
51 { | 51 { |
52 if (argc < 2) | 52 if (argc < 2) |
53 { | 53 { |
54 audtool_whine("invalid parameters for %s.", argv[0]); | 54 audtool_whine("invalid parameters for %s.", argv[0]); |
55 audtool_whine("syntax: %s <url>", argv[0]); | 55 audtool_whine("syntax: %s <url>", argv[0]); |
56 return; | 56 exit(1); |
57 } | 57 } |
58 | 58 |
59 audacious_remote_playlist_add_url_string(dbus_proxy, argv[1]); | 59 audacious_remote_playlist_add_url_string(dbus_proxy, argv[1]); |
60 } | 60 } |
61 | 61 |
65 | 65 |
66 if (argc < 2) | 66 if (argc < 2) |
67 { | 67 { |
68 audtool_whine("invalid parameters for %s.", argv[0]); | 68 audtool_whine("invalid parameters for %s.", argv[0]); |
69 audtool_whine("syntax: %s <position>", argv[0]); | 69 audtool_whine("syntax: %s <position>", argv[0]); |
70 return; | 70 exit(1); |
71 } | 71 } |
72 | 72 |
73 playpos = atoi(argv[1]); | 73 playpos = atoi(argv[1]); |
74 | 74 |
75 if (playpos < 1 || playpos > audacious_remote_get_playlist_length(dbus_proxy)) | 75 if (playpos < 1 || playpos > audacious_remote_get_playlist_length(dbus_proxy)) |
97 | 97 |
98 if (argc < 2) | 98 if (argc < 2) |
99 { | 99 { |
100 audtool_whine("invalid parameters for %s.", argv[0]); | 100 audtool_whine("invalid parameters for %s.", argv[0]); |
101 audtool_whine("syntax: %s <position>", argv[0]); | 101 audtool_whine("syntax: %s <position>", argv[0]); |
102 return; | 102 exit(1); |
103 } | 103 } |
104 | 104 |
105 playpos = atoi(argv[1]); | 105 playpos = atoi(argv[1]); |
106 | 106 |
107 if (playpos < 1 || playpos > audacious_remote_get_playlist_length(dbus_proxy)) | 107 if (playpos < 1 || playpos > audacious_remote_get_playlist_length(dbus_proxy)) |
108 { | 108 { |
109 audtool_whine("invalid playlist position %d", playpos); | 109 audtool_whine("invalid playlist position %d", playpos); |
110 return; | 110 exit(1); |
111 } | 111 } |
112 | 112 |
113 song = audacious_remote_get_playlist_title(dbus_proxy, playpos - 1); | 113 song = audacious_remote_get_playlist_title(dbus_proxy, playpos - 1); |
114 | 114 |
115 audtool_report("%s", song); | 115 audtool_report("%s", song); |
122 | 122 |
123 if (argc < 2) | 123 if (argc < 2) |
124 { | 124 { |
125 audtool_whine("invalid parameters for %s.", argv[0]); | 125 audtool_whine("invalid parameters for %s.", argv[0]); |
126 audtool_whine("syntax: %s <position>", argv[0]); | 126 audtool_whine("syntax: %s <position>", argv[0]); |
127 return; | 127 exit(1); |
128 } | 128 } |
129 | 129 |
130 playpos = atoi(argv[1]); | 130 playpos = atoi(argv[1]); |
131 | 131 |
132 if (playpos < 1 || playpos > audacious_remote_get_playlist_length(dbus_proxy)) | 132 if (playpos < 1 || playpos > audacious_remote_get_playlist_length(dbus_proxy)) |
133 { | 133 { |
134 audtool_whine("invalid playlist position %d", playpos); | 134 audtool_whine("invalid playlist position %d", playpos); |
135 return; | 135 exit(1); |
136 } | 136 } |
137 | 137 |
138 frames = audacious_remote_get_playlist_time(dbus_proxy, playpos - 1); | 138 frames = audacious_remote_get_playlist_time(dbus_proxy, playpos - 1); |
139 length = frames / 1000; | 139 length = frames / 1000; |
140 | 140 |
147 | 147 |
148 if (argc < 2) | 148 if (argc < 2) |
149 { | 149 { |
150 audtool_whine("invalid parameters for %s.", argv[0]); | 150 audtool_whine("invalid parameters for %s.", argv[0]); |
151 audtool_whine("syntax: %s <position>", argv[0]); | 151 audtool_whine("syntax: %s <position>", argv[0]); |
152 return; | 152 exit(1); |
153 } | 153 } |
154 | 154 |
155 playpos = atoi(argv[1]); | 155 playpos = atoi(argv[1]); |
156 | 156 |
157 if (playpos < 1 || playpos > audacious_remote_get_playlist_length(dbus_proxy)) | 157 if (playpos < 1 || playpos > audacious_remote_get_playlist_length(dbus_proxy)) |
158 { | 158 { |
159 audtool_whine("invalid playlist position %d", playpos); | 159 audtool_whine("invalid playlist position %d", playpos); |
160 return; | 160 exit(1); |
161 } | 161 } |
162 | 162 |
163 frames = audacious_remote_get_playlist_time(dbus_proxy, playpos - 1); | 163 frames = audacious_remote_get_playlist_time(dbus_proxy, playpos - 1); |
164 length = frames / 1000; | 164 length = frames / 1000; |
165 | 165 |
172 | 172 |
173 if (argc < 2) | 173 if (argc < 2) |
174 { | 174 { |
175 audtool_whine("invalid parameters for %s.", argv[0]); | 175 audtool_whine("invalid parameters for %s.", argv[0]); |
176 audtool_whine("syntax: %s <position>", argv[0]); | 176 audtool_whine("syntax: %s <position>", argv[0]); |
177 return; | 177 exit(1); |
178 } | 178 } |
179 | 179 |
180 playpos = atoi(argv[1]); | 180 playpos = atoi(argv[1]); |
181 | 181 |
182 if (playpos < 1 || playpos > audacious_remote_get_playlist_length(dbus_proxy)) | 182 if (playpos < 1 || playpos > audacious_remote_get_playlist_length(dbus_proxy)) |
183 { | 183 { |
184 audtool_whine("invalid playlist position %d", playpos); | 184 audtool_whine("invalid playlist position %d", playpos); |
185 return; | 185 exit(1); |
186 } | 186 } |
187 | 187 |
188 frames = audacious_remote_get_playlist_time(dbus_proxy, playpos - 1); | 188 frames = audacious_remote_get_playlist_time(dbus_proxy, playpos - 1); |
189 | 189 |
190 audtool_report("%d", frames); | 190 audtool_report("%d", frames); |
255 | 255 |
256 if (argc < 2) | 256 if (argc < 2) |
257 { | 257 { |
258 audtool_whine("invalid parameters for %s.", argv[0]); | 258 audtool_whine("invalid parameters for %s.", argv[0]); |
259 audtool_whine("syntax: %s <position>", argv[0]); | 259 audtool_whine("syntax: %s <position>", argv[0]); |
260 return; | 260 exit(1); |
261 } | 261 } |
262 | 262 |
263 i = atoi(argv[1]); | 263 i = atoi(argv[1]); |
264 | 264 |
265 if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy)) | 265 if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy)) |
266 { | 266 { |
267 audtool_whine("invalid playlist position %d", i); | 267 audtool_whine("invalid playlist position %d", i); |
268 return; | 268 exit(1); |
269 } | 269 } |
270 | 270 |
271 audtool_report("%s", audacious_remote_get_playlist_file(dbus_proxy, i - 1)); | 271 audtool_report("%s", audacious_remote_get_playlist_file(dbus_proxy, i - 1)); |
272 } | 272 } |
273 | 273 |
277 | 277 |
278 if (argc < 2) | 278 if (argc < 2) |
279 { | 279 { |
280 audtool_whine("invalid parameters for %s.", argv[0]); | 280 audtool_whine("invalid parameters for %s.", argv[0]); |
281 audtool_whine("syntax: %s <position>", argv[0]); | 281 audtool_whine("syntax: %s <position>", argv[0]); |
282 return; | 282 exit(1); |
283 } | 283 } |
284 | 284 |
285 i = atoi(argv[1]); | 285 i = atoi(argv[1]); |
286 | 286 |
287 if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy)) | 287 if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy)) |
288 { | 288 { |
289 audtool_whine("invalid playlist position %d", i); | 289 audtool_whine("invalid playlist position %d", i); |
290 return; | 290 exit(1); |
291 } | 291 } |
292 | 292 |
293 audacious_remote_set_playlist_pos(dbus_proxy, i - 1); | 293 audacious_remote_set_playlist_pos(dbus_proxy, i - 1); |
294 } | 294 } |
295 | 295 |
347 audtool_whine("syntax: %s <fieldname> <position>", argv[0]); | 347 audtool_whine("syntax: %s <fieldname> <position>", argv[0]); |
348 audtool_whine(" - fieldname example choices: performer, album_name,"); | 348 audtool_whine(" - fieldname example choices: performer, album_name,"); |
349 audtool_whine(" track_name, track_number, year, date, genre, comment,"); | 349 audtool_whine(" track_name, track_number, year, date, genre, comment,"); |
350 audtool_whine(" file_name, file_ext, file_path, length, formatter,"); | 350 audtool_whine(" file_name, file_ext, file_path, length, formatter,"); |
351 audtool_whine(" custom, mtime"); | 351 audtool_whine(" custom, mtime"); |
352 return; | 352 exit(1); |
353 } | 353 } |
354 | 354 |
355 i = atoi(argv[2]); | 355 i = atoi(argv[2]); |
356 | 356 |
357 if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy)) | 357 if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy)) |
358 { | 358 { |
359 audtool_whine("invalid playlist position %d", i); | 359 audtool_whine("invalid playlist position %d", i); |
360 return; | 360 exit(1); |
361 } | 361 } |
362 | 362 |
363 if (!(data = audacious_get_tuple_field_data(dbus_proxy, argv[1], i - 1))) | 363 if (!(data = audacious_get_tuple_field_data(dbus_proxy, argv[1], i - 1))) |
364 { | 364 { |
365 return; | 365 return; //XXX ??? --yaz |
366 } | 366 } |
367 | 367 |
368 if (!g_ascii_strcasecmp(argv[1], "track_number") || !g_ascii_strcasecmp(argv[1], "year") || !g_ascii_strcasecmp(argv[1], "length") || !g_ascii_strcasecmp(argv[1], "mtime")) | 368 if (!g_ascii_strcasecmp(argv[1], "track_number") || !g_ascii_strcasecmp(argv[1], "year") || !g_ascii_strcasecmp(argv[1], "length") || !g_ascii_strcasecmp(argv[1], "mtime")) |
369 { | 369 { |
370 if (*(gint *)data > 0) | 370 if (*(gint *)data > 0) |