summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/database.c10
-rw-r--r--apps/database.h1
-rw-r--r--apps/lang/deutsch.lang8
-rw-r--r--apps/lang/english.lang6
-rw-r--r--apps/main.c1
-rw-r--r--apps/settings.c1
-rw-r--r--apps/settings.h1
-rw-r--r--apps/settings_menu.c20
-rw-r--r--apps/tree.c5
9 files changed, 50 insertions, 3 deletions
diff --git a/apps/database.c b/apps/database.c
index bce1fb44cd..ad97b55ee7 100644
--- a/apps/database.c
+++ b/apps/database.c
@@ -315,6 +315,9 @@ int rundb_init(void)
315#endif 315#endif
316 if(!tagdb_initialized) /* forget it.*/ 316 if(!tagdb_initialized) /* forget it.*/
317 return -1; 317 return -1;
318
319 if(!global_settings.runtimedb) /* user doesn't care */
320 return -1;
318 321
319 rundb_fd = open(ROCKBOX_DIR "/rockbox.rundb", O_CREAT|O_RDWR); 322 rundb_fd = open(ROCKBOX_DIR "/rockbox.rundb", O_CREAT|O_RDWR);
320 if (rundb_fd < 0) { 323 if (rundb_fd < 0) {
@@ -358,6 +361,13 @@ int rundb_init(void)
358#endif 361#endif
359} 362}
360 363
364void rundb_shutdown(void)
365{
366 if (rundb_fd >= 0)
367 close(rundb_fd);
368 rundb_initialized = 0;
369}
370
361void writerundbheader(void) 371void writerundbheader(void)
362{ 372{
363 lseek(rundb_fd,0,SEEK_SET); 373 lseek(rundb_fd,0,SEEK_SET);
diff --git a/apps/database.h b/apps/database.h
index c1e2097f6a..a0e029072c 100644
--- a/apps/database.h
+++ b/apps/database.h
@@ -101,4 +101,5 @@ void loadruntimeinfo(char *filename);
101void increaseplaycount(void); 101void increaseplaycount(void);
102void setrating(int rating); 102void setrating(int rating);
103int rundb_init(void); 103int rundb_init(void);
104void rundb_shutdown(void);
104#endif 105#endif
diff --git a/apps/lang/deutsch.lang b/apps/lang/deutsch.lang
index 221c00732f..515b9135ab 100644
--- a/apps/lang/deutsch.lang
+++ b/apps/lang/deutsch.lang
@@ -3140,4 +3140,10 @@ id: LANG_NEXT_FOLDER
3140desc: in settings_menu. Should we move to next folder when current one ends 3140desc: in settings_menu. Should we move to next folder when current one ends
3141eng: "Move to Next Folder" 3141eng: "Move to Next Folder"
3142voice: "In nächstes Verzeichnis wechseln" 3142voice: "In nächstes Verzeichnis wechseln"
3143new: "In nächstes Verzeichnis wechseln" 3143new: "In nächstes Verzeichnis wechseln"
3144
3145id: LANG_RUNTIMEDB_ACTIVE
3146desc: in settings_menu.
3147eng: "Gather runtime data (experimental)"
3148voice: "Spielzeitdaten sammeln"
3149new: "Spielzeitdaten sammeln (experimentell)"
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index abb7ca5fd6..fb0da889cd 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -3148,3 +3148,9 @@ desc: in settings_menu. Should we move to next folder when current one ends
3148eng: "Move to Next Folder" 3148eng: "Move to Next Folder"
3149voice: "Move to Next Folder" 3149voice: "Move to Next Folder"
3150new: 3150new:
3151
3152id: LANG_RUNTIMEDB_ACTIVE
3153desc: in settings_menu.
3154eng: "Gather runtime data (experimental)"
3155voice: "Gather runtime data"
3156new:
diff --git a/apps/main.c b/apps/main.c
index 71fabf2b87..513cda1fcb 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -289,7 +289,6 @@ void init(void)
289 pcm_init_recording(); 289 pcm_init_recording();
290#endif 290#endif
291 talk_init(); 291 talk_init();
292 rundb_init();
293 292
294#ifdef AUTOROCK 293#ifdef AUTOROCK
295 { 294 {
diff --git a/apps/settings.c b/apps/settings.c
index 3bce8c7929..50a309d8da 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -406,6 +406,7 @@ static const struct bit_entry hd_bits[] =
406#endif 406#endif
407 407
408 {1, S_O(next_folder), false, "move to next folder", off_on }, 408 {1, S_O(next_folder), false, "move to next folder", off_on },
409 {1, S_O(runtimedb), false, "gather runtime data", off_on },
409 410
410 /* new stuff to be added at the end */ 411 /* new stuff to be added at the end */
411 412
diff --git a/apps/settings.h b/apps/settings.h
index 78860fa700..46f410a2f4 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -322,6 +322,7 @@ struct user_settings
322#endif 322#endif
323 323
324 bool next_folder; /* move to next folder */ 324 bool next_folder; /* move to next folder */
325 bool runtimedb; /* runtime database active? */
325}; 326};
326 327
327enum optiontype { INT, BOOL }; 328enum optiontype { INT, BOOL };
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index d7bf96aaff..3de8fa4b70 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -46,6 +46,7 @@
46#include "timefuncs.h" 46#include "timefuncs.h"
47#include "misc.h" 47#include "misc.h"
48#include "power.h" 48#include "power.h"
49#include "database.h"
49 50
50#ifdef HAVE_LCD_BITMAP 51#ifdef HAVE_LCD_BITMAP
51#include "peakmeter.h" 52#include "peakmeter.h"
@@ -1124,6 +1125,24 @@ static bool next_folder(void)
1124 return set_bool( str(LANG_NEXT_FOLDER), &global_settings.next_folder ); 1125 return set_bool( str(LANG_NEXT_FOLDER), &global_settings.next_folder );
1125} 1126}
1126 1127
1128static bool runtimedb(void)
1129{
1130 bool rc;
1131 bool old = global_settings.runtimedb;
1132
1133 rc = set_bool_options( str(LANG_RUNTIMEDB_ACTIVE),
1134 &global_settings.runtimedb,
1135 STR(LANG_SET_BOOL_YES),
1136 STR(LANG_SET_BOOL_NO),
1137 NULL);
1138 if (old && !global_settings.runtimedb)
1139 rundb_shutdown();
1140 if (!old && global_settings.runtimedb)
1141 rundb_init();
1142
1143 return rc;
1144}
1145
1127static bool playback_settings_menu(void) 1146static bool playback_settings_menu(void)
1128{ 1147{
1129 int m; 1148 int m;
@@ -1145,6 +1164,7 @@ static bool playback_settings_menu(void)
1145#endif 1164#endif
1146 { ID2P(LANG_ID3_ORDER), id3_order }, 1165 { ID2P(LANG_ID3_ORDER), id3_order },
1147 { ID2P(LANG_NEXT_FOLDER), next_folder }, 1166 { ID2P(LANG_NEXT_FOLDER), next_folder },
1167 { ID2P(LANG_RUNTIMEDB_ACTIVE), runtimedb },
1148 }; 1168 };
1149 1169
1150 bool old_shuffle = global_settings.playlist_shuffle; 1170 bool old_shuffle = global_settings.playlist_shuffle;
diff --git a/apps/tree.c b/apps/tree.c
index 73bb3b77f2..8a2e661264 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -569,6 +569,7 @@ static bool check_changed_id3mode(bool currmode)
569static void tree_prepare_usb(void *parameter) 569static void tree_prepare_usb(void *parameter)
570{ 570{
571 (void) parameter; 571 (void) parameter;
572 rundb_shutdown();
572 tagdb_shutdown(); 573 tagdb_shutdown();
573} 574}
574 575
@@ -1120,6 +1121,7 @@ static bool dirbrowse(void)
1120 == SYS_USB_CONNECTED) 1121 == SYS_USB_CONNECTED)
1121 { 1122 {
1122 tagdb_init(); /* re-init database */ 1123 tagdb_init(); /* re-init database */
1124 rundb_init();
1123 if(*tc.dirfilter > NUM_FILTER_MODES) 1125 if(*tc.dirfilter > NUM_FILTER_MODES)
1124 /* leave sub-browsers after usb, doing otherwise 1126 /* leave sub-browsers after usb, doing otherwise
1125 might be confusing to the user */ 1127 might be confusing to the user */
@@ -1474,7 +1476,8 @@ void tree_init(void)
1474 tc.dirfilter = &global_settings.dirfilter; 1476 tc.dirfilter = &global_settings.dirfilter;
1475 1477
1476 tagdb_init(); 1478 tagdb_init();
1477 1479 rundb_init();
1480
1478 tc.name_buffer_size = AVERAGE_FILENAME_LENGTH * max_files; 1481 tc.name_buffer_size = AVERAGE_FILENAME_LENGTH * max_files;
1479 tc.name_buffer = buffer_alloc(tc.name_buffer_size); 1482 tc.name_buffer = buffer_alloc(tc.name_buffer_size);
1480 1483