Skip to content

Commit 2a065e0

Browse files
committed
Merge of manual and autoscan
Scanning options are unified for a single operation, which can be customized to cover previous autoscan, manual scan, DAT scan, and a lot of combinations in-between. More details in the pull request.
1 parent 37f85ec commit 2a065e0

15 files changed

Lines changed: 1359 additions & 737 deletions

Makefile.common

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@ OBJ += \
432432
$(LIBRETRO_COMM_DIR)/playlists/label_sanitization.o \
433433
$(LIBRETRO_COMM_DIR)/time/rtime.o \
434434
manual_content_scan.o \
435+
tasks/task_database.o \
435436
disk_control_interface.o
436437

437438
ifeq ($(HAVE_CONFIGFILE), 1)
@@ -581,7 +582,6 @@ ifeq ($(HAVE_LIBRETRODB), 1)
581582
libretro-db/rmsgpack.o \
582583
libretro-db/rmsgpack_dom.o \
583584
database_info.o \
584-
tasks/task_database.o \
585585
tasks/task_database_cue.o
586586

587587
ifeq ($(HAVE_MENU), 1)

database_info.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
#include "core_info.h"
3030
#include "database_info.h"
31+
#include "manual_content_scan.h"
3132

3233
int database_info_build_query_enum(char *s, size_t len,
3334
enum database_query_type type,
@@ -860,8 +861,9 @@ static int dir_entry_compare(const void *left, const void *right)
860861
}
861862

