Mercurial > audlegacy
comparison src/audacious/playlist.c @ 4515:212790dd92ba
reindent the code before messing with it
author | mf0102 <0102@gmx.at> |
---|---|
date | Wed, 23 Apr 2008 18:53:14 +0200 |
parents | 0fe46317167f |
children | 9fbb55542e73 |
comparison
equal
deleted
inserted
replaced
4514:0fe46317167f | 4515:212790dd92ba |
---|---|
153 | 153 |
154 PlaylistEntry * | 154 PlaylistEntry * |
155 playlist_entry_new(const gchar * filename, | 155 playlist_entry_new(const gchar * filename, |
156 const gchar * title, | 156 const gchar * title, |
157 const gint length, | 157 const gint length, |
158 InputPlugin * dec) | 158 InputPlugin * dec) |
159 { | 159 { |
160 PlaylistEntry *entry; | 160 PlaylistEntry *entry; |
161 | 161 |
162 entry = mowgli_heap_alloc(playlist_entry_heap); | 162 entry = mowgli_heap_alloc(playlist_entry_heap); |
163 entry->filename = g_strdup(filename); | 163 entry->filename = g_strdup(filename); |
217 | 217 |
218 /* renew tuple if file mtime is newer than tuple mtime. */ | 218 /* renew tuple if file mtime is newer than tuple mtime. */ |
219 if (entry->tuple){ | 219 if (entry->tuple){ |
220 if (tuple_get_int(entry->tuple, FIELD_MTIME, NULL) == modtime) { | 220 if (tuple_get_int(entry->tuple, FIELD_MTIME, NULL) == modtime) { |
221 if (pr != NULL) g_free(pr); | 221 if (pr != NULL) g_free(pr); |
222 | 222 |
223 if (entry->title_is_valid == FALSE) { /* update title even tuple is present and up to date --asphyx */ | 223 if (entry->title_is_valid == FALSE) { /* update title even tuple is present and up to date --asphyx */ |
224 AUDDBG("updating title from actual tuple\n"); | 224 AUDDBG("updating title from actual tuple\n"); |
225 formatter = tuple_get_string(entry->tuple, FIELD_FORMATTER, NULL); | 225 formatter = tuple_get_string(entry->tuple, FIELD_FORMATTER, NULL); |
226 if (entry->title != NULL) g_free(entry->title); | 226 if (entry->title != NULL) g_free(entry->title); |
227 entry->title = tuple_formatter_make_title_string(entry->tuple, formatter ? | 227 entry->title = tuple_formatter_make_title_string(entry->tuple, formatter ? |
228 formatter : get_gentitle_format()); | 228 formatter : get_gentitle_format()); |
229 entry->title_is_valid = TRUE; | 229 entry->title_is_valid = TRUE; |
230 AUDDBG("new title: \"%s\"\n", entry->title); | 230 AUDDBG("new title: \"%s\"\n", entry->title); |
231 } | 231 } |
232 | 232 |
233 return TRUE; | 233 return TRUE; |
254 tuple_associate_int(tuple, FIELD_MTIME, NULL, modtime); | 254 tuple_associate_int(tuple, FIELD_MTIME, NULL, modtime); |
255 | 255 |
256 /* entry is still around */ | 256 /* entry is still around */ |
257 formatter = tuple_get_string(tuple, FIELD_FORMATTER, NULL); | 257 formatter = tuple_get_string(tuple, FIELD_FORMATTER, NULL); |
258 entry->title = tuple_formatter_make_title_string(tuple, formatter ? | 258 entry->title = tuple_formatter_make_title_string(tuple, formatter ? |
259 formatter : get_gentitle_format()); | 259 formatter : get_gentitle_format()); |
260 entry->title_is_valid = TRUE; | 260 entry->title_is_valid = TRUE; |
261 entry->length = tuple_get_int(tuple, FIELD_LENGTH, NULL); | 261 entry->length = tuple_get_int(tuple, FIELD_LENGTH, NULL); |
262 entry->tuple = tuple; | 262 entry->tuple = tuple; |
263 | 263 |
264 if (pr != NULL) g_free(pr); | 264 if (pr != NULL) g_free(pr); |
273 { | 273 { |
274 Playlist *initial_pl; | 274 Playlist *initial_pl; |
275 | 275 |
276 /* create a heap with 1024 playlist entry nodes preallocated. --nenolod */ | 276 /* create a heap with 1024 playlist entry nodes preallocated. --nenolod */ |
277 playlist_entry_heap = mowgli_heap_create(sizeof(PlaylistEntry), 1024, | 277 playlist_entry_heap = mowgli_heap_create(sizeof(PlaylistEntry), 1024, |
278 BH_NOW); | 278 BH_NOW); |
279 | 279 |
280 /* FIXME: is this really necessary? REQUIRE_STATIC_LOCK(playlists); */ | 280 /* FIXME: is this really necessary? REQUIRE_STATIC_LOCK(playlists); */ |
281 | 281 |
282 initial_pl = playlist_new(); | 282 initial_pl = playlist_new(); |
283 | 283 |
651 } | 651 } |
652 } | 652 } |
653 | 653 |
654 for (; add_flag && subtune <= nsubtunes; subtune++) { | 654 for (; add_flag && subtune <= nsubtunes; subtune++) { |
655 gchar *filename_entry; | 655 gchar *filename_entry; |
656 | 656 |
657 if (nsubtunes > 0) { | 657 if (nsubtunes > 0) { |
658 filename_entry = g_strdup_printf("%s?%d", filename, | 658 filename_entry = g_strdup_printf("%s?%d", filename, |
659 parent_tuple->subtunes ? parent_tuple->subtunes[subtune - 1] : subtune); | 659 parent_tuple->subtunes ? parent_tuple->subtunes[subtune - 1] : subtune); |
660 | 660 |
661 /* We're dealing with subtune, let's ask again tuple information | 661 /* We're dealing with subtune, let's ask again tuple information |
662 * to plugin, by passing the ?subtune suffix; this way we get | 662 * to plugin, by passing the ?subtune suffix; this way we get |
663 * specific subtune information in the tuple, if available. | 663 * specific subtune information in the tuple, if available. |
664 */ | 664 */ |
665 plugin_set_current((Plugin *)dec); | 665 plugin_set_current((Plugin *)dec); |
666 tuple = dec->get_song_tuple(filename_entry); | 666 tuple = dec->get_song_tuple(filename_entry); |
667 } else | 667 } else |
668 filename_entry = g_strdup(filename); | 668 filename_entry = g_strdup(filename); |
669 | 669 |
670 if(tuple) { | 670 if (tuple) { |
671 entry = playlist_entry_new(filename_entry, | 671 entry = playlist_entry_new(filename_entry, |
672 tuple_get_string(tuple, FIELD_TITLE, NULL), | 672 tuple_get_string(tuple, FIELD_TITLE, NULL), |
673 tuple_get_int(tuple, FIELD_LENGTH, NULL), dec); | 673 tuple_get_int(tuple, FIELD_LENGTH, NULL), dec); |
674 } | 674 } |
675 else { | 675 else { |
678 | 678 |
679 g_free(filename_entry); | 679 g_free(filename_entry); |
680 | 680 |
681 | 681 |
682 PLAYLIST_LOCK(playlist); | 682 PLAYLIST_LOCK(playlist); |
683 | 683 |
684 if (!playlist->tail) | 684 if (!playlist->tail) |
685 playlist->tail = g_list_last(playlist->entries); | 685 playlist->tail = g_list_last(playlist->entries); |
686 | 686 |
687 if (pos == -1) { // the common case | 687 if (pos == -1) { // the common case |
688 GList *element; | 688 GList *element; |
701 } else | 701 } else |
702 add_flag = FALSE; | 702 add_flag = FALSE; |
703 } | 703 } |
704 } else | 704 } else |
705 playlist->entries = g_list_insert(playlist->entries, entry, pos++); | 705 playlist->entries = g_list_insert(playlist->entries, entry, pos++); |
706 | 706 |
707 if (tuple != NULL) { | 707 if (tuple != NULL) { |
708 const gchar *formatter = tuple_get_string(tuple, FIELD_FORMATTER, NULL); | 708 const gchar *formatter = tuple_get_string(tuple, FIELD_FORMATTER, NULL); |
709 g_free(entry->title); | 709 g_free(entry->title); |
710 entry->title = tuple_formatter_make_title_string(tuple, | 710 entry->title = tuple_formatter_make_title_string(tuple, |
711 formatter ? formatter : get_gentitle_format()); | 711 formatter ? formatter : get_gentitle_format()); |
712 entry->title_is_valid = TRUE; | 712 entry->title_is_valid = TRUE; |
713 entry->length = tuple_get_int(tuple, FIELD_LENGTH, NULL); | 713 entry->length = tuple_get_int(tuple, FIELD_LENGTH, NULL); |
714 entry->tuple = tuple; | 714 entry->tuple = tuple; |
715 } | 715 } |
716 | 716 |
717 PLAYLIST_UNLOCK(playlist); | 717 PLAYLIST_UNLOCK(playlist); |
718 } | 718 } |
719 | 719 |
720 if (parent_tuple) | 720 if (parent_tuple) |
721 tuple_free(parent_tuple); | 721 tuple_free(parent_tuple); |
752 playlist_load_ins(playlist, filename, pos); | 752 playlist_load_ins(playlist, filename, pos); |
753 playlist->loading_playlist = FALSE; | 753 playlist->loading_playlist = FALSE; |
754 return TRUE; | 754 return TRUE; |
755 } | 755 } |
756 | 756 |
757 if(do_precheck(playlist, filename, &pr)) { | 757 if (do_precheck(playlist, filename, &pr)) { |
758 if(pr) { | 758 if (pr) { |
759 dec = pr->ip; | 759 dec = pr->ip; |
760 tuple = pr->tuple; | 760 tuple = pr->tuple; |
761 } | 761 } |
762 /* add filename to playlist */ | 762 /* add filename to playlist */ |
763 if (cfg.playlist_detect == TRUE || | 763 if (cfg.playlist_detect == TRUE || |
764 playlist->loading_playlist == TRUE || | 764 playlist->loading_playlist == TRUE || |
765 (playlist->loading_playlist == FALSE && dec != NULL) || | 765 (playlist->loading_playlist == FALSE && dec != NULL) || |
766 (playlist->loading_playlist == FALSE && !is_playlist_name(filename) && http_flag) ) { | 766 (playlist->loading_playlist == FALSE && !is_playlist_name(filename) |
767 | 767 && http_flag)) |
768 { | |
768 __playlist_ins_file(playlist, filename, pos, tuple, NULL, -1, dec); | 769 __playlist_ins_file(playlist, filename, pos, tuple, NULL, -1, dec); |
769 | 770 |
770 g_free(pr); | 771 g_free(pr); |
771 playlist_generate_shuffle_list(playlist); | 772 playlist_generate_shuffle_list(playlist); |
772 playlistwin_update_list(playlist); | 773 playlistwin_update_list(playlist); |
980 return entries; | 981 return entries; |
981 } | 982 } |
982 | 983 |
983 guint | 984 guint |
984 playlist_ins_dir(Playlist * playlist, const gchar * path, | 985 playlist_ins_dir(Playlist * playlist, const gchar * path, |
985 gint pos, | 986 gint pos, |
986 gboolean background) | 987 gboolean background) |
987 { | 988 { |
988 guint entries = 0; | 989 guint entries = 0; |
989 GList *list, *node; | 990 GList *list, *node; |
990 GHashTable *htab; | 991 GHashTable *htab; |
991 gchar *path2 = g_filename_from_uri(path, NULL, NULL); | 992 gchar *path2 = g_filename_from_uri(path, NULL, NULL); |
1018 return entries; | 1019 return entries; |
1019 } | 1020 } |
1020 | 1021 |
1021 guint | 1022 guint |
1022 playlist_ins_url(Playlist * playlist, const gchar * string, | 1023 playlist_ins_url(Playlist * playlist, const gchar * string, |
1023 gint pos) | 1024 gint pos) |
1024 { | 1025 { |
1025 gchar *tmp; | 1026 gchar *tmp; |
1026 gint entries = 0; | 1027 gint entries = 0; |
1027 gchar *decoded = NULL; | 1028 gchar *decoded = NULL; |
1028 | 1029 |
1039 *tmp = '\0'; | 1040 *tmp = '\0'; |
1040 } | 1041 } |
1041 | 1042 |
1042 decoded = g_strdup(string); | 1043 decoded = g_strdup(string); |
1043 | 1044 |
1044 if (vfs_file_test(decoded, G_FILE_TEST_IS_DIR)) { | 1045 if (vfs_file_test(decoded, G_FILE_TEST_IS_DIR)) |
1045 i = playlist_ins_dir(playlist, decoded, pos, FALSE); | 1046 i = playlist_ins_dir(playlist, decoded, pos, FALSE); |
1046 } | 1047 else if (is_playlist_name(decoded)) |
1047 else { | 1048 i = playlist_load_ins(playlist, decoded, pos); |
1048 if (is_playlist_name(decoded)) { | 1049 else if (playlist_ins(playlist, decoded, pos)) |
1049 i = playlist_load_ins(playlist, decoded, pos); | 1050 i = 1; |
1050 } | |
1051 else if (playlist_ins(playlist, decoded, pos)) { | |
1052 i = 1; | |
1053 } | |
1054 } | |
1055 | 1051 |
1056 g_free(decoded); | 1052 g_free(decoded); |
1057 | 1053 |
1058 PLAYLIST_LOCK(playlist); | 1054 PLAYLIST_LOCK(playlist); |
1059 node = g_list_nth(playlist->entries, pos); | 1055 node = g_list_nth(playlist->entries, pos); |
1079 return entries; | 1075 return entries; |
1080 } | 1076 } |
1081 | 1077 |
1082 /* set info for current song. */ | 1078 /* set info for current song. */ |
1083 void | 1079 void |
1084 playlist_set_info(Playlist * playlist, const gchar * title, gint length, gint rate, | 1080 playlist_set_info(Playlist * playlist, const gchar * title, |
1085 gint freq, gint nch) | 1081 gint length, gint rate, gint freq, gint nch) |
1086 { | 1082 { |
1087 PlaylistEventInfoChange *msg; | 1083 PlaylistEventInfoChange *msg; |
1088 gchar *text; | 1084 gchar *text; |
1089 | 1085 |
1090 g_return_if_fail(playlist != NULL); | 1086 g_return_if_fail(playlist != NULL); |
1091 | 1087 |
1092 if(length == -1) { | 1088 if (length == -1) { |
1093 event_queue("hide seekbar", (gpointer)0xdeadbeef); // event_queue hates NULL --yaz | 1089 // event_queue hates NULL --yaz |
1090 event_queue("hide seekbar", (gpointer)0xdeadbeef); | |
1094 } | 1091 } |
1095 | 1092 |
1096 if (playlist->position) { | 1093 if (playlist->position) { |
1097 g_free(playlist->position->title); | 1094 g_free(playlist->position->title); |
1098 playlist->position->title = g_strdup(title); | 1095 playlist->position->title = g_strdup(title); |
1162 void | 1159 void |
1163 playlist_next(Playlist *playlist) | 1160 playlist_next(Playlist *playlist) |
1164 { | 1161 { |
1165 GList *plist_pos_list; | 1162 GList *plist_pos_list; |
1166 gboolean restart_playing = FALSE; | 1163 gboolean restart_playing = FALSE; |
1167 | 1164 |
1168 if (!playlist_get_length(playlist)) | 1165 if (!playlist_get_length(playlist)) |
1169 return; | 1166 return; |
1170 | 1167 |
1171 PLAYLIST_LOCK(playlist); | 1168 PLAYLIST_LOCK(playlist); |
1172 | 1169 |
1175 playlist_position_before_jump = NULL; | 1172 playlist_position_before_jump = NULL; |
1176 } | 1173 } |
1177 | 1174 |
1178 plist_pos_list = find_playlist_position_list(playlist); | 1175 plist_pos_list = find_playlist_position_list(playlist); |
1179 | 1176 |
1180 if (!cfg.repeat && !g_list_next(plist_pos_list) && playlist->queue == NULL) { | 1177 if (!cfg.repeat && !g_list_next(plist_pos_list) && playlist->queue == NULL) |
1178 { | |
1181 PLAYLIST_UNLOCK(playlist); | 1179 PLAYLIST_UNLOCK(playlist); |
1182 return; | 1180 return; |
1183 } | 1181 } |
1184 | 1182 |
1185 if (playback_get_playing()) { | 1183 if (playback_get_playing()) { |
1203 if (cfg.shuffle) | 1201 if (cfg.shuffle) |
1204 playlist->position = playlist->shuffle->data; | 1202 playlist->position = playlist->shuffle->data; |
1205 else | 1203 else |
1206 playlist->position = playlist->entries->data; | 1204 playlist->position = playlist->entries->data; |
1207 } | 1205 } |
1208 | 1206 |
1209 PLAYLIST_UNLOCK(playlist); | 1207 PLAYLIST_UNLOCK(playlist); |
1210 | 1208 |
1211 playlist_check_pos_current(playlist); | 1209 playlist_check_pos_current(playlist); |
1212 | 1210 |
1213 if (restart_playing) | 1211 if (restart_playing) |
1214 playback_initiate(); | 1212 playback_initiate(); |
1215 | 1213 |
1293 | 1291 |
1294 while (it) { | 1292 while (it) { |
1295 GList *next = g_list_next(it); | 1293 GList *next = g_list_next(it); |
1296 GList *tmp; | 1294 GList *tmp; |
1297 | 1295 |
1298 /* XXX: WTF? --nenolod */ | 1296 /* XXX: WTF? --nenolod */ |
1299 it->data = g_list_nth_data(playlist->entries, GPOINTER_TO_INT(it->data)); | 1297 it->data = g_list_nth_data(playlist->entries, GPOINTER_TO_INT(it->data)); |
1300 if ((tmp = g_list_find(playlist->queue, it->data))) { | 1298 if ((tmp = g_list_find(playlist->queue, it->data))) { |
1301 playlist->queue = g_list_remove_link(playlist->queue, tmp); | 1299 playlist->queue = g_list_remove_link(playlist->queue, tmp); |
1302 g_list_free_1(tmp); | 1300 g_list_free_1(tmp); |
1303 list = g_list_remove_link(list, it); | 1301 list = g_list_remove_link(list, it); |
1462 playlist_eof_reached(Playlist *playlist) | 1460 playlist_eof_reached(Playlist *playlist) |
1463 { | 1461 { |
1464 GList *plist_pos_list; | 1462 GList *plist_pos_list; |
1465 | 1463 |
1466 if ((cfg.no_playlist_advance && !cfg.repeat) || cfg.stopaftersong) | 1464 if ((cfg.no_playlist_advance && !cfg.repeat) || cfg.stopaftersong) |
1467 ip_data.stop = TRUE; | 1465 ip_data.stop = TRUE; |
1468 playback_stop(); | 1466 playback_stop(); |
1469 if ((cfg.no_playlist_advance && !cfg.repeat) || cfg.stopaftersong) | 1467 if ((cfg.no_playlist_advance && !cfg.repeat) || cfg.stopaftersong) |
1470 ip_data.stop = FALSE; | 1468 ip_data.stop = FALSE; |
1471 | 1469 |
1472 hook_call("playback end", playlist->position); | 1470 hook_call("playback end", playlist->position); |
1473 | 1471 |
1474 PLAYLIST_LOCK(playlist); | 1472 PLAYLIST_LOCK(playlist); |
1475 | 1473 |
1476 if ((playlist_position_before_jump != NULL) && playlist->queue == NULL) | 1474 if ((playlist_position_before_jump != NULL) && playlist->queue == NULL) |
1477 { | 1475 { |
1478 playlist->position = playlist_position_before_jump; | 1476 playlist->position = playlist_position_before_jump; |
1479 playlist_position_before_jump = NULL; | 1477 playlist_position_before_jump = NULL; |
1480 } | 1478 } |
1737 { | 1735 { |
1738 PlaylistContainer *plc; | 1736 PlaylistContainer *plc; |
1739 GList *old_iter; | 1737 GList *old_iter; |
1740 gchar *ext; | 1738 gchar *ext; |
1741 gint old_len, new_len; | 1739 gint old_len, new_len; |
1742 | 1740 |
1743 g_return_val_if_fail(playlist != NULL, 0); | 1741 g_return_val_if_fail(playlist != NULL, 0); |
1744 g_return_val_if_fail(filename != NULL, 0); | 1742 g_return_val_if_fail(filename != NULL, 0); |
1745 | 1743 |
1746 ext = strrchr(filename, '.') + 1; | 1744 ext = strrchr(filename, '.') + 1; |
1747 plc = playlist_container_find(ext); | 1745 plc = playlist_container_find(ext); |
1849 else | 1847 else |
1850 mtime = 0; | 1848 mtime = 0; |
1851 | 1849 |
1852 /* FIXME: simplify this logic */ | 1850 /* FIXME: simplify this logic */ |
1853 if ((entry->title == NULL && entry->length == -1) || | 1851 if ((entry->title == NULL && entry->length == -1) || |
1854 (entry->tuple && mtime != 0 && (mtime == -1 || mtime != playlist_get_mtime(entry->filename)))) | 1852 (entry->tuple && mtime != 0 && |
1853 (mtime == -1 || mtime != playlist_get_mtime(entry->filename)))) | |
1855 { | 1854 { |
1856 if (playlist_entry_get_info(entry)) | 1855 if (playlist_entry_get_info(entry)) |
1857 title = entry->title; | 1856 title = entry->title; |
1858 } | 1857 } |
1859 else { | 1858 else { |
1939 | 1938 |
1940 return song_time; | 1939 return song_time; |
1941 } | 1940 } |
1942 | 1941 |
1943 static gint | 1942 static gint |
1944 playlist_compare_track(PlaylistEntry * a, | 1943 playlist_compare_track(PlaylistEntry * a, PlaylistEntry * b) |
1945 PlaylistEntry * b) | |
1946 { | 1944 { |
1947 gint tracknumber_a; | 1945 gint tracknumber_a; |
1948 gint tracknumber_b; | 1946 gint tracknumber_b; |
1949 | 1947 |
1950 g_return_val_if_fail(a != NULL, 0); | 1948 g_return_val_if_fail(a != NULL, 0); |
1962 | 1960 |
1963 tracknumber_a = tuple_get_int(a->tuple, FIELD_TRACK_NUMBER, NULL); | 1961 tracknumber_a = tuple_get_int(a->tuple, FIELD_TRACK_NUMBER, NULL); |
1964 tracknumber_b = tuple_get_int(b->tuple, FIELD_TRACK_NUMBER, NULL); | 1962 tracknumber_b = tuple_get_int(b->tuple, FIELD_TRACK_NUMBER, NULL); |
1965 | 1963 |
1966 return (tracknumber_a && tracknumber_b ? | 1964 return (tracknumber_a && tracknumber_b ? |
1967 tracknumber_a - tracknumber_b : 0); | 1965 tracknumber_a - tracknumber_b : 0); |
1968 } | 1966 } |
1969 | 1967 |
1970 static void | 1968 static void |
1971 playlist_get_entry_title(PlaylistEntry * e, const gchar ** title) | 1969 playlist_get_entry_title(PlaylistEntry * e, const gchar ** title) |
1972 { | 1970 { |
1979 *title = e->filename; | 1977 *title = e->filename; |
1980 } | 1978 } |
1981 } | 1979 } |
1982 | 1980 |
1983 static gint | 1981 static gint |
1984 playlist_compare_playlist(PlaylistEntry * a, | 1982 playlist_compare_playlist(PlaylistEntry * a, PlaylistEntry * b) |
1985 PlaylistEntry * b) | |
1986 { | 1983 { |
1987 const gchar *a_title = NULL, *b_title = NULL; | 1984 const gchar *a_title = NULL, *b_title = NULL; |
1988 | 1985 |
1989 g_return_val_if_fail(a != NULL, 0); | 1986 g_return_val_if_fail(a != NULL, 0); |
1990 g_return_val_if_fail(b != NULL, 0); | 1987 g_return_val_if_fail(b != NULL, 0); |
1991 | 1988 |
1992 playlist_get_entry_title(a, &a_title); | 1989 playlist_get_entry_title(a, &a_title); |
1993 playlist_get_entry_title(b, &b_title); | 1990 playlist_get_entry_title(b, &b_title); |
1994 | 1991 |
1995 return strcasecmp(a_title, b_title); | 1992 return strcasecmp(a_title, b_title); |
1996 } | 1993 } |
2155 | 2152 |
2156 rv = stat(a->filename, &buf); | 2153 rv = stat(a->filename, &buf); |
2157 | 2154 |
2158 if (rv == 0) { | 2155 if (rv == 0) { |
2159 modtime = buf.st_mtime; | 2156 modtime = buf.st_mtime; |
2160 rv = stat(b->filename, &buf); | 2157 rv = stat(b->filename, &buf); |
2161 | 2158 |
2162 if (stat(b->filename, &buf) == 0) { | 2159 if (stat(b->filename, &buf) == 0) { |
2163 if (buf.st_mtime == modtime) | 2160 if (buf.st_mtime == modtime) |
2164 return 0; | 2161 return 0; |
2165 else | 2162 else |
2166 return (buf.st_mtime - modtime) > 0 ? -1 : 1; | 2163 return (buf.st_mtime - modtime) > 0 ? -1 : 1; |
2422 playlist_get_info_scan_active) { | 2419 playlist_get_info_scan_active) { |
2423 | 2420 |
2424 for (node = playlist->entries; node; node = g_list_next(node)) { | 2421 for (node = playlist->entries; node; node = g_list_next(node)) { |
2425 entry = node->data; | 2422 entry = node->data; |
2426 | 2423 |
2427 if(playlist->attribute & PLAYLIST_STATIC || // live lock fix | 2424 if (playlist->attribute & PLAYLIST_STATIC || // live lock fix |
2428 (entry->tuple && tuple_get_int(entry->tuple, FIELD_LENGTH, NULL) > -1 && | 2425 (entry->tuple && |
2429 tuple_get_int(entry->tuple, FIELD_MTIME, NULL) != -1 && entry->title_is_valid)) { | 2426 tuple_get_int(entry->tuple, FIELD_LENGTH, NULL) > -1 && |
2427 tuple_get_int(entry->tuple, FIELD_MTIME, NULL) != -1 && | |
2428 entry->title_is_valid)) | |
2429 { | |
2430 update_playlistwin = TRUE; | 2430 update_playlistwin = TRUE; |
2431 continue; | 2431 continue; |
2432 } | 2432 } |
2433 | 2433 |
2434 if (!playlist_entry_get_info(entry)) { | 2434 if (!playlist_entry_get_info(entry) && |
2435 if (g_list_index(playlist->entries, entry) == -1) | 2435 g_list_index(playlist->entries, entry) == -1) |
2436 /* Entry disappeared while we looked it up. | 2436 /* Entry disappeared while we looked it up. |
2437 Restart. */ | 2437 Restart. */ |
2438 node = playlist->entries; | 2438 node = playlist->entries; |
2439 } | |
2440 else if ((entry->tuple != NULL || entry->title != NULL) && | 2439 else if ((entry->tuple != NULL || entry->title != NULL) && |
2441 tuple_get_int(entry->tuple, FIELD_LENGTH, NULL) > -1 && | 2440 tuple_get_int(entry->tuple, FIELD_LENGTH, NULL) > -1 && |
2442 tuple_get_int(entry->tuple, FIELD_MTIME, NULL) != -1) { | 2441 tuple_get_int(entry->tuple, FIELD_MTIME, NULL) != -1) |
2442 { | |
2443 update_playlistwin = TRUE; | 2443 update_playlistwin = TRUE; |
2444 break; /* hmmm... --asphyx */ | 2444 break; /* hmmm... --asphyx */ |
2445 } | 2445 } |
2446 } | 2446 } |
2447 | 2447 |
2448 if (!node) { | 2448 if (!node) { |
2449 g_mutex_lock(mutex_scan); | 2449 g_mutex_lock(mutex_scan); |
2450 playlist_get_info_scan_active = FALSE; | 2450 playlist_get_info_scan_active = FALSE; |
2451 g_mutex_unlock(mutex_scan); | 2451 g_mutex_unlock(mutex_scan); |
2452 } | 2452 } |
2465 | 2465 |
2466 for (node = g_list_nth(playlist->entries, playlistwin_get_toprow()); | 2466 for (node = g_list_nth(playlist->entries, playlistwin_get_toprow()); |
2467 node && playlistwin_item_visible(g_list_position(playlist->entries, node)); | 2467 node && playlistwin_item_visible(g_list_position(playlist->entries, node)); |
2468 node = g_list_next(node)) { | 2468 node = g_list_next(node)) { |
2469 | 2469 |
2470 entry = node->data; | 2470 entry = node->data; |
2471 | 2471 |
2472 if(playlist->attribute & PLAYLIST_STATIC || | 2472 if (playlist->attribute & PLAYLIST_STATIC || |
2473 (entry->tuple && tuple_get_int(entry->tuple, FIELD_LENGTH, NULL) > -1 && | 2473 (entry->tuple && |
2474 tuple_get_int(entry->tuple, FIELD_MTIME, NULL) != -1 && entry->title_is_valid)) { | 2474 tuple_get_int(entry->tuple, FIELD_LENGTH, NULL) > -1 && |
2475 tuple_get_int(entry->tuple, FIELD_MTIME, NULL) != -1 && | |
2476 entry->title_is_valid)) | |
2475 continue; | 2477 continue; |
2476 } | 2478 |
2477 | 2479 AUDDBG("len=%d mtime=%d\n", |
2478 AUDDBG("len=%d mtime=%d\n", | 2480 tuple_get_int(entry->tuple, FIELD_LENGTH, NULL), |
2479 tuple_get_int(entry->tuple, FIELD_LENGTH, NULL), | 2481 tuple_get_int(entry->tuple, FIELD_MTIME, NULL)); |
2480 tuple_get_int(entry->tuple, FIELD_MTIME, NULL)); | 2482 |
2481 | 2483 if (!playlist_entry_get_info(entry)) { |
2482 if (!playlist_entry_get_info(entry)) { | 2484 if (g_list_index(playlist->entries, entry) == -1) |
2483 if (g_list_index(playlist->entries, entry) == -1) | |
2484 /* Entry disapeared while we | 2485 /* Entry disapeared while we |
2485 looked it up. Restart. */ | 2486 looked it up. Restart. */ |
2486 node = g_list_nth(playlist->entries, | 2487 node = g_list_nth(playlist->entries, |
2487 playlistwin_get_toprow()); | 2488 playlistwin_get_toprow()); |
2488 } | 2489 } |
2489 else if ((entry->tuple != NULL || entry->title != NULL) && | 2490 else if ((entry->tuple != NULL || entry->title != NULL) && |
2490 tuple_get_int(entry->tuple, FIELD_LENGTH, NULL) > -1 && | 2491 tuple_get_int(entry->tuple, FIELD_LENGTH, NULL) > -1 && |
2491 tuple_get_int(entry->tuple, FIELD_MTIME, NULL) != -1) { | 2492 tuple_get_int(entry->tuple, FIELD_MTIME, NULL) != -1) { |
2492 update_playlistwin = TRUE; | 2493 update_playlistwin = TRUE; |
2493 } | 2494 } |
2494 } | 2495 } |
2495 } // on_demand | 2496 } // on_demand |
2496 | 2497 |
2497 else if (cfg.get_info_on_demand && | 2498 else if (cfg.get_info_on_demand && |
2498 (!cfg.playlist_visible || cfg.playlist_shaded || !cfg.use_pl_metadata)) | 2499 (!cfg.playlist_visible || cfg.playlist_shaded || !cfg.use_pl_metadata)) |
2515 event_queue("playlistwin update list", playlist); | 2516 event_queue("playlistwin update list", playlist); |
2516 PLAYLIST_INCR_SERIAL(playlist); | 2517 PLAYLIST_INCR_SERIAL(playlist); |
2517 update_playlistwin = FALSE; | 2518 update_playlistwin = FALSE; |
2518 } | 2519 } |
2519 | 2520 |
2520 if (playlist_get_info_scan_active) { | 2521 if (playlist_get_info_scan_active) |
2521 continue; | 2522 continue; |
2522 } | |
2523 | 2523 |
2524 g_mutex_lock(mutex_scan); | 2524 g_mutex_lock(mutex_scan); |
2525 g_cond_wait(cond_scan, mutex_scan); | 2525 g_cond_wait(cond_scan, mutex_scan); |
2526 g_mutex_unlock(mutex_scan); | 2526 g_mutex_unlock(mutex_scan); |
2527 | 2527 |
2528 // AUDDBG("scanner invoked\n"); | 2528 // AUDDBG("scanner invoked\n"); |
2529 | 2529 |
2530 } // while | 2530 } // while |
2531 | 2531 |
2532 g_thread_exit(NULL); | 2532 g_thread_exit(NULL); |
2533 return NULL; | 2533 return NULL; |
2570 playlist_update_all_titles(void) /* update titles after format changing --asphyx */ | 2570 playlist_update_all_titles(void) /* update titles after format changing --asphyx */ |
2571 { | 2571 { |
2572 PlaylistEntry *entry; | 2572 PlaylistEntry *entry; |
2573 GList *node; | 2573 GList *node; |
2574 Playlist *playlist = playlist_get_active(); | 2574 Playlist *playlist = playlist_get_active(); |
2575 | 2575 |
2576 AUDDBG("invalidating titles\n"); | 2576 AUDDBG("invalidating titles\n"); |
2577 PLAYLIST_LOCK(playlist); | 2577 PLAYLIST_LOCK(playlist); |
2578 for (node = playlist->entries; node; node = g_list_next(node)) { | 2578 for (node = playlist->entries; node; node = g_list_next(node)) { |
2579 entry = node->data; | 2579 entry = node->data; |
2580 entry->title_is_valid = FALSE; | 2580 entry->title_is_valid = FALSE; |
2618 } | 2618 } |
2619 | 2619 |
2620 playlist_entry_free(entry); | 2620 playlist_entry_free(entry); |
2621 playlist->entries = g_list_delete_link(playlist->entries, node); | 2621 playlist->entries = g_list_delete_link(playlist->entries, node); |
2622 } | 2622 } |
2623 | 2623 |
2624 PLAYLIST_UNLOCK(playlist); | 2624 PLAYLIST_UNLOCK(playlist); |
2625 | 2625 |
2626 playlist_generate_shuffle_list(playlist); | 2626 playlist_generate_shuffle_list(playlist); |
2627 playlistwin_update_list(playlist); | 2627 playlistwin_update_list(playlist); |
2628 playlist_recalc_total_time(playlist); | 2628 playlist_recalc_total_time(playlist); |
2629 PLAYLIST_INCR_SERIAL(playlist); | 2629 PLAYLIST_INCR_SERIAL(playlist); |
2630 playlist_manager_update(); | 2630 playlist_manager_update(); |
2683 GList *node_cmp, *next_node_cmp; | 2683 GList *node_cmp, *next_node_cmp; |
2684 gint (*dups_compare_func)(PlaylistEntry * , PlaylistEntry *); | 2684 gint (*dups_compare_func)(PlaylistEntry * , PlaylistEntry *); |
2685 | 2685 |
2686 switch ( type ) | 2686 switch ( type ) |
2687 { | 2687 { |
2688 case PLAYLIST_DUPS_TITLE: | 2688 case PLAYLIST_DUPS_TITLE: |
2689 dups_compare_func = playlist_dupscmp_title; | 2689 dups_compare_func = playlist_dupscmp_title; |
2690 break; | 2690 break; |
2691 case PLAYLIST_DUPS_PATH: | 2691 case PLAYLIST_DUPS_PATH: |
2692 dups_compare_func = playlist_dupscmp_path; | 2692 dups_compare_func = playlist_dupscmp_path; |
2693 break; | 2693 break; |
2694 case PLAYLIST_DUPS_FILENAME: | 2694 case PLAYLIST_DUPS_FILENAME: |
2695 default: | 2695 default: |
2696 dups_compare_func = playlist_dupscmp_filename; | 2696 dups_compare_func = playlist_dupscmp_filename; |
2697 break; | 2697 break; |
2698 } | 2698 } |
2699 | 2699 |
2700 PLAYLIST_LOCK(playlist); | 2700 PLAYLIST_LOCK(playlist); |
2701 | 2701 |
2702 for (node = playlist->entries; node; node = next_node) { | 2702 for (node = playlist->entries; node; node = next_node) { |
2751 playlist_manager_update(); | 2751 playlist_manager_update(); |
2752 } | 2752 } |
2753 | 2753 |
2754 void | 2754 void |
2755 playlist_get_total_time(Playlist * playlist, | 2755 playlist_get_total_time(Playlist * playlist, |
2756 gulong * total_time, | 2756 gulong * total_time, |
2757 gulong * selection_time, | 2757 gulong * selection_time, |
2758 gboolean * total_more, | 2758 gboolean * total_more, |
2759 gboolean * selection_more) | 2759 gboolean * selection_more) |
2760 { | 2760 { |
2761 PLAYLIST_LOCK(playlist); | 2761 PLAYLIST_LOCK(playlist); |
2830 /* match by track_name */ | 2830 /* match by track_name */ |
2831 regex_t regex; | 2831 regex_t regex; |
2832 #if defined(USE_REGEX_PCRE) | 2832 #if defined(USE_REGEX_PCRE) |
2833 if ( regcomp( ®ex , regex_pattern , REG_NOSUB | REG_ICASE | REG_UTF8 ) == 0 ) | 2833 if ( regcomp( ®ex , regex_pattern , REG_NOSUB | REG_ICASE | REG_UTF8 ) == 0 ) |
2834 #else | 2834 #else |
2835 if ( regcomp( ®ex , regex_pattern , REG_NOSUB | REG_ICASE ) == 0 ) | 2835 if ( regcomp( ®ex , regex_pattern , REG_NOSUB | REG_ICASE ) == 0 ) |
2836 #endif | 2836 #endif |
2837 { | |
2838 GList *tfound_list = NULL; | |
2839 if ( is_first_search == TRUE ) entry_list = playlist->entries; | |
2840 else entry_list = found_list; /* use found_list */ | |
2841 for ( ; entry_list ; entry_list = g_list_next(entry_list) ) | |
2842 { | 2837 { |
2843 PlaylistEntry *entry = entry_list->data; | 2838 GList *tfound_list = NULL; |
2844 if ( entry->tuple != NULL ) | 2839 if ( is_first_search == TRUE ) entry_list = playlist->entries; |
2840 else entry_list = found_list; /* use found_list */ | |
2841 for ( ; entry_list ; entry_list = g_list_next(entry_list) ) | |
2845 { | 2842 { |
2846 track_name = tuple_get_string( entry->tuple, FIELD_TITLE, NULL ); | 2843 PlaylistEntry *entry = entry_list->data; |
2847 if (( track_name != NULL ) && | 2844 if ( entry->tuple != NULL ) |
2848 ( regexec( ®ex , track_name , 0 , NULL , 0 ) == 0 ) ) | 2845 { |
2849 { | 2846 track_name = tuple_get_string( entry->tuple, FIELD_TITLE, NULL ); |
2850 tfound_list = g_list_append( tfound_list , entry ); | 2847 if (( track_name != NULL ) && |
2851 } | 2848 ( regexec( ®ex , track_name , 0 , NULL , 0 ) == 0 ) ) |
2849 { | |
2850 tfound_list = g_list_append( tfound_list , entry ); | |
2851 } | |
2852 } | |
2852 } | 2853 } |
2854 g_list_free( found_list ); /* wipe old found_list */ | |
2855 found_list = tfound_list; /* move tfound_list in found_list */ | |
2856 regfree( ®ex ); | |
2853 } | 2857 } |
2854 g_list_free( found_list ); /* wipe old found_list */ | |
2855 found_list = tfound_list; /* move tfound_list in found_list */ | |
2856 regfree( ®ex ); | |
2857 } | |
2858 is_first_search = FALSE; | 2858 is_first_search = FALSE; |
2859 } | 2859 } |
2860 | 2860 |
2861 if ( (regex_pattern = tuple_get_string(tuple, FIELD_ALBUM, NULL)) != NULL && | 2861 if ( (regex_pattern = tuple_get_string(tuple, FIELD_ALBUM, NULL)) != NULL && |
2862 (*regex_pattern != '\0') ) | 2862 (*regex_pattern != '\0') ) |
2864 /* match by album_name */ | 2864 /* match by album_name */ |
2865 regex_t regex; | 2865 regex_t regex; |
2866 #if defined(USE_REGEX_PCRE) | 2866 #if defined(USE_REGEX_PCRE) |
2867 if ( regcomp( ®ex , regex_pattern , REG_NOSUB | REG_ICASE | REG_UTF8 ) == 0 ) | 2867 if ( regcomp( ®ex , regex_pattern , REG_NOSUB | REG_ICASE | REG_UTF8 ) == 0 ) |
2868 #else | 2868 #else |
2869 if ( regcomp( ®ex , regex_pattern , REG_NOSUB | REG_ICASE ) == 0 ) | 2869 if ( regcomp( ®ex , regex_pattern , REG_NOSUB | REG_ICASE ) == 0 ) |
2870 #endif | 2870 #endif |
2871 { | |
2872 GList *tfound_list = NULL; | |
2873 if ( is_first_search == TRUE ) entry_list = playlist->entries; | |
2874 else entry_list = found_list; /* use found_list */ | |
2875 for ( ; entry_list ; entry_list = g_list_next(entry_list) ) | |
2876 { | 2871 { |
2877 PlaylistEntry *entry = entry_list->data; | 2872 GList *tfound_list = NULL; |
2878 if ( entry->tuple != NULL ) | 2873 if ( is_first_search == TRUE ) entry_list = playlist->entries; |
2874 else entry_list = found_list; /* use found_list */ | |
2875 for ( ; entry_list ; entry_list = g_list_next(entry_list) ) | |
2879 { | 2876 { |
2880 album_name = tuple_get_string( entry->tuple, FIELD_ALBUM, NULL ); | 2877 PlaylistEntry *entry = entry_list->data; |
2881 if ( ( album_name != NULL ) && | 2878 if ( entry->tuple != NULL ) |
2882 ( regexec( ®ex , album_name , 0 , NULL , 0 ) == 0 ) ) | |
2883 { | 2879 { |
2884 tfound_list = g_list_append( tfound_list , entry ); | 2880 album_name = tuple_get_string( entry->tuple, FIELD_ALBUM, NULL ); |
2881 if ( ( album_name != NULL ) && | |
2882 ( regexec( ®ex , album_name , 0 , NULL , 0 ) == 0 ) ) | |
2883 { | |
2884 tfound_list = g_list_append( tfound_list , entry ); | |
2885 } | |
2885 } | 2886 } |
2886 } | 2887 } |
2888 g_list_free( found_list ); /* wipe old found_list */ | |
2889 found_list = tfound_list; /* move tfound_list in found_list */ | |
2890 regfree( ®ex ); | |
2887 } | 2891 } |
2888 g_list_free( found_list ); /* wipe old found_list */ | |
2889 found_list = tfound_list; /* move tfound_list in found_list */ | |
2890 regfree( ®ex ); | |
2891 } | |
2892 is_first_search = FALSE; | 2892 is_first_search = FALSE; |
2893 } | 2893 } |
2894 | 2894 |
2895 if ( (regex_pattern = tuple_get_string(tuple, FIELD_ARTIST, NULL)) != NULL && | 2895 if ( (regex_pattern = tuple_get_string(tuple, FIELD_ARTIST, NULL)) != NULL && |
2896 (*regex_pattern != '\0') ) | 2896 (*regex_pattern != '\0') ) |
2898 /* match by performer */ | 2898 /* match by performer */ |
2899 regex_t regex; | 2899 regex_t regex; |
2900 #if defined(USE_REGEX_PCRE) | 2900 #if defined(USE_REGEX_PCRE) |
2901 if ( regcomp( ®ex , regex_pattern , REG_NOSUB | REG_ICASE | REG_UTF8 ) == 0 ) | 2901 if ( regcomp( ®ex , regex_pattern , REG_NOSUB | REG_ICASE | REG_UTF8 ) == 0 ) |
2902 #else | 2902 #else |
2903 if ( regcomp( ®ex , regex_pattern , REG_NOSUB | REG_ICASE ) == 0 ) | 2903 if ( regcomp( ®ex , regex_pattern , REG_NOSUB | REG_ICASE ) == 0 ) |
2904 #endif | 2904 #endif |
2905 { | |
2906 GList *tfound_list = NULL; | |
2907 if ( is_first_search == TRUE ) entry_list = playlist->entries; | |
2908 else entry_list = found_list; /* use found_list */ | |
2909 for ( ; entry_list ; entry_list = g_list_next(entry_list) ) | |
2910 { | 2905 { |
2911 PlaylistEntry *entry = entry_list->data; | 2906 GList *tfound_list = NULL; |
2912 if ( entry->tuple != NULL ) | 2907 if ( is_first_search == TRUE ) entry_list = playlist->entries; |
2908 else entry_list = found_list; /* use found_list */ | |
2909 for ( ; entry_list ; entry_list = g_list_next(entry_list) ) | |
2913 { | 2910 { |
2914 performer = tuple_get_string( entry->tuple, FIELD_ARTIST, NULL ); | 2911 PlaylistEntry *entry = entry_list->data; |
2915 if ( ( entry->tuple != NULL ) && ( performer != NULL ) && | 2912 if ( entry->tuple != NULL ) |
2916 ( regexec( ®ex , performer , 0 , NULL , 0 ) == 0 ) ) | |
2917 { | 2913 { |
2918 tfound_list = g_list_append( tfound_list , entry ); | 2914 performer = tuple_get_string( entry->tuple, FIELD_ARTIST, NULL ); |
2915 if ( ( entry->tuple != NULL ) && ( performer != NULL ) && | |
2916 ( regexec( ®ex , performer , 0 , NULL , 0 ) == 0 ) ) | |
2917 { | |
2918 tfound_list = g_list_append( tfound_list , entry ); | |
2919 } | |
2919 } | 2920 } |
2920 } | 2921 } |
2922 g_list_free( found_list ); /* wipe old found_list */ | |
2923 found_list = tfound_list; /* move tfound_list in found_list */ | |
2924 regfree( ®ex ); | |
2921 } | 2925 } |
2922 g_list_free( found_list ); /* wipe old found_list */ | |
2923 found_list = tfound_list; /* move tfound_list in found_list */ | |
2924 regfree( ®ex ); | |
2925 } | |
2926 is_first_search = FALSE; | 2926 is_first_search = FALSE; |
2927 } | 2927 } |
2928 | 2928 |
2929 if ( (regex_pattern = tuple_get_string(tuple, FIELD_FILE_NAME, NULL)) != NULL && | 2929 if ( (regex_pattern = tuple_get_string(tuple, FIELD_FILE_NAME, NULL)) != NULL && |
2930 (*regex_pattern != '\0') ) | 2930 (*regex_pattern != '\0') ) |
2932 /* match by file_name */ | 2932 /* match by file_name */ |
2933 regex_t regex; | 2933 regex_t regex; |
2934 #if defined(USE_REGEX_PCRE) | 2934 #if defined(USE_REGEX_PCRE) |
2935 if ( regcomp( ®ex , regex_pattern , REG_NOSUB | REG_ICASE | REG_UTF8 ) == 0 ) | 2935 if ( regcomp( ®ex , regex_pattern , REG_NOSUB | REG_ICASE | REG_UTF8 ) == 0 ) |
2936 #else | 2936 #else |
2937 if ( regcomp( ®ex , regex_pattern , REG_NOSUB | REG_ICASE ) == 0 ) | 2937 if ( regcomp( ®ex , regex_pattern , REG_NOSUB | REG_ICASE ) == 0 ) |
2938 #endif | 2938 #endif |
2939 { | |
2940 GList *tfound_list = NULL; | |
2941 if ( is_first_search == TRUE ) entry_list = playlist->entries; | |
2942 else entry_list = found_list; /* use found_list */ | |
2943 for ( ; entry_list ; entry_list = g_list_next(entry_list) ) | |
2944 { | 2939 { |
2945 PlaylistEntry *entry = entry_list->data; | 2940 GList *tfound_list = NULL; |
2946 if ( entry->tuple != NULL ) | 2941 if ( is_first_search == TRUE ) entry_list = playlist->entries; |
2942 else entry_list = found_list; /* use found_list */ | |
2943 for ( ; entry_list ; entry_list = g_list_next(entry_list) ) | |
2947 { | 2944 { |
2948 file_name = tuple_get_string( entry->tuple, FIELD_FILE_NAME, NULL ); | 2945 PlaylistEntry *entry = entry_list->data; |
2949 if ( ( file_name != NULL ) && | 2946 if ( entry->tuple != NULL ) |
2950 ( regexec( ®ex , file_name , 0 , NULL , 0 ) == 0 ) ) | |
2951 { | 2947 { |
2952 tfound_list = g_list_append( tfound_list , entry ); | 2948 file_name = tuple_get_string( entry->tuple, FIELD_FILE_NAME, NULL ); |
2949 if ( ( file_name != NULL ) && | |
2950 ( regexec( ®ex , file_name , 0 , NULL , 0 ) == 0 ) ) | |
2951 { | |
2952 tfound_list = g_list_append( tfound_list , entry ); | |
2953 } | |
2953 } | 2954 } |
2954 } | 2955 } |
2956 g_list_free( found_list ); /* wipe old found_list */ | |
2957 found_list = tfound_list; /* move tfound_list in found_list */ | |
2958 regfree( ®ex ); | |
2955 } | 2959 } |
2956 g_list_free( found_list ); /* wipe old found_list */ | |
2957 found_list = tfound_list; /* move tfound_list in found_list */ | |
2958 regfree( ®ex ); | |
2959 } | |
2960 is_first_search = FALSE; | 2960 is_first_search = FALSE; |
2961 } | 2961 } |
2962 | 2962 |
2963 /* NOTE: action = 0 -> default behaviour, select all matching entries */ | 2963 /* NOTE: action = 0 -> default behaviour, select all matching entries */ |
2964 /* if some entries are still in found_list, those | 2964 /* if some entries are still in found_list, those |
2972 | 2972 |
2973 g_list_free( found_list ); | 2973 g_list_free( found_list ); |
2974 | 2974 |
2975 PLAYLIST_UNLOCK(playlist); | 2975 PLAYLIST_UNLOCK(playlist); |
2976 playlist_recalc_total_time(playlist); | 2976 playlist_recalc_total_time(playlist); |
2977 // PLAYLIST_INCR_SERIAL(playlist); //unnecessary? --yaz | 2977 // PLAYLIST_INCR_SERIAL(playlist); //unnecessary? --yaz |
2978 | 2978 |
2979 return num_of_entries_found; | 2979 return num_of_entries_found; |
2980 } | 2980 } |
2981 | 2981 |
2982 void | 2982 void |
3071 retval = TRUE; | 3071 retval = TRUE; |
3072 | 3072 |
3073 str_replace_in(&entry->title, NULL); | 3073 str_replace_in(&entry->title, NULL); |
3074 entry->length = -1; | 3074 entry->length = -1; |
3075 | 3075 |
3076 /* invalidate mtime to reread */ | 3076 /* invalidate mtime to reread */ |
3077 if (entry->tuple != NULL) | 3077 if (entry->tuple != NULL) |
3078 tuple_associate_int(entry->tuple, FIELD_MTIME, NULL, -1); /* -1 denotes "non-initialized". now 0 is for stream etc. yaz */ | 3078 tuple_associate_int(entry->tuple, FIELD_MTIME, NULL, -1); /* -1 denotes "non-initialized". now 0 is for stream etc. yaz */ |
3079 | 3079 |
3080 if (!playlist_entry_get_info(entry)) { | 3080 if (!playlist_entry_get_info(entry)) { |
3081 if (g_list_index(playlist->entries, entry) == -1) | 3081 if (g_list_index(playlist->entries, entry) == -1) |
3082 /* Entry disappeared while we looked it up. Restart. */ | 3082 /* Entry disappeared while we looked it up. Restart. */ |
3272 gint rv; | 3272 gint rv; |
3273 GList **lhandle, *node; | 3273 GList **lhandle, *node; |
3274 InputPlugin *ip; | 3274 InputPlugin *ip; |
3275 | 3275 |
3276 g_return_val_if_fail(uri != NULL, EXT_FALSE); | 3276 g_return_val_if_fail(uri != NULL, EXT_FALSE); |
3277 | 3277 |
3278 /* Some URIs will end in ?<subsong> to determine the subsong requested. */ | 3278 /* Some URIs will end in ?<subsong> to determine the subsong requested. */ |
3279 tmp_uri = g_strdup(uri); | 3279 tmp_uri = g_strdup(uri); |
3280 tmp = strrchr(tmp_uri, '?'); | 3280 tmp = strrchr(tmp_uri, '?'); |
3281 | 3281 |
3282 if (tmp != NULL && g_ascii_isdigit(*(tmp + 1))) | 3282 if (tmp != NULL && g_ascii_isdigit(*(tmp + 1))) |
3286 /* cue:// cdda:// tone:// tact:// */ | 3286 /* cue:// cdda:// tone:// tact:// */ |
3287 if ((ip = uri_get_plugin(tmp_uri)) != NULL && ip->enabled) { | 3287 if ((ip = uri_get_plugin(tmp_uri)) != NULL && ip->enabled) { |
3288 g_free(tmp_uri); | 3288 g_free(tmp_uri); |
3289 return EXT_CUSTOM; | 3289 return EXT_CUSTOM; |
3290 } | 3290 } |
3291 | 3291 |
3292 tmp = g_filename_from_uri(tmp_uri, NULL, NULL); | 3292 tmp = g_filename_from_uri(tmp_uri, NULL, NULL); |
3293 filename = g_strdup(tmp ? tmp : tmp_uri); | 3293 filename = g_strdup(tmp ? tmp : tmp_uri); |
3294 g_free(tmp); tmp = NULL; | 3294 g_free(tmp); tmp = NULL; |
3295 g_free(tmp_uri); tmp_uri = NULL; | 3295 g_free(tmp_uri); tmp_uri = NULL; |
3296 | 3296 |