Expand playlist format - rename it to 'lpl'

This commit is contained in:
twinaphex 2015-06-08 23:38:03 +02:00
parent 36b94952a4
commit 29e3f5ff66
12 changed files with 57 additions and 33 deletions

View File

@ -1607,13 +1607,13 @@ static bool config_load_file(const char *path, bool set_defaults)
{
fill_pathname_join(settings->content_history_path,
settings->content_history_directory,
"content_history.rpl",
"content_history.lpl",
sizeof(settings->content_history_path));
}
else
{
fill_pathname_resolve_relative(settings->content_history_path,
global->config_path, "content_history.rpl",
global->config_path, "content_history.lpl",
sizeof(settings->content_history_path));
}
}

View File

@ -160,9 +160,6 @@ int database_info_build_query(char *s, size_t len,
strlcat(s, "\"", len);
strlcat(s, "}", len);
#if 0
RARCH_LOG("query: %s\n", s);
#endif
return 0;
}

View File

@ -189,6 +189,7 @@ static void history_playlist_push(content_playlist_t *playlist,
NULL,
core_path,
info->library_name,
NULL,
NULL);
}

View File

@ -299,7 +299,7 @@ static int deferred_push_cursor_manager_list(menu_displaylist_info_t *info)
static int deferred_push_content_collection_list(menu_displaylist_info_t *info)
{
info->type_default = MENU_FILE_PLAIN;
strlcpy(info->exts, "rpl", sizeof(info->exts));
strlcpy(info->exts, "lpl", sizeof(info->exts));
return menu_displaylist_push_list(info, DISPLAYLIST_DATABASE_PLAYLISTS);
}
@ -411,7 +411,7 @@ static int deferred_push_video_font_path(menu_displaylist_info_t *info)
static int deferred_push_content_history_path(menu_displaylist_info_t *info)
{
info->type_default = MENU_FILE_PLAIN;
strlcpy(info->exts, "rpl", sizeof(info->exts));
strlcpy(info->exts, "lpl", sizeof(info->exts));
return menu_displaylist_push_list(info, DISPLAYLIST_CONTENT_HISTORY);
}

View File

@ -199,7 +199,7 @@ static int action_ok_playlist_entry(const char *path,
}
content_playlist_get_index(playlist, selection_ptr,
&entry_path, &entry_label, &core_path, &core_name, NULL);
&entry_path, &entry_label, &core_path, &core_name, NULL, NULL);
#if 0
RARCH_LOG("path: %s, label: %s, core path: %s, core name: %s, idx: %d\n", entry_path, entry_label,
@ -872,7 +872,8 @@ static int action_ok_core_deferred_set(const char *path,
content_playlist_update(menu->playlist, idx,
menu->playlist->entries[idx].path, menu->playlist->entries[idx].label,
path , core_display_name,
menu->playlist->entries[idx].crc32);
menu->playlist->entries[idx].crc32,
menu->playlist->entries[idx].db_name);
content_playlist_free(menu->playlist);
menu->playlist = NULL;

View File

@ -1431,7 +1431,7 @@ static void xmb_init_horizontal_list(menu_handle_t *menu, xmb_handle_t *xmb)
info.type_default = MENU_FILE_PLAIN;
strlcpy(info.label, "content_collection_list", sizeof(info.label));
strlcpy(info.path, settings->playlist_directory, sizeof(info.path));
strlcpy(info.exts, "rpl", sizeof(info.exts));
strlcpy(info.exts, "lpl", sizeof(info.exts));
menu_displaylist_push_list(&info, DISPLAYLIST_DATABASE_PLAYLISTS);

View File

@ -73,6 +73,7 @@ static void menu_push_to_history_playlist(void)
NULL,
settings->libretro,
global->menu.info.library_name,
NULL,
NULL);
}

View File