862863
database_info_handle_t *database_info_dir_init(const char *dir,
863-
enum database_type type, retro_task_t *task,
864-
bool show_hidden_files)
864+
enum database_type type, char *file_exts,
865+
bool show_hidden_files, bool recursive, bool include_archive,
866+
struct string_list **content_list)
865867
{
866868
core_info_list_t *core_info_list = NULL;
867869
struct string_list *list = NULL;
@@ -871,11 +873,13 @@ database_info_handle_t *database_info_dir_init(const char *dir,
871873
if (!db)
872874
return NULL;
873875

874-
core_info_get_list(&core_info_list);
876+
/* File list will include all supported files, unless extension list is given */
877+
if (string_is_empty(file_exts))
878+
core_info_get_list(&core_info_list);
875879

876-
if (!(list = dir_list_new(dir, core_info_list ? core_info_list->all_ext : NULL,
880+
if (!(list = dir_list_new(dir, core_info_list ? core_info_list->all_ext : file_exts,
877881
false, show_hidden_files,
878-
false, true)))
882+
include_archive, recursive)))
879883
{
880884
free(db);
881885
return NULL;
@@ -886,14 +890,13 @@ database_info_handle_t *database_info_dir_init(const char *dir,
886890

887891
db->status = DATABASE_STATUS_ITERATE;
888892
db->type = type;
889-
db->list_ptr = 0;
890-
db->list = list;
893+
*content_list = list;
891894

892895
return db;
893896
}
894897

895898
database_info_handle_t *database_info_file_init(const char *path,
896-
enum database_type type, retro_task_t *task)
899+
enum database_type type, retro_task_t *task, struct string_list **content_list)
897900
{
898901
union string_list_elem_attr attr;
899902
struct string_list *list = NULL;
@@ -914,16 +917,15 @@ database_info_handle_t *database_info_file_init(const char *path,
914917

915918
db->status = DATABASE_STATUS_ITERATE;
916919
db->type = type;
917-
db->list_ptr = 0;
918-
db->list = list;
920+
*content_list = list;
919921

920922
return db;
921923
}
922924

923925
void database_info_free(database_info_handle_t *db)
924926
{
925-
if (db)
926-
string_list_free(db->list);
927+
/* if (db)
928+
string_list_free(db->list);*/
927929
}
928930

929931
database_info_list_t *database_info_list_new(

database_info.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ enum database_query_type
7575

7676
typedef struct
7777
{
78-
struct string_list *list;
79-
size_t list_ptr;
8078
enum database_status status;
8179
enum database_type type;
8280
} database_info_handle_t;
@@ -145,11 +143,12 @@ database_info_list_t *database_info_list_new(const char *rdb_path,
145143
void database_info_list_free(database_info_list_t *list);
146144

147145
database_info_handle_t *database_info_dir_init(const char *dir,
148-
enum database_type type, retro_task_t *task,
149-
bool show_hidden_files);
146+
enum database_type type, char* file_exts,
147+
bool show_hidden_files, bool recursive, bool include_archive,
148+
struct string_list **content_list);
150149

151150
database_info_handle_t *database_info_file_init(const char *path,
152-
enum database_type type, retro_task_t *task);
151+
enum database_type type, retro_task_t *task, struct string_list **content_list);
153152

154153
void database_info_free(database_info_handle_t *handle);
155154

intl/msg_hash_us.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8073,7 +8073,7 @@ MSG_HASH(
80738073
)
80748074
MSG_HASH(
80758075
MENU_ENUM_SUBLABEL_PLAYLIST_MANAGER_REFRESH_PLAYLIST,
8076-
"Add new content and remove invalid entries by repeating the 'Manual Scan' operation last used to create or edit the playlist."
8076+
"Add new content and remove invalid entries by repeating the content scan operation last used to create or edit the playlist."
80778077
)
80788078
MSG_HASH(
80798079
MENU_ENUM_LABEL_VALUE_DELETE_PLAYLIST,
@@ -8670,11 +8670,11 @@ MSG_HASH(
86708670
)
86718671
MSG_HASH(
86728672
MENU_ENUM_LABEL_VALUE_MANUAL_CONTENT_SCAN_LIST,
8673-
"Manual Scan"
8673+
"Content Scan"
86748674
)
86758675
MSG_HASH(
86768676
MENU_ENUM_SUBLABEL_MANUAL_CONTENT_SCAN_LIST,
8677-
"Configurable scan based on content file names. Does not require content to match the database."
8677+
"Configurable scan based on content file names and/or database match."
86788678
)
86798679
MSG_HASH(
86808680
MENU_ENUM_LABEL_VALUE_SCAN_ENTRY,
@@ -8740,31 +8740,31 @@ MSG_HASH(
87408740
"Add to Mixer and Play"
87418741
)
87428742

8743-
/* Import Content > Manual Scan */
8743+
/* Import Content > Content Scan */
87448744

87458745
MSG_HASH(
87468746
MENU_ENUM_LABEL_VALUE_MANUAL_CONTENT_SCAN_DIR,
8747-
"Content Directory"
8747+
"Content Location"
87488748
)
87498749
MSG_HASH(
87508750
MENU_ENUM_SUBLABEL_MANUAL_CONTENT_SCAN_DIR,
8751-
"Select a directory to scan for content."
8751+
"Select a directory (or file) to scan for content."
87528752
)
87538753
MSG_HASH(
87548754
MENU_ENUM_LABEL_VALUE_MANUAL_CONTENT_SCAN_SYSTEM_NAME,
8755-
"System Name"
8755+
"Target Playlist"
87568756
)
87578757
MSG_HASH(
87588758
MENU_ENUM_SUBLABEL_MANUAL_CONTENT_SCAN_SYSTEM_NAME,
8759-
"Specify a 'system name' with which to associate scanned content. Used to name to the generated playlist file and to identify playlist thumbnails."
8759+
"Name of the generated playlist file, also used to identify playlist thumbnails. Automatic setting will use the same name as the matching database or content directory."
87608760
)
87618761
MSG_HASH(
87628762
MENU_ENUM_LABEL_VALUE_MANUAL_CONTENT_SCAN_SYSTEM_NAME_CUSTOM,
8763-
"Custom System Name"
8763+
"Custom Playlist Name"
87648764
)
87658765
MSG_HASH(
87668766
MENU_ENUM_SUBLABEL_MANUAL_CONTENT_SCAN_SYSTEM_NAME_CUSTOM,
8767-
"Manually specify a 'system name' for scanned content. Only used when 'System Name' is set to '<Custom>'."
8767+
"Custom playlist name for scanned content."
87688768
)
87698769
MSG_HASH(
87708770
MENU_ENUM_LABEL_VALUE_MANUAL_CONTENT_SCAN_CORE_NAME,

0 commit comments

Comments
 (0)