Mercurial > audlegacy
comparison audacious/playlist.c @ 397:4fa1244ad483 trunk
[svn] Do not generate a cache when loading a playlist.
author | nenolod |
---|---|
date | Sat, 07 Jan 2006 10:02:25 -0800 |
parents | 5c457dac866a |
children | f908bcd87c3d |
comparison
equal
deleted
inserted
replaced
396:329a48431102 | 397:4fa1244ad483 |
---|---|
70 | 70 |
71 static GList *playlist = NULL; | 71 static GList *playlist = NULL; |
72 static GList *shuffle_list = NULL; | 72 static GList *shuffle_list = NULL; |
73 static GList *queued_list = NULL; | 73 static GList *queued_list = NULL; |
74 | 74 |
75 /* If this is set to TRUE, we do not probe upon playlist add. | |
76 * | |
77 * Under Audacious 0.1.x, this was not a big deal because we used | |
78 * file extension introspection instead of looking for file format magic | |
79 * strings. | |
80 * | |
81 * Because we use file magic strings, we have to fstat a file being added | |
82 * to a playlist up to 1 * <number of input plugins installed> times. | |
83 * | |
84 * This can get really slow now that we're looking for files to add to a | |
85 * playlist. (Up to 5 minutes for 5000 songs, etcetera.) | |
86 * | |
87 * So, we obviously don't want to probe while opening a large playlist | |
88 * up. Hince the boolean below. | |
89 * | |
90 * January 7, 2006, William Pitcock <nenolod@nenolod.net> | |
91 */ | |
92 static gboolean loading_playlist = FALSE; | |
75 | 93 |
76 G_LOCK_DEFINE(playlist_get_info_going); | 94 G_LOCK_DEFINE(playlist_get_info_going); |
77 | 95 |
78 static gchar *playlist_current_name = NULL; | 96 static gchar *playlist_current_name = NULL; |
79 | 97 |
479 if (is_playlist_name(filename)) { | 497 if (is_playlist_name(filename)) { |
480 playlist_load_ins(filename, pos); | 498 playlist_load_ins(filename, pos); |
481 return TRUE; | 499 return TRUE; |
482 } | 500 } |
483 | 501 |
484 if ((dec = input_check_file(filename, TRUE)) != NULL) { | 502 if (loading_playlist == TRUE) |
485 __playlist_ins(filename, pos, dec); | 503 dec = NULL; |
486 playlist_generate_shuffle_list(); | 504 else |
487 playlistwin_update_list(); | 505 dec = input_check_file(filename, TRUE); |
506 | |
507 if (loading_playlist == TRUE || (loading_playlist == FALSE && dec != NULL)) | |
508 { | |
509 __playlist_ins(filename, pos, dec); | |
510 playlist_generate_shuffle_list(); | |
511 playlistwin_update_list(); | |
488 return TRUE; | 512 return TRUE; |
489 } | 513 } |
490 | 514 |
491 /* Some files (typically produced by some cgi-scripts) don't have | 515 /* Some files (typically produced by some cgi-scripts) don't have |
492 * the correct extension. Try to recognize these files by looking | 516 * the correct extension. Try to recognize these files by looking |
1263 } | 1287 } |
1264 | 1288 |
1265 gboolean | 1289 gboolean |
1266 playlist_load(const gchar * filename) | 1290 playlist_load(const gchar * filename) |
1267 { | 1291 { |
1268 return playlist_load_ins(filename, -1); | 1292 gboolean ret = FALSE; |
1293 | |
1294 loading_playlist = TRUE; | |
1295 ret = playlist_load_ins(filename, -1); | |
1296 loading_playlist = FALSE; | |
1297 | |
1298 return ret; | |
1269 } | 1299 } |
1270 | 1300 |
1271 | 1301 |
1272 static void | 1302 static void |
1273 playlist_load_ins_file(const gchar * filename_p, | 1303 playlist_load_ins_file(const gchar * filename_p, |
1291 if (filename[0] != '/' && !strstr(filename, "://")) { | 1321 if (filename[0] != '/' && !strstr(filename, "://")) { |
1292 path = g_strdup(playlist_name); | 1322 path = g_strdup(playlist_name); |
1293 if ((tmp = strrchr(path, '/'))) | 1323 if ((tmp = strrchr(path, '/'))) |
1294 *tmp = '\0'; | 1324 *tmp = '\0'; |
1295 else { | 1325 else { |
1296 dec = input_check_file(filename, FALSE); | 1326 if (loading_playlist != TRUE) |
1327 dec = input_check_file(filename, FALSE); | |
1328 else | |
1329 dec = NULL; | |
1330 | |
1297 __playlist_ins_with_info(filename, pos, title, len, dec); | 1331 __playlist_ins_with_info(filename, pos, title, len, dec); |
1298 return; | 1332 return; |
1299 } | 1333 } |
1300 tmp = g_build_filename(path, filename, NULL); | 1334 tmp = g_build_filename(path, filename, NULL); |
1301 dec = input_check_file(filename, FALSE); | 1335 |
1336 if (loading_playlist != TRUE) | |
1337 dec = input_check_file(tmp, FALSE); | |
1338 else | |
1339 dec = NULL; | |
1340 | |
1302 __playlist_ins_with_info(tmp, pos, title, len, dec); | 1341 __playlist_ins_with_info(tmp, pos, title, len, dec); |
1303 g_free(tmp); | 1342 g_free(tmp); |
1304 g_free(path); | 1343 g_free(path); |
1305 } | 1344 } |
1306 else | 1345 else |
1307 { | 1346 { |
1308 dec = input_check_file(filename, FALSE); | 1347 if (loading_playlist != TRUE) |
1348 dec = input_check_file(filename, FALSE); | |
1349 else | |
1350 dec = NULL; | |
1351 | |
1309 __playlist_ins_with_info(filename, pos, title, len, dec); | 1352 __playlist_ins_with_info(filename, pos, title, len, dec); |
1310 } | 1353 } |
1311 | 1354 |
1312 g_free(filename); | 1355 g_free(filename); |
1313 } | 1356 } |