summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/lang/english.lang22
-rw-r--r--apps/main.c6
-rw-r--r--apps/menus/settings_menu.c17
-rw-r--r--apps/root_menu.c56
-rw-r--r--apps/tagcache.c10
-rw-r--r--apps/tagcache.h2
6 files changed, 100 insertions, 13 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 55838f2b39..9cbcb70404 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -10701,3 +10701,25 @@
10701 *: "Alarm Wake up Screen" 10701 *: "Alarm Wake up Screen"
10702 </voice> 10702 </voice>
10703</phrase> 10703</phrase>
10704<phrase>
10705 id: LANG_BUILDING_DATABASE
10706 desc: splash database building progress
10707 user:
10708 <source>
10709 *: "Building database... %d found (OFF for menu)"
10710 h100,h120,h300: "Building database... %d found (STOP for menu)"
10711 ipod*: "Building database... %d found (PLAY/PAUSE for menu)"
10712 x5: "Building database... %d found (Long PLAY for menu)"
10713 h10: "Building database... %d found (PREV for menu)"
10714 </source>
10715 <dest>
10716 *: "Building database... %d found (OFF for menu)"
10717 h100,h120,h300: "Building database... %d found (STOP for menu)"
10718 ipod*: "Building database... %d found (PLAY/PAUSE for menu)"
10719 x5: "Building database... %d found (Long PLAY for menu)"
10720 h10: "Building database... %d found (PREV for menu)"
10721 </dest>
10722 <voice>
10723 *: ""
10724 </voice>
10725</phrase>
diff --git a/apps/main.c b/apps/main.c
index a1ea75fdc3..fe397c737c 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -207,10 +207,12 @@ static void init_tagcache(void)
207 { 207 {
208#ifdef HAVE_LCD_BITMAP 208#ifdef HAVE_LCD_BITMAP
209 gui_syncsplash(0, true, "%s [%d/%d]", 209 gui_syncsplash(0, true, "%s [%d/%d]",
210 str(LANG_TAGCACHE_INIT), ret, 7); 210 str(LANG_TAGCACHE_INIT), ret,
211 tagcache_get_max_commit_step());
211#else 212#else
212 lcd_double_height(false); 213 lcd_double_height(false);
213 snprintf(buf, sizeof(buf), " TC [%d/%d]", ret, 7); 214 snprintf(buf, sizeof(buf), " TC [%d/%d]", ret,
215 tagcache_get_max_commit_step());
214 lcd_puts(0, 1, buf); 216 lcd_puts(0, 1, buf);
215#endif 217#endif
216 clear = true; 218 clear = true;
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c
index a58792b308..dd9ad731bb 100644
--- a/apps/menus/settings_menu.c
+++ b/apps/menus/settings_menu.c
@@ -45,14 +45,27 @@
45/***********************************/ 45/***********************************/
46/* TAGCACHE MENU */ 46/* TAGCACHE MENU */
47#ifdef HAVE_TAGCACHE 47#ifdef HAVE_TAGCACHE
48
49static void tagcache_rebuild_with_splash(void)
50{
51 tagcache_rebuild();
52 gui_syncsplash(HZ*2, true, str(LANG_TAGCACHE_FORCE_UPDATE_SPLASH));
53}
54
55static void tagcache_update_with_splash(void)
56{
57 tagcache_update();
58 gui_syncsplash(HZ*2, true, str(LANG_TAGCACHE_FORCE_UPDATE_SPLASH));
59}
60
48#ifdef HAVE_TC_RAMCACHE 61#ifdef HAVE_TC_RAMCACHE
49MENUITEM_SETTING(tagcache_ram, &global_settings.tagcache_ram, NULL); 62MENUITEM_SETTING(tagcache_ram, &global_settings.tagcache_ram, NULL);
50#endif 63#endif
51MENUITEM_SETTING(tagcache_autoupdate, &global_settings.tagcache_autoupdate, NULL); 64MENUITEM_SETTING(tagcache_autoupdate, &global_settings.tagcache_autoupdate, NULL);
52MENUITEM_FUNCTION(tc_init, ID2P(LANG_TAGCACHE_FORCE_UPDATE), 65MENUITEM_FUNCTION(tc_init, ID2P(LANG_TAGCACHE_FORCE_UPDATE),
53 (int(*)(void))tagcache_rebuild, NULL, Icon_NOICON); 66 (int(*)(void))tagcache_rebuild_with_splash, NULL, Icon_NOICON);
54MENUITEM_FUNCTION(tc_update, ID2P(LANG_TAGCACHE_UPDATE), 67MENUITEM_FUNCTION(tc_update, ID2P(LANG_TAGCACHE_UPDATE),
55 (int(*)(void))tagcache_update, NULL, Icon_NOICON); 68 (int(*)(void))tagcache_update_with_splash, NULL, Icon_NOICON);
56MENUITEM_SETTING(runtimedb, &global_settings.runtimedb, NULL); 69MENUITEM_SETTING(runtimedb, &global_settings.runtimedb, NULL);
57MENUITEM_FUNCTION(tc_export, ID2P(LANG_TAGCACHE_EXPORT), 70MENUITEM_FUNCTION(tc_export, ID2P(LANG_TAGCACHE_EXPORT),
58 (int(*)(void))tagtree_export, NULL, Icon_NOICON); 71 (int(*)(void))tagtree_export, NULL, Icon_NOICON);
diff --git a/apps/root_menu.c b/apps/root_menu.c
index c234614bc6..0dbf179d9e 100644
--- a/apps/root_menu.c
+++ b/apps/root_menu.c
@@ -61,6 +61,9 @@
61#ifdef HAVE_RTC_ALARM 61#ifdef HAVE_RTC_ALARM
62#include "rtc.h" 62#include "rtc.h"
63#endif 63#endif
64#ifdef HAVE_TAGCACHE
65#include "tagcache.h"
66#endif
64 67
65struct root_items { 68struct root_items {
66 int (*function)(void* param); 69 int (*function)(void* param);
@@ -99,11 +102,58 @@ static int browser(void* param)
99 break; 102 break;
100#ifdef HAVE_TAGCACHE 103#ifdef HAVE_TAGCACHE
101 case GO_TO_DBBROWSER: 104 case GO_TO_DBBROWSER:
102 if ((last_screen != GO_TO_ROOT) && !tagcache_is_usable()) 105 if (!tagcache_is_usable())
103 { 106 {
104 gui_syncsplash(HZ, true, str(LANG_TAGCACHE_BUSY)); 107 /* Re-init if required */
105 return GO_TO_PREVIOUS; 108 struct tagcache_stat *stat = tagcache_get_stat();
109 if (!stat->ready && !stat->commit_delayed && stat->processed_entries == 0)
110 {
111 /* Prompt the user */
112 char *lines[]={str(LANG_TAGCACHE_BUSY), str(LANG_TAGCACHE_FORCE_UPDATE)};
113 struct text_message message={lines, 2};
114 if(gui_syncyesno_run(&message, NULL, NULL) == YESNO_NO)
115 return GO_TO_PREVIOUS;
116 int i;
117 FOR_NB_SCREENS(i)
118 screens[i].clear_display();
119
120 /* Start initialisation */
121 tagcache_rebuild();
122 }
123
124 /* Now display progress until it's ready or the user exits */
125 while(!tagcache_is_usable())
126 {
127 gui_syncstatusbar_draw(&statusbars, false);
128 stat = tagcache_get_stat();
129
130 /* Maybe just needs to reboot due to delayed commit */
131 if (stat->commit_delayed)
132 {
133 gui_syncsplash(HZ*2, true, str(LANG_PLEASE_REBOOT));
134 break;
135 }
136
137 /* Display building progress */
138 if (stat->commit_step > 0)
139 {
140 gui_syncsplash(0, true, "%s [%d/%d]",
141 str(LANG_TAGCACHE_INIT), stat->commit_step,
142 tagcache_get_max_commit_step());
143 }
144 else
145 {
146 gui_syncsplash(0, true, str(LANG_BUILDING_DATABASE),
147 stat->processed_entries);
148 }
149
150 /* Allow user to exit */
151 if (action_userabort(HZ/2))
152 break;
153 }
106 } 154 }
155 if (!tagcache_is_usable())
156 return GO_TO_PREVIOUS;
107 filter = SHOW_ID3DB; 157 filter = SHOW_ID3DB;
108 tc->dirlevel = last_db_dirlevel; 158 tc->dirlevel = last_db_dirlevel;
109 break; 159 break;
diff --git a/apps/tagcache.c b/apps/tagcache.c
index bcff803d18..a899ff91fd 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -3904,16 +3904,12 @@ bool tagcache_update(void)
3904 return false; 3904 return false;
3905 3905
3906 queue_post(&tagcache_queue, Q_UPDATE, 0); 3906 queue_post(&tagcache_queue, Q_UPDATE, 0);
3907 gui_syncsplash(HZ*2, true, str(LANG_TAGCACHE_FORCE_UPDATE_SPLASH));
3908
3909 return false; 3907 return false;
3910} 3908}
3911 3909
3912bool tagcache_rebuild(void) 3910bool tagcache_rebuild()
3913{ 3911{
3914 queue_post(&tagcache_queue, Q_REBUILD, 0); 3912 queue_post(&tagcache_queue, Q_REBUILD, 0);
3915 gui_syncsplash(HZ*2, true, str(LANG_TAGCACHE_FORCE_UPDATE_SPLASH));
3916
3917 return false; 3913 return false;
3918} 3914}
3919 3915
@@ -3974,4 +3970,8 @@ int tagcache_get_commit_step(void)
3974{ 3970{
3975 return tc_stat.commit_step; 3971 return tc_stat.commit_step;
3976} 3972}
3973int tagcache_get_max_commit_step(void)
3974{
3975 return 8; /* To be written, better hard-coded here than in the UI */
3976}
3977 3977
diff --git a/apps/tagcache.h b/apps/tagcache.h
index 7e9a42dfa7..c8d52308ce 100644
--- a/apps/tagcache.h
+++ b/apps/tagcache.h
@@ -187,6 +187,6 @@ void tagcache_start_scan(void);
187void tagcache_stop_scan(void); 187void tagcache_stop_scan(void);
188bool tagcache_update(void); 188bool tagcache_update(void);
189bool tagcache_rebuild(void); 189bool tagcache_rebuild(void);
190 190int tagcache_get_max_commit_step(void);
191#endif 191#endif
192#endif 192#endif