diff options
Diffstat (limited to 'apps/tree.c')
-rw-r--r-- | apps/tree.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/apps/tree.c b/apps/tree.c index cf12c4abc2..87a039223e 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -1795,12 +1795,15 @@ void tree_init(void) | |||
1795 | dircache = buffer_alloc(max_files_in_dir * sizeof(struct entry)); | 1795 | dircache = buffer_alloc(max_files_in_dir * sizeof(struct entry)); |
1796 | } | 1796 | } |
1797 | 1797 | ||
1798 | void bookmark_play(char *resume_file, int index, int offset, int seed) | 1798 | void bookmark_play(char *resume_file, int index, int offset, int seed, |
1799 | char *filename) | ||
1799 | { | 1800 | { |
1801 | int i; | ||
1800 | int len=strlen(resume_file); | 1802 | int len=strlen(resume_file); |
1801 | 1803 | ||
1802 | if (!strcasecmp(&resume_file[len-4], ".m3u")) | 1804 | if (!strcasecmp(&resume_file[len-4], ".m3u")) |
1803 | { | 1805 | { |
1806 | /* Playlist playback */ | ||
1804 | char* slash; | 1807 | char* slash; |
1805 | // check that the file exists | 1808 | // check that the file exists |
1806 | int fd = open(resume_file, O_RDONLY); | 1809 | int fd = open(resume_file, O_RDONLY); |
@@ -1829,12 +1832,30 @@ void bookmark_play(char *resume_file, int index, int offset, int seed) | |||
1829 | } | 1832 | } |
1830 | else | 1833 | else |
1831 | { | 1834 | { |
1835 | /* Directory playback */ | ||
1832 | lastdir[0]='\0'; | 1836 | lastdir[0]='\0'; |
1833 | if (playlist_create(resume_file, NULL) != -1) | 1837 | if (playlist_create(resume_file, NULL) != -1) |
1834 | { | 1838 | { |
1835 | resume_directory(resume_file); | 1839 | resume_directory(resume_file); |
1836 | if (global_settings.playlist_shuffle) | 1840 | if (global_settings.playlist_shuffle) |
1837 | playlist_shuffle(seed, -1); | 1841 | playlist_shuffle(seed, -1); |
1842 | |||
1843 | /* Check if the file is at the same spot in the directory, | ||
1844 | else search for it */ | ||
1845 | if ((strcmp(strrchr(playlist_peek(index) + 1,'/') + 1, | ||
1846 | filename))) | ||
1847 | { | ||
1848 | for ( i=0; i < playlist_amount(); i++ ) | ||
1849 | { | ||
1850 | if ((strcmp(strrchr(playlist_peek(i) + 1,'/') + 1, | ||
1851 | filename)) == 0) | ||
1852 | break; | ||
1853 | } | ||
1854 | if (i < playlist_amount()) | ||
1855 | index = i; | ||
1856 | else | ||
1857 | return; | ||
1858 | } | ||
1838 | playlist_start(index,offset); | 1859 | playlist_start(index,offset); |
1839 | } | 1860 | } |
1840 | } | 1861 | } |