@ -715,6 +715,7 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info,
char fill_buf[PATH_MAX_LENGTH];
char path_copy[PATH_MAX_LENGTH];
const char *core_name = NULL;
const char *db_name = NULL;
const char *path = NULL;
const char *label = NULL;
const char *crc32 = NULL;
@ -724,7 +725,7 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info,
path = path_copy;
content_playlist_get_index(playlist, i,
&path, &label, NULL, &core_name, &crc32);
&path, &label, NULL, &core_name, &crc32, &db_name);
strlcpy(fill_buf, core_name, sizeof(fill_buf));
if (path)
@ -914,7 +915,7 @@ static int menu_displaylist_parse_database_entry(menu_displaylist_info_t *info)
strlcpy(path_base, path_basename(info->path), sizeof(path_base));
path_remove_extension(path_base);
strlcat(path_base, ".rpl", sizeof(path_base));
strlcat(path_base, ".lpl", sizeof(path_base));
fill_pathname_join(path_playlist, settings->playlist_directory, path_base,
sizeof(path_playlist));
@ -1329,7 +1330,7 @@ static int menu_displaylist_parse_horizontal_list(menu_displaylist_info_t *info)
{
char db_path[PATH_MAX_LENGTH];
char path_playlist[PATH_MAX_LENGTH];
char rpl_basename[PATH_MAX_LENGTH];
char lpl_basename[PATH_MAX_LENGTH];
size_t i;
content_playlist_t *playlist = NULL;
settings_t *settings = config_get_ptr();
@ -1345,12 +1346,12 @@ static int menu_displaylist_parse_horizontal_list(menu_displaylist_info_t *info)
MENU_FILE_CONTENTLIST_ENTRY, 0);
#endif
strlcpy(rpl_basename, item->path, sizeof(rpl_basename));
path_remove_extension(rpl_basename);
strlcpy(lpl_basename, item->path, sizeof(lpl_basename));
path_remove_extension(lpl_basename);
#ifdef HAVE_LIBRETRODB
fill_pathname_join(db_path, settings->content_database,
rpl_basename, sizeof(db_path));
lpl_basename, sizeof(db_path));
strlcat(db_path, ".rdb", sizeof(db_path));
if (path_file_exists(db_path))

View File

