Mercurial > audlegacy
comparison src/audacious/playlist.c @ 3635:b20e98407a30
Cosmetics.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 25 Sep 2007 23:06:26 +0300 |
parents | 8c4633438785 |
children | 65b750891387 |
comparison
equal
deleted
inserted
replaced
3634:1f7c00c1de22 | 3635:b20e98407a30 |
---|---|
203 | 203 |
204 if (str_has_prefix_nocase(entry->filename, "http:") && | 204 if (str_has_prefix_nocase(entry->filename, "http:") && |
205 g_thread_self() != playlist_get_info_thread) | 205 g_thread_self() != playlist_get_info_thread) |
206 return FALSE; | 206 return FALSE; |
207 | 207 |
208 if (entry->decoder == NULL) | 208 if (entry->decoder == NULL) { |
209 { | |
210 pr = input_check_file(entry->filename, FALSE); | 209 pr = input_check_file(entry->filename, FALSE); |
211 if (pr) | 210 if (pr) |
212 entry->decoder = pr->ip; | 211 entry->decoder = pr->ip; |
213 } | 212 } |
214 | 213 |
215 /* renew tuple if file mtime is newer than tuple mtime. */ | 214 /* renew tuple if file mtime is newer than tuple mtime. */ |
216 if(entry->tuple){ | 215 if (entry->tuple){ |
217 if(tuple_get_int(entry->tuple, FIELD_MTIME, NULL) == modtime) | 216 if (tuple_get_int(entry->tuple, FIELD_MTIME, NULL) == modtime) |
218 return TRUE; | 217 return TRUE; |
219 else { | 218 else { |
220 mowgli_object_unref(entry->tuple); | 219 mowgli_object_unref(entry->tuple); |
221 entry->tuple = NULL; | 220 entry->tuple = NULL; |
222 } | 221 } |
369 /* This function now sets the playlist title, not the playlist filename. | 368 /* This function now sets the playlist title, not the playlist filename. |
370 * See playlist_filename_set */ | 369 * See playlist_filename_set */ |
371 gboolean | 370 gboolean |
372 playlist_set_current_name(Playlist *playlist, const gchar * title) | 371 playlist_set_current_name(Playlist *playlist, const gchar * title) |
373 { | 372 { |
374 gchar *oldtitle; | 373 gchar *oldtitle = playlist->title; |
375 oldtitle = playlist->title; | |
376 | 374 |
377 if (!title) { | 375 if (!title) { |
378 playlist->title = NULL; | 376 playlist->title = NULL; |
379 if(oldtitle) g_free(oldtitle); | 377 g_free(oldtitle); |
380 playlist_manager_update(); | 378 playlist_manager_update(); |
381 return FALSE; | 379 return FALSE; |
382 } | 380 } |
383 | 381 |
384 playlist->title = str_to_utf8(title); | 382 playlist->title = str_to_utf8(title); |
385 if(oldtitle) g_free(oldtitle); | 383 g_free(oldtitle); |
386 playlist_manager_update(); | 384 playlist_manager_update(); |
387 return TRUE; | 385 return TRUE; |
388 } | 386 } |
389 | 387 |
390 /* Setting the filename allows the original playlist to be modified later */ | 388 /* Setting the filename allows the original playlist to be modified later */ |
392 playlist_filename_set(Playlist *playlist, const gchar * filename) | 390 playlist_filename_set(Playlist *playlist, const gchar * filename) |
393 { | 391 { |
394 gchar *old; | 392 gchar *old; |
395 old = playlist->filename; | 393 old = playlist->filename; |
396 | 394 |
397 if(!filename) { | 395 if (!filename) { |
398 playlist->filename = NULL; | 396 playlist->filename = NULL; |
399 if(old) g_free(old); | 397 g_free(old); |
400 return FALSE; | 398 return FALSE; |
401 } | 399 } |
402 | 400 |
403 playlist->filename = filename_to_utf8(filename); | 401 playlist->filename = filename_to_utf8(filename); |
404 if(old) g_free(old); | 402 g_free(old); |
405 return TRUE; | 403 return TRUE; |
406 } | 404 } |
407 | 405 |
408 gchar * | 406 gchar * |
409 playlist_filename_get(Playlist *playlist) | 407 playlist_filename_get(Playlist *playlist) |
410 { | 408 { |
411 if(!playlist->filename) return NULL; | 409 if (!playlist->filename) return NULL; |
412 return g_filename_from_utf8(playlist->filename, -1, NULL, NULL, NULL); | 410 return g_filename_from_utf8(playlist->filename, -1, NULL, NULL, NULL); |
413 } | 411 } |
414 | 412 |
415 static GList * | 413 static GList * |
416 find_playlist_position_list(Playlist *playlist) | 414 find_playlist_position_list(Playlist *playlist) |
433 static void | 431 static void |
434 play_queued(Playlist *playlist) | 432 play_queued(Playlist *playlist) |
435 { | 433 { |
436 GList *tmp = playlist->queue; | 434 GList *tmp = playlist->queue; |
437 | 435 |
438 REQUIRE_LOCK( playlist->mutex ); | 436 REQUIRE_LOCK(playlist->mutex); |
439 | 437 |
440 playlist->position = playlist->queue->data; | 438 playlist->position = playlist->queue->data; |
441 playlist->queue = g_list_remove_link(playlist->queue, playlist->queue); | 439 playlist->queue = g_list_remove_link(playlist->queue, playlist->queue); |
442 g_list_free_1(tmp); | 440 g_list_free_1(tmp); |
443 } | 441 } |
554 | 552 |
555 playlistwin_update_list(playlist); | 553 playlistwin_update_list(playlist); |
556 if (restart_playing) { | 554 if (restart_playing) { |
557 if (playlist->position) | 555 if (playlist->position) |
558 playback_initiate(); | 556 playback_initiate(); |
559 else { | 557 else |
560 mainwin_clear_song_info(); | 558 mainwin_clear_song_info(); |
561 } | |
562 } | 559 } |
563 | 560 |
564 playlist_manager_update(); | 561 playlist_manager_update(); |
565 } | 562 } |
566 | 563 |
592 playlistwin_update_list(playlist); | 589 playlistwin_update_list(playlist); |
593 | 590 |
594 if (restart_playing) { | 591 if (restart_playing) { |
595 if (playlist->position) | 592 if (playlist->position) |
596 playback_initiate(); | 593 playback_initiate(); |
597 else { | 594 else |
598 mainwin_clear_song_info(); | 595 mainwin_clear_song_info(); |
599 } | |
600 } | 596 } |
601 | 597 |
602 playlist_manager_update(); | 598 playlist_manager_update(); |
603 } | 599 } |
604 | 600 |
632 playlist_recalc_total_time(playlist); | 628 playlist_recalc_total_time(playlist); |
633 | 629 |
634 if (restart_playing) { | 630 if (restart_playing) { |
635 if (playlist->position) | 631 if (playlist->position) |
636 playback_initiate(); | 632 playback_initiate(); |
637 else { | 633 else |
638 mainwin_clear_song_info(); | 634 mainwin_clear_song_info(); |
639 } | |
640 } | 635 } |
641 | 636 |
642 playlistwin_update_list(playlist); | 637 playlistwin_update_list(playlist); |
643 playlist_manager_update(); | 638 playlist_manager_update(); |
644 } | 639 } |
672 Tuple *tuple, | 667 Tuple *tuple, |
673 InputPlugin * dec) | 668 InputPlugin * dec) |
674 { | 669 { |
675 PlaylistEntry *entry; | 670 PlaylistEntry *entry; |
676 Tuple *main_tuple = NULL; | 671 Tuple *main_tuple = NULL; |
677 gint subtunes_num = 0, i = 0; | 672 gint nsubtunes = 0, i = 0; |
678 | 673 |
679 g_return_if_fail(playlist != NULL); | 674 g_return_if_fail(playlist != NULL); |
680 g_return_if_fail(filename != NULL); | 675 g_return_if_fail(filename != NULL); |
681 | 676 |
682 if (tuple != NULL) | 677 if (tuple != NULL) { |
683 { | 678 nsubtunes = tuple->nsubtunes; |
684 subtunes_num = tuple->nsubtunes; | 679 if (nsubtunes > 0) { |
685 if (subtunes_num > 0) | |
686 { | |
687 main_tuple = tuple; | 680 main_tuple = tuple; |
688 i = 1; | 681 i = 1; |
689 } | 682 } |
690 } | 683 } |
691 | 684 |
692 for (; i <= subtunes_num; i++) | 685 for (; i <= nsubtunes; i++) { |
693 { | |
694 gchar *filename_entry; | 686 gchar *filename_entry; |
695 if (subtunes_num > 0) | 687 |
696 { | 688 if (nsubtunes > 0) { |
697 filename_entry = g_strdup_printf("%s?%d", filename, main_tuple->subtunes[i]); | 689 filename_entry = g_strdup_printf("%s?%d", filename, main_tuple->subtunes[i]); |
698 /* we're dealing with subtune, let's ask again tuple information | 690 /* We're dealing with subtune, let's ask again tuple information |
699 to plugin, by passing the ?subsong suffix; this way we may get | 691 * to plugin, by passing the ?subtune suffix; this way we get |
700 specific subtune information in the tuple, if available */ | 692 * specific subtune information in the tuple, if available. |
693 */ | |
701 tuple = dec->get_song_tuple(filename_entry); | 694 tuple = dec->get_song_tuple(filename_entry); |
702 } | 695 } else |
703 else | |
704 filename_entry = g_strdup(filename); | 696 filename_entry = g_strdup(filename); |
705 | 697 |
706 | 698 |
707 entry = playlist_entry_new(filename_entry, | 699 entry = playlist_entry_new(filename_entry, |
708 tuple ? tuple_get_string(tuple, FIELD_TITLE, NULL) : NULL, | 700 tuple ? tuple_get_string(tuple, FIELD_TITLE, NULL) : NULL, |
722 element->next = NULL; | 714 element->next = NULL; |
723 | 715 |
724 if(!playlist->entries) { // this is the first element | 716 if(!playlist->entries) { // this is the first element |
725 playlist->entries = element; | 717 playlist->entries = element; |
726 playlist->tail = element; | 718 playlist->tail = element; |
727 } | 719 } else { // the rests |
728 else { // the rests | |
729 g_return_if_fail(playlist->tail != NULL); | 720 g_return_if_fail(playlist->tail != NULL); |
730 playlist->tail->next = element; | 721 playlist->tail->next = element; |
731 playlist->tail = element; | 722 playlist->tail = element; |
732 } | 723 } |
733 } | 724 } else { |
734 else { | |
735 playlist->entries = g_list_insert(playlist->entries, entry, pos); | 725 playlist->entries = g_list_insert(playlist->entries, entry, pos); |
736 } | 726 } |
737 | 727 |
738 PLAYLIST_UNLOCK(playlist); | 728 PLAYLIST_UNLOCK(playlist); |
739 | 729 |
740 if (tuple != NULL) { | 730 if (tuple != NULL) { |
741 const gchar *formatter = tuple_get_string(tuple, FIELD_FORMATTER, NULL); | 731 const gchar *formatter = tuple_get_string(tuple, FIELD_FORMATTER, NULL); |
742 entry->title = tuple_formatter_make_title_string(tuple, formatter ? | 732 entry->title = tuple_formatter_make_title_string(tuple, |
743 formatter : get_gentitle_format()); | 733 formatter ? formatter : get_gentitle_format()); |
744 entry->length = tuple_get_int(tuple, FIELD_LENGTH, NULL); | 734 entry->length = tuple_get_int(tuple, FIELD_LENGTH, NULL); |
745 entry->tuple = tuple; | 735 entry->tuple = tuple; |
746 } | 736 } |
747 } | 737 } |
748 | 738 |
749 if (main_tuple) | 739 if (main_tuple) |
750 tuple_free(main_tuple); | 740 tuple_free(main_tuple); |
751 | 741 |
752 if(tuple != NULL && tuple_get_int(tuple, FIELD_MTIME, NULL) == -1) { // kick the scanner thread only if mtime = -1 (uninitialized). | 742 if (tuple != NULL && tuple_get_int(tuple, FIELD_MTIME, NULL) == -1) { |
743 // kick the scanner thread only if mtime = -1 (uninitialized) | |
753 g_mutex_lock(mutex_scan); | 744 g_mutex_lock(mutex_scan); |
754 playlist_get_info_scan_active = TRUE; | 745 playlist_get_info_scan_active = TRUE; |
755 g_mutex_unlock(mutex_scan); | 746 g_mutex_unlock(mutex_scan); |
756 g_cond_signal(cond_scan); | 747 g_cond_signal(cond_scan); |
757 } | 748 } |
778 } | 769 } |
779 | 770 |
780 if (playlist->loading_playlist == TRUE || cfg.playlist_detect == TRUE) | 771 if (playlist->loading_playlist == TRUE || cfg.playlist_detect == TRUE) |
781 dec = NULL; | 772 dec = NULL; |
782 else if (!str_has_prefix_nocase(filename, "http://") && | 773 else if (!str_has_prefix_nocase(filename, "http://") && |
783 !str_has_prefix_nocase(filename, "https://")) | 774 !str_has_prefix_nocase(filename, "https://")) { |
784 { | |
785 pr = input_check_file(filename, TRUE); | 775 pr = input_check_file(filename, TRUE); |
786 | 776 |
787 if (pr) | 777 if (pr) { |
788 { | |
789 dec = pr->ip; | 778 dec = pr->ip; |
790 tuple = pr->tuple; | 779 tuple = pr->tuple; |
791 } | 780 } |
792 | |
793 g_free(pr); | 781 g_free(pr); |
794 } | 782 } |
795 | 783 |
796 if (cfg.playlist_detect == TRUE || playlist->loading_playlist == TRUE || (playlist->loading_playlist == FALSE && dec != NULL) || (playlist->loading_playlist == FALSE && !is_playlist_name(filename) && str_has_prefix_nocase(filename, "http"))) | 784 if (cfg.playlist_detect == TRUE || playlist->loading_playlist == TRUE || |
797 { | 785 (playlist->loading_playlist == FALSE && dec != NULL) || |
786 (playlist->loading_playlist == FALSE && !is_playlist_name(filename) && | |
787 str_has_prefix_nocase(filename, "http"))) { | |
798 __playlist_ins_with_info_tuple(playlist, filename, pos, tuple, dec); | 788 __playlist_ins_with_info_tuple(playlist, filename, pos, tuple, dec); |
799 playlist_generate_shuffle_list(playlist); | 789 playlist_generate_shuffle_list(playlist); |
800 playlistwin_update_list(playlist); | 790 playlistwin_update_list(playlist); |
801 playlist_manager_update(); | 791 playlist_manager_update(); |
802 return TRUE; | 792 return TRUE; |
814 | 804 |
815 /* FIXME: bah, FIFOs actually pass this regular file test */ | 805 /* FIXME: bah, FIFOs actually pass this regular file test */ |
816 if (!vfs_file_test(filename, G_FILE_TEST_IS_REGULAR)) | 806 if (!vfs_file_test(filename, G_FILE_TEST_IS_REGULAR)) |
817 return FALSE; | 807 return FALSE; |
818 | 808 |
819 if (!(file = vfs_fopen(filename, "rb"))) | 809 if ((file = vfs_fopen(filename, "rb")) == NULL) |
820 return FALSE; | 810 return FALSE; |
821 | 811 |
822 r = vfs_fread(buf, 1, sizeof(buf), file); | 812 r = vfs_fread(buf, 1, sizeof(buf), file); |
823 vfs_fclose(file); | 813 vfs_fclose(file); |
824 | 814 |
850 devino_new(dev_t device, | 840 devino_new(dev_t device, |
851 ino_t inode) | 841 ino_t inode) |
852 { | 842 { |
853 DeviceInode *devino = g_new0(DeviceInode, 1); | 843 DeviceInode *devino = g_new0(DeviceInode, 1); |
854 | 844 |
855 if (devino) | 845 if (devino) { |
856 { | |
857 devino->dev = device; | 846 devino->dev = device; |
858 devino->ino = inode; | 847 devino->ino = inode; |
859 } | 848 } |
860 | 849 |
861 return devino; | 850 return devino; |
1114 g_free(playlist->position->title); | 1103 g_free(playlist->position->title); |
1115 playlist->position->title = g_strdup(title); | 1104 playlist->position->title = g_strdup(title); |
1116 playlist->position->length = length; | 1105 playlist->position->length = length; |
1117 | 1106 |
1118 // overwrite tuple::title, mainly for streaming. it may incur side effects. --yaz | 1107 // overwrite tuple::title, mainly for streaming. it may incur side effects. --yaz |
1119 if(playlist->position->tuple && tuple_get_int(playlist->position->tuple, FIELD_LENGTH, NULL) == -1){ | 1108 if (playlist->position->tuple && tuple_get_int(playlist->position->tuple, FIELD_LENGTH, NULL) == -1){ |
1120 tuple_disassociate(playlist->position->tuple, FIELD_TITLE, NULL); | 1109 tuple_disassociate(playlist->position->tuple, FIELD_TITLE, NULL); |
1121 tuple_associate_string(playlist->position->tuple, FIELD_TITLE, NULL, title); | 1110 tuple_associate_string(playlist->position->tuple, FIELD_TITLE, NULL, title); |
1122 } | 1111 } |
1123 } | 1112 } |
1124 | 1113 |
1153 | 1142 |
1154 playlist_recalc_total_time(playlist); | 1143 playlist_recalc_total_time(playlist); |
1155 | 1144 |
1156 mainwin_set_song_info(rate, freq, nch); | 1145 mainwin_set_song_info(rate, freq, nch); |
1157 | 1146 |
1158 if ( playlist->position ) | 1147 if (playlist->position) |
1159 hook_call( "playlist set info" , playlist->position ); | 1148 hook_call( "playlist set info" , playlist->position ); |
1160 } | 1149 } |
1161 | 1150 |
1162 void | 1151 void |
1163 playlist_check_pos_current(Playlist *playlist) | 1152 playlist_check_pos_current(Playlist *playlist) |
1191 void | 1180 void |
1192 playlist_next(Playlist *playlist) | 1181 playlist_next(Playlist *playlist) |
1193 { | 1182 { |
1194 GList *plist_pos_list; | 1183 GList *plist_pos_list; |
1195 gboolean restart_playing = FALSE; | 1184 gboolean restart_playing = FALSE; |
1185 | |
1196 if (!playlist_get_length(playlist)) | 1186 if (!playlist_get_length(playlist)) |
1197 return; | 1187 return; |
1198 | 1188 |
1199 PLAYLIST_LOCK(playlist); | 1189 PLAYLIST_LOCK(playlist); |
1200 | 1190 |
1201 if ((playlist_position_before_jump != NULL) && playlist->queue == NULL) | 1191 if ((playlist_position_before_jump != NULL) && playlist->queue == NULL) { |
1202 { | |
1203 playlist->position = playlist_position_before_jump; | 1192 playlist->position = playlist_position_before_jump; |
1204 playlist_position_before_jump = NULL; | 1193 playlist_position_before_jump = NULL; |
1205 } | 1194 } |
1206 | 1195 |
1207 plist_pos_list = find_playlist_position_list(playlist); | 1196 plist_pos_list = find_playlist_position_list(playlist); |
1232 if (cfg.shuffle) | 1221 if (cfg.shuffle) |
1233 playlist->position = playlist->shuffle->data; | 1222 playlist->position = playlist->shuffle->data; |
1234 else | 1223 else |
1235 playlist->position = playlist->entries->data; | 1224 playlist->position = playlist->entries->data; |
1236 } | 1225 } |
1237 PLAYLIST_UNLOCK(playlist); | 1226 |
1227 PLAYLIST_UNLOCK(playlist); | |
1228 | |
1238 playlist_check_pos_current(playlist); | 1229 playlist_check_pos_current(playlist); |
1239 | 1230 |
1240 if (restart_playing) | 1231 if (restart_playing) |
1241 playback_initiate(); | 1232 playback_initiate(); |
1242 | 1233 |
1253 if (!playlist_get_length(playlist)) | 1244 if (!playlist_get_length(playlist)) |
1254 return; | 1245 return; |
1255 | 1246 |
1256 PLAYLIST_LOCK(playlist); | 1247 PLAYLIST_LOCK(playlist); |
1257 | 1248 |
1258 if ((playlist_position_before_jump != NULL) && playlist->queue == NULL) | 1249 if ((playlist_position_before_jump != NULL) && playlist->queue == NULL) { |
1259 { | |
1260 playlist->position = playlist_position_before_jump; | 1250 playlist->position = playlist_position_before_jump; |
1261 playlist_position_before_jump = NULL; | 1251 playlist_position_before_jump = NULL; |
1262 } | 1252 } |
1263 | 1253 |
1264 plist_pos_list = find_playlist_position_list(playlist); | 1254 plist_pos_list = find_playlist_position_list(playlist); |
1312 GList *list = playlist_get_selected(playlist); | 1302 GList *list = playlist_get_selected(playlist); |
1313 GList *it = list; | 1303 GList *it = list; |
1314 | 1304 |
1315 PLAYLIST_LOCK(playlist); | 1305 PLAYLIST_LOCK(playlist); |
1316 | 1306 |
1317 if ((cfg.shuffle) && (playlist_position_before_jump == NULL)) | 1307 if ((cfg.shuffle) && (playlist_position_before_jump == NULL)) { |
1318 { | |
1319 /* Shuffling and this is our first manual jump. */ | 1308 /* Shuffling and this is our first manual jump. */ |
1320 playlist_position_before_jump = playlist->position; | 1309 playlist_position_before_jump = playlist->position; |
1321 } | 1310 } |
1322 | 1311 |
1323 while (it) { | 1312 while (it) { |
1588 * if playlist is properly maintained */ | 1577 * if playlist is properly maintained */ |
1589 if (playlist->position->title) { | 1578 if (playlist->position->title) { |
1590 title = str_to_utf8(playlist->position->title); | 1579 title = str_to_utf8(playlist->position->title); |
1591 } | 1580 } |
1592 else { | 1581 else { |
1593 gchar *realfn = NULL; | 1582 gchar *realfn = g_filename_from_uri(playlist->position->filename, NULL, NULL); |
1594 gchar *basename = NULL; | 1583 gchar *basename = g_path_get_basename(realfn ? realfn : playlist->position->filename); |
1595 realfn = g_filename_from_uri(playlist->position->filename, NULL, NULL); | |
1596 basename = g_path_get_basename(realfn ? realfn : playlist->position->filename); | |
1597 title = filename_to_utf8(basename); | 1584 title = filename_to_utf8(basename); |
1598 g_free(realfn); realfn = NULL; | 1585 g_free(realfn); |
1599 g_free(basename); basename = NULL; | 1586 g_free(basename); |
1600 } | 1587 } |
1601 | 1588 |
1602 /* | 1589 /* |
1603 * If the user don't want numbers in the playlist, don't | 1590 * If the user don't want numbers in the playlist, don't |
1604 * display them in other parts of XMMS | 1591 * display them in other parts of XMMS |
1704 g_return_if_fail(playlist != NULL); | 1691 g_return_if_fail(playlist != NULL); |
1705 g_return_if_fail(playlist_name != NULL); | 1692 g_return_if_fail(playlist_name != NULL); |
1706 | 1693 |
1707 filename = g_strchug(g_strdup(filename_p)); | 1694 filename = g_strchug(g_strdup(filename_p)); |
1708 | 1695 |
1709 if(cfg.convert_slash) | 1696 if (cfg.convert_slash) |
1710 while ((tmp = strchr(filename, '\\')) != NULL) | 1697 while ((tmp = strchr(filename, '\\')) != NULL) |
1711 *tmp = '/'; | 1698 *tmp = '/'; |
1712 | 1699 |
1713 if (filename[0] != '/' && !strstr(filename, "://")) { | 1700 if (filename[0] != '/' && !strstr(filename, "://")) { |
1714 path = g_strdup(playlist_name); | 1701 path = g_strdup(playlist_name); |
1772 g_return_if_fail(playlist_name != NULL); | 1759 g_return_if_fail(playlist_name != NULL); |
1773 g_return_if_fail(playlist != NULL); | 1760 g_return_if_fail(playlist != NULL); |
1774 | 1761 |
1775 filename = g_strchug(g_strdup(filename_p)); | 1762 filename = g_strchug(g_strdup(filename_p)); |
1776 | 1763 |
1777 if(cfg.convert_slash) | 1764 if (cfg.convert_slash) |
1778 while ((tmp = strchr(filename, '\\')) != NULL) | 1765 while ((tmp = strchr(filename, '\\')) != NULL) |
1779 *tmp = '/'; | 1766 *tmp = '/'; |
1780 | 1767 |
1781 if (filename[0] != '/' && !strstr(filename, "://")) { | 1768 if (filename[0] != '/' && !strstr(filename, "://")) { |
1782 path = g_strdup(playlist_name); | 1769 path = g_strdup(playlist_name); |
2007 time_t mtime; | 1994 time_t mtime; |
2008 | 1995 |
2009 if (!playlist) | 1996 if (!playlist) |
2010 return -1; | 1997 return -1; |
2011 | 1998 |
2012 if (!(node = g_list_nth(playlist->entries, pos))) { | 1999 if (!(node = g_list_nth(playlist->entries, pos))) |
2013 return -1; | 2000 return -1; |
2014 } | |
2015 | 2001 |
2016 entry = node->data; | 2002 entry = node->data; |
2017 | 2003 |
2018 if (entry->tuple) | 2004 if (entry->tuple) |
2019 mtime = tuple_get_int(entry->tuple, FIELD_MTIME, NULL); | 2005 mtime = tuple_get_int(entry->tuple, FIELD_MTIME, NULL); |
2023 if (entry->tuple == NULL || | 2009 if (entry->tuple == NULL || |
2024 (mtime != 0 && (mtime == -1 || mtime != playlist_get_mtime(entry->filename)))) { | 2010 (mtime != 0 && (mtime == -1 || mtime != playlist_get_mtime(entry->filename)))) { |
2025 | 2011 |
2026 if (playlist_entry_get_info(entry)) | 2012 if (playlist_entry_get_info(entry)) |
2027 song_time = entry->length; | 2013 song_time = entry->length; |
2028 } | 2014 } else |
2029 else { | |
2030 song_time = entry->length; | 2015 song_time = entry->length; |
2031 } | |
2032 | 2016 |
2033 return song_time; | 2017 return song_time; |
2034 } | 2018 } |
2035 | 2019 |
2036 static gint | 2020 static gint |