mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 06:44:27 +00:00
Merge pull request #2677 from fr500/master
avoid adding duplicates to the database
This commit is contained in:
commit
5b2a9ef0b3
15
playlist.c
15
playlist.c
@ -116,6 +116,21 @@ void content_playlist_get_index_by_path(content_playlist_t *playlist,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool content_playlist_entry_exists(content_playlist_t *playlist,
|
||||||
|
const char *path,
|
||||||
|
const char *crc32)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
if (!playlist)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
for (i = 0; i < playlist->size; i++)
|
||||||
|
if (string_is_equal(playlist->entries[i].path, path) || string_is_equal(playlist->entries[i].crc32, crc32))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* content_playlist_free_entry:
|
* content_playlist_free_entry:
|
||||||
* @entry : Playlist entry handle.
|
* @entry : Playlist entry handle.
|
||||||
|
@ -113,6 +113,10 @@ void content_playlist_get_index_by_path(content_playlist_t *playlist,
|
|||||||
char **db_name,
|
char **db_name,
|
||||||
char **crc32);
|
char **crc32);
|
||||||
|
|
||||||
|
bool content_playlist_entry_exists(content_playlist_t *playlist,
|
||||||
|
const char *path,
|
||||||
|
const char *crc32);
|
||||||
|
|
||||||
void content_playlist_write_file(content_playlist_t *playlist);
|
void content_playlist_write_file(content_playlist_t *playlist);
|
||||||
|
|
||||||
void content_playlist_qsort(content_playlist_t *playlist, content_playlist_sort_fun_t *fn);
|
void content_playlist_qsort(content_playlist_t *playlist, content_playlist_sort_fun_t *fn);
|
||||||
|
@ -184,7 +184,6 @@ static int database_info_iterate_playlist(
|
|||||||
memset(&db->state, 0, sizeof(file_archive_transfer_t));
|
memset(&db->state, 0, sizeof(file_archive_transfer_t));
|
||||||
db_state->zip_name[0] = '\0';
|
db_state->zip_name[0] = '\0';
|
||||||
db->state.type = ZLIB_TRANSFER_INIT;
|
db->state.type = ZLIB_TRANSFER_INIT;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
#endif
|
#endif
|
||||||
case HASH_EXTENSION_CUE:
|
case HASH_EXTENSION_CUE:
|
||||||
@ -304,13 +303,17 @@ static int database_info_list_iterate_found_match(
|
|||||||
RARCH_LOG("entry path str: %s\n", entry_path_str);
|
RARCH_LOG("entry path str: %s\n", entry_path_str);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
content_playlist_push(playlist, entry_path_str,
|
if(!content_playlist_entry_exists(playlist, entry_path_str, db_crc))
|
||||||
db_info_entry->name, "DETECT", "DETECT", db_crc, db_playlist_base_str);
|
{
|
||||||
|
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_write_file(playlist);
|
||||||
content_playlist_free(playlist);
|
content_playlist_free(playlist);
|
||||||
|
|
||||||
database_info_list_free(db_state->info);
|
database_info_list_free(db_state->info);
|
||||||
|
|
||||||
db_state->info = NULL;
|
db_state->info = NULL;
|
||||||
db_state->crc = 0;
|
db_state->crc = 0;
|
||||||
|
|
||||||
@ -480,7 +483,6 @@ static int database_info_iterate(database_state_handle_t *db_state, database_inf
|
|||||||
case DATABASE_TYPE_CRC_LOOKUP:
|
case DATABASE_TYPE_CRC_LOOKUP:
|
||||||
return database_info_iterate_crc_lookup(db_state, db, NULL);
|
return database_info_iterate_crc_lookup(db_state, db, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user