@ -38,7 +38,8 @@ void content_playlist_get_index(content_playlist_t *playlist,
size_t idx,
const char **path, const char **label,
const char **core_path, const char **core_name,
const char **crc32)
const char **crc32,
const char **db_name)
{
if (!playlist)
return;
@ -51,6 +52,8 @@ void content_playlist_get_index(content_playlist_t *playlist,
*core_path = playlist->entries[idx].core_path;
if (core_name)
*core_name = playlist->entries[idx].core_name;
if (db_name)
*db_name = playlist->entries[idx].db_name;
if (crc32)
*crc32 = playlist->entries[idx].crc32;
}
@ -59,7 +62,8 @@ void content_playlist_get_index_by_path(content_playlist_t *playlist,
const char *search_path,
char **path, char **label,
char **core_path, char **core_name,
char **crc32)
char **crc32,
char **db_name)
{
size_t i;
if (!playlist)
@ -78,6 +82,8 @@ void content_playlist_get_index_by_path(content_playlist_t *playlist,
*core_path = playlist->entries[i].core_path;
if (core_name)
*core_name = playlist->entries[i].core_name;
if (db_name)
*db_name = playlist->entries[i].db_name;
if (crc32)
*crc32 = playlist->entries[i].crc32;
break;
@ -112,6 +118,10 @@ static void content_playlist_free_entry(content_playlist_entry_t *entry)
free(entry->core_name);
entry->core_name = NULL;
if (entry->db_name)
free(entry->db_name);
entry->core_name = NULL;
if (entry->crc32)
free(entry->crc32);
entry->crc32 = NULL;
@ -122,7 +132,8 @@ static void content_playlist_free_entry(content_playlist_entry_t *entry)
void content_playlist_update(content_playlist_t *playlist, size_t idx,
const char *path, const char *label,
const char *core_path, const char *core_name,
const char *crc32)
const char *crc32,
const char *db_name)
{
content_playlist_entry_t *entry = NULL;
if (!playlist)
@ -135,11 +146,12 @@ void content_playlist_update(content_playlist_t *playlist, size_t idx,
if (!entry)
return;
entry->path = path ? strdup(path) : entry->path;
entry->label = label ? strdup(label) : entry->label;
entry->path = path ? strdup(path) : entry->path;
entry->label = label ? strdup(label) : entry->label;
entry->core_path = core_path ? strdup(core_path) : entry->core_path;
entry->core_name = core_name ? strdup(core_name) : entry->core_name;
entry->crc32 = crc32 ? strdup(crc32) : entry->crc32;
entry->db_name = db_name ? strdup(db_name) : entry->db_name;
entry->crc32 = crc32 ? strdup(crc32) : entry->crc32;
}
/**
@ -154,7 +166,8 @@ void content_playlist_update(content_playlist_t *playlist, size_t idx,
void content_playlist_push(content_playlist_t *playlist,
const char *path, const char *label,
const char *core_path, const char *core_name,
const char *crc32)
const char *crc32,
const char *db_name)
{
size_t i;
@ -212,6 +225,7 @@ void content_playlist_push(content_playlist_t *playlist,
playlist->entries[0].label = label ? strdup(label) : NULL;
playlist->entries[0].core_path = core_path ? strdup(core_path) : NULL;
playlist->entries[0].core_name = core_name ? strdup(core_name) : NULL;
playlist->entries[0].db_name = db_name ? strdup(db_name) : NULL;
playlist->entries[0].crc32 = crc32 ? strdup(crc32) : NULL;
playlist->size++;
}
@ -230,12 +244,14 @@ void content_playlist_write_file(content_playlist_t *playlist)
return;
for (i = 0; i < playlist->size; i++)
fprintf(file, "%s\n%s\n%s\n%s\n%s\n",
fprintf(file, "%s\n%s\n%s\n%s\n%s\n%s\n",
playlist->entries[i].path ? playlist->entries[i].path : "",
playlist->entries[i].label ? playlist->entries[i].label : "",
playlist->entries[i].core_path,
playlist->entries[i].core_name,
playlist->entries[i].crc32 ? playlist->entries[i].crc32 : "");
playlist->entries[i].crc32 ? playlist->entries[i].crc32 : "",
playlist->entries[i].db_name ? playlist->entries[i].db_name : ""
);
fclose(file);
}
@ -296,7 +312,7 @@ size_t content_playlist_size(content_playlist_t *playlist)
}
#ifndef PLAYLIST_ENTRIES
#define PLAYLIST_ENTRIES 5
#define PLAYLIST_ENTRIES 6
#endif
static bool content_playlist_read_file(
@ -334,13 +350,15 @@ static bool content_playlist_read_file(
continue;
if (*buf[0])
entry->path = strdup(buf[0]);
entry->path = strdup(buf[0]);
if (*buf[1])
entry->label = strdup(buf[1]);
entry->core_path = strdup(buf[2]);
entry->core_name = strdup(buf[3]);
entry->label = strdup(buf[1]);
entry->core_path = strdup(buf[2]);
entry->core_name = strdup(buf[3]);
if (*buf[4])
entry->crc32 = strdup(buf[4]);
if (*buf[5])
entry->db_name = strdup(buf[5]);
playlist->size++;
}

View File

@ -30,6 +30,7 @@ typedef struct content_playlist_entry
char *label;
char *core_path;
char *core_name;
char *db_name;
char *crc32;
} content_playlist_entry_t;
@ -92,6 +93,7 @@ void content_playlist_get_index(content_playlist_t *playlist,
size_t idx,
const char **path, const char **label,
const char **core_path, const char **core_name,
const char **db_name,
const char **crc32);
/**
@ -106,17 +108,20 @@ void content_playlist_get_index(content_playlist_t *playlist,
void content_playlist_push(content_playlist_t *playlist,
const char *path, const char *label,
const char *core_path, const char *core_name,
const char *db_name,
const char *crc32);
void content_playlist_update(content_playlist_t *playlist, size_t idx,
const char *path, const char *label,
const char *core_path, const char *core_name,
const char *db_name,
const char *crc32);
void content_playlist_get_index_by_path(content_playlist_t *playlist,
const char *search_path,
char **path, char **label,
char **core_path, char **core_name,
char **db_name,
char **crc32);
void content_playlist_write_file(content_playlist_t *playlist);

View File

@ -1343,7 +1343,7 @@ void rarch_playlist_load_content(void *data, unsigned idx)
return;
content_playlist_get_index(playlist,
idx, &path, NULL, &core_path, NULL, NULL);
idx, &path, NULL, &core_path, NULL, NULL, NULL);
strlcpy(settings->libretro, core_path, sizeof(settings->libretro));

View File

@ -164,7 +164,7 @@ static int database_info_list_iterate_found_match(
path_remove_extension(db_playlist_base_str);
strlcat(db_playlist_base_str, ".rpl", sizeof(db_playlist_base_str));
strlcat(db_playlist_base_str, ".lpl", sizeof(db_playlist_base_str));
fill_pathname_join(db_playlist_path, settings->playlist_directory,
db_playlist_base_str, sizeof(db_playlist_path));
@ -192,7 +192,7 @@ static int database_info_list_iterate_found_match(
RARCH_LOG("entry path str: %s\n", entry_path_str);
#endif
content_playlist_push(playlist, entry_path_str, db_info_entry->name, "DETECT", "DETECT", db_crc);
content_playlist_push(playlist, entry_path_str, db_info_entry->name, "DETECT", "DETECT", db_crc, db_playlist_base_str);
content_playlist_write_file(playlist);
content_playlist_free(playlist);