diff --git a/CHANGELOG.md b/CHANGELOG.md index f1581282b..0ac875f42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# v1.7 (_14-04-2023_) + +## Added + - More options and flexibility to prevent files/folders to be scanned. Check [config.yml](docker/config.example.yml) example + - Config file example added to docker/config.example.yml +## Changed + - Rom details page revamped + - RomM logo revamped + # v1.6.5 (_12-04-2023_) ## Added diff --git a/README.md b/README.md index 95360eea8..63a9e3716 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@
-

RomM Logo

+

RomM Logo

GitHub GitHub release (latest SemVer) GitHub Workflow Status (with branch) @@ -111,21 +111,13 @@ RomM will try to find the structure 1 and if it doesn't exists, RomM will try to ## ⚙️ Config.yml file -RomM can be configured through a yml file. This is used to exclude platform folders and game files with a certain extension to be scanned. For a configuration change to take effect, RomM must be restarted. +RomM can be configured through a yml file. This is used to exclude platforms and/or roms to be scanned. -Check the [docker-compose.yml](https://github.com/zurdi15/romm/blob/master/docker/docker-compose.example.yml) to see where to bind it. +For a configuration change to take effect, RomM must be restarted. -Config file example: +Check the [config.yml](https://github.com/zurdi15/romm/blob/master/docker/config.example.yml) example. -``` -exclude: - folders: - - 'folder_1_to_exclude' - - 'folder_2_to_exclude' - files: - - 'txt' - - 'file_extension_to_exclude' -``` +Check the [docker-compose.yml](https://github.com/zurdi15/romm/blob/master/docker/docker-compose.example.yml) example to see how to bind it. # Naming convention diff --git a/backend/src/utils/fs.py b/backend/src/utils/fs.py index 7447e10e1..96e47ad13 100644 --- a/backend/src/utils/fs.py +++ b/backend/src/utils/fs.py @@ -21,6 +21,10 @@ def store_default_resources() -> None: # ========= Platforms utils ========= +def _exclude_platforms(platforms) -> list['str']: + [platforms.remove(excluded) for excluded in user_config['exclude']['platforms'] if excluded in platforms] + + def get_platforms() -> list[str]: """Gets all filesystem platforms @@ -30,7 +34,7 @@ def get_platforms() -> list[str]: try: platforms: list[str] = list(os.walk(HIGH_PRIO_STRUCTURE_PATH))[0][1] if os.path.exists(HIGH_PRIO_STRUCTURE_PATH) else list(os.walk(LIBRARY_BASE_PATH))[0][1] try: - [platforms.remove(excluded) for excluded in user_config['exclude']['folders'] if excluded in platforms] + _exclude_platforms(platforms) except (KeyError, TypeError): pass return platforms @@ -45,17 +49,65 @@ def _get_roms_structure(p_slug) -> tuple: return f"{HIGH_PRIO_STRUCTURE_PATH}/{p_slug}" if os.path.exists(HIGH_PRIO_STRUCTURE_PATH) else f"{LIBRARY_BASE_PATH}/{p_slug}/roms" -def _exclude_files(roms_files) -> list[str]: +def _exclude_single_roms(roms) -> list[str]: try: - excluded_files: list = user_config['exclude']['files'] - filtered_files: list = [] - for file_name in roms_files: - if file_name.split('.')[-1] in excluded_files: - filtered_files.append(file_name) - roms_files = [f for f in roms_files if f not in filtered_files] + excluded_extensions: list = [] + excluded_extensions = user_config['exclude']['roms']['single_file']['extensions'] except (TypeError, KeyError): pass - return roms_files + try: + excluded_names: list = [] + excluded_names = user_config['exclude']['roms']['single_file']['names'] + except (TypeError, KeyError): + pass + filtered_files: list = [] + for rom in roms: + try: + if rom.split('.')[-1] in excluded_extensions or rom in excluded_names: + filtered_files.append(rom) + except TypeError: + pass + roms = [f for f in roms if f not in filtered_files] + return roms + + +def _exclude_multi_roms(roms) -> list[str]: + try: + excluded_names: list = [] + excluded_names = user_config['exclude']['roms']['multi_file']['names'] + except (TypeError, KeyError): + pass + filtered_files: list = [] + for rom in roms: + try: + if rom in excluded_names: + filtered_files.append(rom) + except TypeError: + pass + roms = [f for f in roms if f not in filtered_files] + return roms + + +def _exclude_multi_roms_parts(parts) -> list[str]: + try: + excluded_extensions: list = [] + excluded_extensions = user_config['exclude']['roms']['multi_file']['parts']['extensions'] + except (TypeError, KeyError): + pass + try: + excluded_names: list = [] + excluded_names = user_config['exclude']['roms']['multi_file']['parts']['names'] + except (TypeError, KeyError): + pass + filtered_files: list = [] + for part in parts: + try: + if part.split('.')[-1] in excluded_extensions or part in excluded_names: + filtered_files.append(part) + except TypeError: + log.warning(f"Config file is malformed") + parts = [f for f in parts if f not in filtered_files] + return parts def parse_tags(file_name: str) -> tuple: @@ -80,7 +132,7 @@ def _get_file_extension(file: str) -> str: def _get_rom_files(multi: bool, rom: str, roms_path: str) -> list[str]: - return [] if not multi else _exclude_files(list(os.walk(f"{roms_path}/{rom}"))[0][2]) + return [] if not multi else _exclude_multi_roms_parts(list(os.walk(f"{roms_path}/{rom}"))[0][2]) def _get_file_size(multi: bool, rom: str, files: list, roms_path:str) -> str: @@ -102,14 +154,18 @@ def get_roms(p_slug: str, full_scan: bool, only_amount: bool = False) -> list[di """ roms_path = _get_roms_structure(p_slug) roms: list[dict] = [] - db_roms: list[str] = [rom.file_name for rom in dbh.get_roms(p_slug)] - fs_roms: list[dict] = [{'multi': False, 'file': rom} for rom in _exclude_files(list(os.walk(roms_path))[0][2])] + \ - [{'multi': True, 'file': rom} for rom in list(os.walk(roms_path))[0][1]] - if only_amount: return len(db_roms) + db_roms: list[str] = [rom.file_name for rom in dbh.get_roms(p_slug)] + + fs_single_roms: list[str] = list(os.walk(roms_path))[0][2] + fs_multi_roms: list[str] = list(os.walk(roms_path))[0][1] + fs_roms: list[dict] = [{'multi': False, 'file': rom} for rom in _exclude_single_roms(fs_single_roms)] + \ + [{'multi': True, 'file': rom} for rom in _exclude_multi_roms(fs_multi_roms)] + + if only_amount: return len(fs_roms) for rom in fs_roms: - if rom['file'] in db_roms and not full_scan: continue + if rom['file'] in db_roms and not full_scan and not rom['multi']: continue reg, rev, other_tags = parse_tags(rom['file']) file_extension: str = _get_file_extension(rom['file']) files: list = _get_rom_files(rom['multi'], rom['file'], roms_path) diff --git a/docker/config.example.yml b/docker/config.example.yml new file mode 100644 index 000000000..10f5ce6b2 --- /dev/null +++ b/docker/config.example.yml @@ -0,0 +1,31 @@ +exclude: + # Exclude platforms to be scanned + platforms: + - 'romm' + + # Exclude roms or parts of roms to be scanned + roms: + ## Single file games section + single_file: + # Exclude matched file names to be sanned + names: + - 'info.txt' + # Exclude all files with certain extensions to be scanned + extensions: + - 'xml' + + ## Multi files games section + multi_file: + # Exclude matched 'folder' (RomM identifies folders as multi file games) names to be scanned + names: + - 'my_multi_file_game' + - 'DLC' + parts: + # Exclude matched file names to be sanned from multi file roms + # Keep in mind that RomM doesn't scan folders inside multi files games, + # so there is no need to exclude folders from inside of multi files games. + names: + - 'data.xml' + # Exclude all files with certain extensions to be scanned from multi file roms + extensions: + - 'txt' \ No newline at end of file diff --git a/frontend/.env b/frontend/.env index e88ce292c..ad700cbb2 100644 --- a/frontend/.env +++ b/frontend/.env @@ -1 +1 @@ -VITE_ROMM_VERSION=1.6.5 \ No newline at end of file +VITE_ROMM_VERSION=1.7 \ No newline at end of file diff --git a/frontend/assets/romm.ico b/frontend/assets/old/romm.ico similarity index 100% rename from frontend/assets/romm.ico rename to frontend/assets/old/romm.ico diff --git a/frontend/assets/romm.png b/frontend/assets/old/romm.png similarity index 100% rename from frontend/assets/romm.png rename to frontend/assets/old/romm.png diff --git a/frontend/assets/romm_base.png b/frontend/assets/old/romm_base.png similarity index 100% rename from frontend/assets/romm_base.png rename to frontend/assets/old/romm_base.png diff --git a/frontend/assets/romm.svg b/frontend/assets/romm.svg new file mode 100644 index 000000000..c9bd21867 --- /dev/null +++ b/frontend/assets/romm.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/index.html b/frontend/index.html index 61beb32ea..08739aa03 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -3,7 +3,7 @@ - + RomM diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 02035abfe..f4ca3032c 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "romm", - "version": "1.6.5", + "version": "1.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "romm", - "version": "1.6.5", + "version": "1.7", "dependencies": { "@mdi/font": "7.0.96", "axios": "^1.3.4", diff --git a/frontend/package.json b/frontend/package.json index 612b70b78..f88aa0e07 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "romm", - "version": "1.6.5", + "version": "1.7", "private": true, "scripts": { "dev": "vite --host", diff --git a/frontend/public/favicon.ico b/frontend/public/favicon.ico deleted file mode 100644 index 73eb89e90..000000000 Binary files a/frontend/public/favicon.ico and /dev/null differ diff --git a/frontend/public/favicon.svg b/frontend/public/favicon.svg new file mode 100644 index 000000000..48a228114 --- /dev/null +++ b/frontend/public/favicon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/public/favicon128.ico b/frontend/public/favicon128.ico deleted file mode 100644 index d59cab51e..000000000 Binary files a/frontend/public/favicon128.ico and /dev/null differ diff --git a/frontend/public/favicon256.ico b/frontend/public/favicon256.ico deleted file mode 100644 index 4f6e05e9d..000000000 Binary files a/frontend/public/favicon256.ico and /dev/null differ diff --git a/frontend/src/App.vue b/frontend/src/App.vue index b125fec88..c38c41017 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -25,7 +25,7 @@ emitter.on('refresh', () => { refresh.value = !refresh.value }) - + diff --git a/frontend/src/components/AppBar/Base.vue b/frontend/src/components/AppBar/Base.vue index 220807374..5aafb0f08 100644 --- a/frontend/src/components/AppBar/Base.vue +++ b/frontend/src/components/AppBar/Base.vue @@ -1,6 +1,6 @@ @@ -59,4 +61,4 @@ const emitter = inject('emitter') .rom-title:not(.on-hover) { opacity: 0.85; } - \ No newline at end of file + diff --git a/frontend/src/components/GameEntry/ListItem/Header.vue b/frontend/src/components/GameEntry/ListItem/Header.vue index da340f4b5..bfb0ae2e9 100644 --- a/frontend/src/components/GameEntry/ListItem/Header.vue +++ b/frontend/src/components/GameEntry/ListItem/Header.vue @@ -10,6 +10,7 @@