mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 04:14:00 +00:00
Thumbnail fixes (#16062)
* Minor thumbnail improvements - set standard name if only one entry is in the playlist - use first database name for thumbnails if core has multiple * Fix playlist thumbnail downloader Playlist thumbnail downloader function was missed from the flexible thumbnail name update, now it is added.
This commit is contained in:
parent
c969143efb
commit
8886b92455
@ -500,10 +500,19 @@ bool gfx_thumbnail_set_content_playlist(
|
|||||||
{
|
{
|
||||||
char *db_name_no_ext = NULL;
|
char *db_name_no_ext = NULL;
|
||||||
char tmp_buf[PATH_MAX_LENGTH];
|
char tmp_buf[PATH_MAX_LENGTH];
|
||||||
/* Remove .lpl extension
|
const char* pos = strchr(db_name, '|');
|
||||||
* > path_remove_extension() requires a char * (not const)
|
|
||||||
* so have to use a temporary buffer... */
|
if (pos && (size_t) (pos - db_name)+1 < sizeof(tmp_buf)) {
|
||||||
strlcpy(tmp_buf, db_name, sizeof(tmp_buf));
|
/* If db_name comes from core info, and there are multiple
|
||||||
|
* databases mentioned separated by |, use only first one */
|
||||||
|
strlcpy(tmp_buf, db_name, (size_t) (pos - db_name)+1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* Remove .lpl extension
|
||||||
|
* > path_remove_extension() requires a char * (not const)
|
||||||
|
* so have to use a temporary buffer... */
|
||||||
|
strlcpy(tmp_buf, db_name, sizeof(tmp_buf));
|
||||||
|
}
|
||||||
db_name_no_ext = path_remove_extension(tmp_buf);
|
db_name_no_ext = path_remove_extension(tmp_buf);
|
||||||
|
|
||||||
if (!string_is_empty(db_name_no_ext))
|
if (!string_is_empty(db_name_no_ext))
|
||||||
|
@ -1097,6 +1097,11 @@ enum playlist_thumbnail_name_flags playlist_get_next_thumbnail_name_flag(playlis
|
|||||||
return PLAYLIST_THUMBNAIL_FLAG_SHORT_NAME;
|
return PLAYLIST_THUMBNAIL_FLAG_SHORT_NAME;
|
||||||
if (entry->thumbnail_flags & PLAYLIST_THUMBNAIL_FLAG_FULL_NAME)
|
if (entry->thumbnail_flags & PLAYLIST_THUMBNAIL_FLAG_FULL_NAME)
|
||||||
return PLAYLIST_THUMBNAIL_FLAG_STD_NAME;
|
return PLAYLIST_THUMBNAIL_FLAG_STD_NAME;
|
||||||
|
/* Special case: only one entry in playlist, only one query is possible
|
||||||
|
* as flag swapping relies on going back and forth among entries
|
||||||
|
* so just use the most likely version here */
|
||||||
|
if (idx == 0 && RBUF_LEN(playlist->entries) == 1)
|
||||||
|
return PLAYLIST_THUMBNAIL_FLAG_STD_NAME;
|
||||||
return PLAYLIST_THUMBNAIL_FLAG_FULL_NAME;
|
return PLAYLIST_THUMBNAIL_FLAG_FULL_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,7 +366,8 @@ static void free_pl_thumb_handle(pl_thumb_handle_t *pl_thumb)
|
|||||||
static void task_pl_thumbnail_download_handler(retro_task_t *task)
|
static void task_pl_thumbnail_download_handler(retro_task_t *task)
|
||||||
{
|
{
|
||||||
pl_thumb_handle_t *pl_thumb = NULL;
|
pl_thumb_handle_t *pl_thumb = NULL;
|
||||||
|
enum playlist_thumbnail_name_flags next_flag = PLAYLIST_THUMBNAIL_FLAG_INVALID;
|
||||||
|
|
||||||
if (!task)
|
if (!task)
|
||||||
goto task_finished;
|
goto task_finished;
|
||||||
|
|
||||||
@ -421,6 +422,8 @@ static void task_pl_thumbnail_download_handler(retro_task_t *task)
|
|||||||
/* Start iterating over thumbnail type */
|
/* Start iterating over thumbnail type */
|
||||||
pl_thumb->type_idx = 1;
|
pl_thumb->type_idx = 1;
|
||||||
pl_thumb->status = PL_THUMB_ITERATE_TYPE;
|
pl_thumb->status = PL_THUMB_ITERATE_TYPE;
|
||||||
|
playlist_update_thumbnail_name_flag(pl_thumb->playlist, pl_thumb->list_index, PLAYLIST_THUMBNAIL_FLAG_FULL_NAME);
|
||||||
|
pl_thumb->name_flags = PLAYLIST_THUMBNAIL_FLAG_FULL_NAME;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -450,13 +453,22 @@ static void task_pl_thumbnail_download_handler(retro_task_t *task)
|
|||||||
/* Check whether all thumbnail types have been processed */
|
/* Check whether all thumbnail types have been processed */
|
||||||
if (pl_thumb->type_idx > 3)
|
if (pl_thumb->type_idx > 3)
|
||||||
{
|
{
|
||||||
/* Time to move on to the next entry */
|
next_flag = playlist_get_next_thumbnail_name_flag(pl_thumb->playlist,pl_thumb->list_index);
|
||||||
pl_thumb->list_index++;
|
if (next_flag == PLAYLIST_THUMBNAIL_FLAG_NONE) {
|
||||||
if (pl_thumb->list_index < pl_thumb->list_size)
|
if (pl_thumb->playlist )
|
||||||
pl_thumb->status = PL_THUMB_ITERATE_ENTRY;
|
/* Time to move on to the next entry */
|
||||||
else
|
pl_thumb->list_index++;
|
||||||
pl_thumb->status = PL_THUMB_END;
|
if (pl_thumb->list_index < pl_thumb->list_size)
|
||||||
break;
|
pl_thumb->status = PL_THUMB_ITERATE_ENTRY;
|
||||||
|
else
|
||||||
|
pl_thumb->status = PL_THUMB_END;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
/* Increment the name flag to cover the 3 supported naming conventions. */
|
||||||
|
pl_thumb->type_idx = 1;
|
||||||
|
playlist_update_thumbnail_name_flag(pl_thumb->playlist, pl_thumb->list_index, next_flag);
|
||||||
|
pl_thumb->name_flags = next_flag;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Download current thumbnail */
|
/* Download current thumbnail */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user