diff --git a/backend/src/alembic/versions/1.6.3_rom_add_multi.py b/backend/src/alembic/versions/1.6.3_rom_add_multi.py
index eed4bff90..109b51e3d 100644
--- a/backend/src/alembic/versions/1.6.3_rom_add_multi.py
+++ b/backend/src/alembic/versions/1.6.3_rom_add_multi.py
@@ -2,7 +2,7 @@
Revision ID: 1.6.3
Revises: 1.6.2
-Create Date: 2023-04-10 11:54:23.748175
+Create Date: 2023-04-10 16:21:34.680282
"""
from alembic import op
@@ -19,10 +19,12 @@ depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('roms', sa.Column('multi', sa.Boolean(), nullable=True))
+ op.add_column('roms', sa.Column('files', sa.JSON(), nullable=True))
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
+ op.drop_column('roms', 'files')
op.drop_column('roms', 'multi')
# ### end Alembic commands ###
diff --git a/backend/src/main.py b/backend/src/main.py
index f5aefa4b6..a266392ea 100644
--- a/backend/src/main.py
+++ b/backend/src/main.py
@@ -1,3 +1,4 @@
+import sys
import subprocess
from subprocess import CalledProcessError
from fastapi import FastAPI, Request
@@ -22,6 +23,7 @@ async def startup() -> None:
subprocess.run(['alembic', 'upgrade', 'head'], check=True)
except CalledProcessError as e:
log.critical(f"Could not apply migrations: {e}")
+ sys.exit(4)
@app.put("/scan")
diff --git a/backend/src/models/rom.py b/backend/src/models/rom.py
index 68e749dfb..8ceca733c 100644
--- a/backend/src/models/rom.py
+++ b/backend/src/models/rom.py
@@ -17,7 +17,7 @@ class Rom(BaseModel):
file_name_no_tags = Column(String(length=450), default="")
file_extension = Column(String(length=10), default="")
file_path = Column(String(length=1000), default="")
- file_size = Column(Float, default="")
+ file_size = Column(Float, default=0.0)
name = Column(String(length=350), default="")
r_slug = Column(String(length=100), default="")
@@ -33,6 +33,7 @@ class Rom(BaseModel):
tags = Column(JSON, default=[])
multi = Column(Boolean, default=False)
+ files = Column(JSON, default=[])
@property
def full_path(self) -> str:
@@ -47,4 +48,5 @@ class Rom(BaseModel):
f"file_name: {self.file_name},"
f"file_path: {self.file_path},"
f"multi: {self.multi},"
+ f"files: {self.files}"
)
diff --git a/backend/src/utils/fs.py b/backend/src/utils/fs.py
index be3f919a1..47f0eb910 100644
--- a/backend/src/utils/fs.py
+++ b/backend/src/utils/fs.py
@@ -95,26 +95,31 @@ def get_roms(p_slug: str, full_scan: bool, only_amount: bool = False) -> list[di
only_amount: flag to return only amount of roms instead of all info
Returns: list with all the filesystem roms for a platform found in the LIBRARY_BASE_PATH. Just the amount of them if only_amount=True
"""
- roms: list[dict] = []
roms_path = _check_folder_structure(p_slug)
- roms_files: list = list(os.walk(roms_path))[0][2] + list(os.walk(roms_path))[0][1]
- roms_multi: list = []
- for rom_folder in list(os.walk(roms_path))[0][1]:
- roms_multi.append(list(os.walk(f"{roms_path}/{rom_folder}"))[0][2])
- roms_files = _exclude_files(roms_files)
+ roms: list[dict] = []
- if only_amount: return len(roms_files)
+ roms_files: list = _exclude_files(list(os.walk(roms_path))[0][2])
+ roms_files_multi: list = list(os.walk(roms_path))[0][1]
+
+ if only_amount: return len(roms_files) + len(roms_files_multi)
+
+ not_new_roms: list[str] = [rom.file_name for rom in dbh.get_roms(p_slug)]
- excluded_roms: list[str] = [rom.file_name for rom in dbh.get_roms(p_slug)]
for rom in roms_files:
- if rom in excluded_roms and not full_scan: continue
+ if rom in not_new_roms and not full_scan: continue
file_size: str = str(round(os.stat(f"{roms_path}/{rom}").st_size / (1024 * 1024), 2))
file_extension: str = rom.split('.')[-1] if '.' in rom else ""
reg, rev, other_tags = parse_tags(rom)
roms.append({'file_name': rom, 'file_path': roms_path, 'file_size': file_size, 'file_extension': file_extension,
'region': reg, 'revision': rev, 'tags': other_tags})
+
+ for rom_multi in roms_files_multi:
+ if rom_multi in not_new_roms and not full_scan: continue
+ reg, rev, other_tags = parse_tags(rom_multi)
+ roms.append({'file_name': rom_multi, 'file_path': roms_path, 'multi': True, 'files': list(os.walk(f"{roms_path}/{rom_multi}"))[0][2],
+ 'region': reg, 'revision': rev, 'tags': other_tags, 'multi': True})
+
log.info(f"Roms found for {p_slug}: {roms}")
- if only_amount: return 0
return roms
@@ -209,4 +214,3 @@ def get_cover_details(overwrite: bool, p_slug: str, file_name: str, url_cover: s
path_cover_l = _get_cover_path(p_slug, file_name, 'l')
has_cover = 1
return path_cover_s, path_cover_l, has_cover
-
diff --git a/frontend/package.json b/frontend/package.json
index 09840bc24..1e0d93ecf 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -1,6 +1,6 @@
{
"name": "romm",
- "version": "1.6.1",
+ "version": "1.6.3",
"private": true,
"scripts": {
"dev": "vite --host",
diff --git a/frontend/src/components/Navigation.vue b/frontend/src/components/Navigation.vue
index dcbe38d2a..7bc6fbb03 100644
--- a/frontend/src/components/Navigation.vue
+++ b/frontend/src/components/Navigation.vue
@@ -104,7 +104,7 @@ getPlatforms()
-
+
diff --git a/frontend/src/components/RomDetails.vue b/frontend/src/components/RomDetails.vue
index c27119bba..1f977cc01 100644
--- a/frontend/src/components/RomDetails.vue
+++ b/frontend/src/components/RomDetails.vue
@@ -134,17 +134,20 @@ async function deleteRom() {
- | IGDB id | {{ rom.r_igdb_id }} |
| Name | {{ rom.name }} |
- | File | {{ rom.file_name }} |
- | Path | {{ rom.file_path }} |
+ | File | {{ rom.file_name }} |
+ | Files |
+
+ |
+ | Platform | {{ rom.p_slug }} |
+ | Size | {{ rom.file_size }} MB |
+
+ | IGDB id | {{ rom.r_igdb_id }} |
| Region | {{ rom.region }} |
| Revision | {{ rom.revision }} |
| Tags | {{ tag }} |
- | Size | {{ rom.file_size }} MB |
- | Slug | {{ rom.r_slug }} |
- | Platform | {{ rom.p_slug }} |
- | Cover | {{ rom.path_cover_l }} |
+
+
| Summary | {{ rom.summary }} |