Support importing runtimedb data from ascii files.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10260 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Miika Pekkarinen 2006-07-20 12:19:31 +00:00
parent 7b5af8c045
commit cb8c795415
7 changed files with 491 additions and 198 deletions

View file

@ -1877,7 +1877,9 @@ static bool dbg_tagcache_info(void)
lcd_clear_display();
stat = tagcache_get_stat();
snprintf(buf, sizeof(buf), "Busy: %s", stat->initialized ? "No" : "Yes");
snprintf(buf, sizeof(buf), "Initialized: %s", stat->initialized ? "Yes" : "No");
lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "DB Ready: %s", stat->ready ? "Yes" : "No");
lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "RAM Cache: %s", stat->ramcache ? "Yes" : "No");
lcd_puts(0, line++, buf);

View file

@ -8655,4 +8655,18 @@
*: ""
</voice>
</phrase>
<phrase>
id: LANG_TAGCACHE_IMPORT
desc: in tag cache settings
user:
<source>
*: "Import modifications"
</source>
<dest>
*: "Import modifications"
</dest>
<voice>
*: "Import modifications"
</voice>
</phrase>

View file

@ -1570,6 +1570,7 @@ static bool tagcache_settings_menu(void)
{ ID2P(LANG_TAGCACHE_UPDATE), tagcache_update },
{ ID2P(LANG_RUNTIMEDB_ACTIVE), tagcache_runtimedb },
{ ID2P(LANG_TAGCACHE_EXPORT), tagtree_export },
{ ID2P(LANG_TAGCACHE_IMPORT), tagtree_import },
};
m=menu_init( items, sizeof(items) / sizeof(*items), NULL,

File diff suppressed because it is too large Load diff

View file

@ -36,7 +36,7 @@ enum tag_type { tag_artist = 0, tag_album, tag_genre, tag_title,
#define IDX_BUF_DEPTH 64
/* Tag Cache Header version 'TCHxx'. Increment when changing internal structures. */
#define TAGCACHE_MAGIC 0x54434805
#define TAGCACHE_MAGIC 0x54434806
/* How much to allocate extra space for ramcache. */
#define TAGCACHE_RESERVE 32768
@ -79,6 +79,7 @@ enum modifiers { clause_mod_none, clause_mod_not };
struct tagcache_stat {
bool initialized; /* Is tagcache currently busy? */
bool ready; /* Is tagcache ready to be used? */
bool ramcache; /* Is tagcache loaded in ram? */
bool commit_delayed; /* Has commit been delayed until next reboot? */
int commit_step; /* Commit progress */
@ -124,6 +125,9 @@ struct tagcache_search {
long result_seek;
};
int tagcache_str_to_tag(const char *str);
const char* tagcache_tag_to_str(int tag);
bool tagcache_is_numeric_tag(int type);
bool tagcache_is_unique_tag(int type);
bool tagcache_is_sorted_tag(int type);
@ -138,6 +142,9 @@ bool tagcache_retrieve(struct tagcache_search *tcs, int idxid,
char *buf, long size);
void tagcache_search_finish(struct tagcache_search *tcs);
long tagcache_get_numeric(const struct tagcache_search *tcs, int tag);
long tagcache_increase_serial(void);
long tagcache_get_serial(void);
bool tagcache_import_changelog(void);
bool tagcache_create_changelog(struct tagcache_search *tcs);
bool tagcache_modify_numeric_entry(struct tagcache_search *tcs,
int tag, long data);

View file

@ -395,6 +395,10 @@ static void tagtree_unbuffer_event(struct mp3entry *id3, bool last_track)
playcount++;
lastplayed = tagcache_increase_serial();
if (lastplayed < 0)
return;
/* Ignore the last 15s (crossfade etc.) */
playtime += MIN(id3->length, id3->elapsed + 15 * 1000);
@ -427,6 +431,17 @@ bool tagtree_export(void)
return false;
}
bool tagtree_import(void)
{
gui_syncsplash(0, true, str(LANG_WAIT));
if (!tagcache_import_changelog())
{
gui_syncsplash(HZ*2, true, str(LANG_FAILED));
}
return false;
}
void tagtree_init(void)
{
int fd;

View file

@ -31,6 +31,7 @@ struct tagentry {
};
bool tagtree_export(void);
bool tagtree_import(void);
void tagtree_init(void);
int tagtree_enter(struct tree_context* c);
void tagtree_exit(struct tree_context* c);