summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/bookmark.c23
-rw-r--r--apps/bookmark.h2
-rw-r--r--apps/tree.c23
-rw-r--r--apps/tree.h2
4 files changed, 31 insertions, 19 deletions
diff --git a/apps/bookmark.c b/apps/bookmark.c
index 3d4705960c..91c823b018 100644
--- a/apps/bookmark.c
+++ b/apps/bookmark.c
@@ -404,7 +404,16 @@ bool bookmark_autoload(const char* file)
404 404
405 if (bookmark != NULL) 405 if (bookmark != NULL)
406 { 406 {
407 return play_bookmark(bookmark); 407 if (!play_bookmark(bookmark))
408 {
409 /* Selected bookmark not found. */
410 gui_syncsplash(HZ*2, ID2P(LANG_NOTHING_TO_RESUME));
411 }
412
413 /* Act as if autoload was done even if it failed, since the
414 * user did make an active selection.
415 */
416 return true;
408 } 417 }
409 418
410 return false; 419 return false;
@@ -418,7 +427,7 @@ bool bookmark_autoload(const char* file)
418bool bookmark_load(const char* file, bool autoload) 427bool bookmark_load(const char* file, bool autoload)
419{ 428{
420 int fd; 429 int fd;
421 char* bookmark = NULL;; 430 char* bookmark = NULL;
422 431
423 if(autoload) 432 if(autoload)
424 { 433 {
@@ -438,7 +447,12 @@ bool bookmark_load(const char* file, bool autoload)
438 447
439 if (bookmark != NULL) 448 if (bookmark != NULL)
440 { 449 {
441 return play_bookmark(bookmark); 450 if (!play_bookmark(bookmark))
451 {
452 /* Selected bookmark not found. */
453 gui_syncsplash(HZ*2, ID2P(LANG_NOTHING_TO_RESUME));
454 return false;
455 }
442 } 456 }
443 457
444 return true; 458 return true;
@@ -875,9 +889,8 @@ static bool play_bookmark(const char* bookmark)
875 &global_settings.playlist_shuffle, 889 &global_settings.playlist_shuffle,
876 global_filename)) 890 global_filename))
877 { 891 {
878 bookmark_play(global_temp_buffer, index, offset, seed, 892 return bookmark_play(global_temp_buffer, index, offset, seed,
879 global_filename); 893 global_filename);
880 return true;
881 } 894 }
882 895
883 return false; 896 return false;
diff --git a/apps/bookmark.h b/apps/bookmark.h
index 16f4e5609f..81b03285ba 100644
--- a/apps/bookmark.h
+++ b/apps/bookmark.h
@@ -27,8 +27,6 @@ bool bookmark_create_menu(void);
27bool bookmark_mrb_load(void); 27bool bookmark_mrb_load(void);
28bool bookmark_autoload(const char* file); 28bool bookmark_autoload(const char* file);
29bool bookmark_load(const char* file, bool autoload); 29bool bookmark_load(const char* file, bool autoload);
30void bookmark_play(char* resume_file, int index, int offset, int seed,
31 char *filename);
32bool bookmark_exist(void); 30bool bookmark_exist(void);
33 31
34#endif /* __BOOKMARK_H__ */ 32#endif /* __BOOKMARK_H__ */
diff --git a/apps/tree.c b/apps/tree.c
index a0e5ef000a..0b4ea95c41 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -1076,11 +1076,12 @@ void tree_mem_init(void)
1076 tree_get_filetypes(&filetypes, &filetypes_count); 1076 tree_get_filetypes(&filetypes, &filetypes_count);
1077} 1077}
1078 1078
1079void bookmark_play(char *resume_file, int index, int offset, int seed, 1079bool bookmark_play(char *resume_file, int index, int offset, int seed,
1080 char *filename) 1080 char *filename)
1081{ 1081{
1082 int i; 1082 int i;
1083 char* suffix = strrchr(resume_file, '.'); 1083 char* suffix = strrchr(resume_file, '.');
1084 bool started = false;
1084 1085
1085 if (suffix != NULL && 1086 if (suffix != NULL &&
1086 (!strcasecmp(suffix, ".m3u") || !strcasecmp(suffix, ".m3u8"))) 1087 (!strcasecmp(suffix, ".m3u") || !strcasecmp(suffix, ".m3u8")))
@@ -1090,7 +1091,7 @@ void bookmark_play(char *resume_file, int index, int offset, int seed,
1090 /* check that the file exists */ 1091 /* check that the file exists */
1091 int fd = open(resume_file, O_RDONLY); 1092 int fd = open(resume_file, O_RDONLY);
1092 if(fd<0) 1093 if(fd<0)
1093 return; 1094 return false;
1094 close(fd); 1095 close(fd);
1095 1096
1096 slash = strrchr(resume_file,'/'); 1097 slash = strrchr(resume_file,'/');
@@ -1108,6 +1109,7 @@ void bookmark_play(char *resume_file, int index, int offset, int seed,
1108 if (global_settings.playlist_shuffle) 1109 if (global_settings.playlist_shuffle)
1109 playlist_shuffle(seed, -1); 1110 playlist_shuffle(seed, -1);
1110 playlist_start(index,offset); 1111 playlist_start(index,offset);
1112 started = true;
1111 } 1113 }
1112 *slash='/'; 1114 *slash='/';
1113 } 1115 }
@@ -1128,7 +1130,7 @@ void bookmark_play(char *resume_file, int index, int offset, int seed,
1128 peek_filename = playlist_peek(index); 1130 peek_filename = playlist_peek(index);
1129 1131
1130 if (peek_filename == NULL) 1132 if (peek_filename == NULL)
1131 return; 1133 return false;
1132 1134
1133 if (strcmp(strrchr(peek_filename, '/') + 1, filename)) 1135 if (strcmp(strrchr(peek_filename, '/') + 1, filename))
1134 { 1136 {
@@ -1137,7 +1139,7 @@ void bookmark_play(char *resume_file, int index, int offset, int seed,
1137 peek_filename = playlist_peek(i); 1139 peek_filename = playlist_peek(i);
1138 1140
1139 if (peek_filename == NULL) 1141 if (peek_filename == NULL)
1140 return; 1142 return false;
1141 1143
1142 if (!strcmp(strrchr(peek_filename, '/') + 1, filename)) 1144 if (!strcmp(strrchr(peek_filename, '/') + 1, filename))
1143 break; 1145 break;
@@ -1145,19 +1147,16 @@ void bookmark_play(char *resume_file, int index, int offset, int seed,
1145 if (i < playlist_amount()) 1147 if (i < playlist_amount())
1146 index = i; 1148 index = i;
1147 else 1149 else
1148 { 1150 return false;
1149 /* File not found, so bail out. Maybe not the best
1150 * message; perhaps "Bookmarked file not found"?
1151 */
1152 gui_syncsplash(HZ*2, ID2P(LANG_NOTHING_TO_RESUME));
1153 return;
1154 }
1155 } 1151 }
1156 playlist_start(index,offset); 1152 playlist_start(index,offset);
1153 started = true;
1157 } 1154 }
1158 } 1155 }
1159 1156
1160 start_wps=true; 1157 if (started)
1158 start_wps = true;
1159 return started;
1161} 1160}
1162 1161
1163static void say_filetype(int attr) 1162static void say_filetype(int attr)
diff --git a/apps/tree.h b/apps/tree.h
index e49ac722b9..e6742d3c1a 100644
--- a/apps/tree.h
+++ b/apps/tree.h
@@ -82,6 +82,8 @@ struct tree_context* tree_get_context(void);
82void tree_flush(void); 82void tree_flush(void);
83void tree_restore(void); 83void tree_restore(void);
84 84
85bool bookmark_play(char* resume_file, int index, int offset, int seed,
86 char *filename);
85 87
86extern struct gui_synclist tree_lists; 88extern struct gui_synclist tree_lists;
87extern struct gui_syncstatusbar statusbars; 89extern struct gui_syncstatusbar statusbars;