diff --git a/README.md b/README.md
index 63a9e3716..785181279 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,11 @@
diff --git a/backend/src/alembic/versions/1.7.1_.py b/backend/src/alembic/versions/1.7.1_.py
index b53666d11..882720232 100644
--- a/backend/src/alembic/versions/1.7.1_.py
+++ b/backend/src/alembic/versions/1.7.1_.py
@@ -1,4 +1,4 @@
-"""empty message
+"""add size units
Revision ID: 1.7.1
Revises: 1.6.3
diff --git a/backend/src/alembic/versions/1.7.2_.py b/backend/src/alembic/versions/1.7.2_.py
new file mode 100644
index 000000000..e1470ed8e
--- /dev/null
+++ b/backend/src/alembic/versions/1.7.2_.py
@@ -0,0 +1,32 @@
+"""empty message
+
+Revision ID: 1.7.2
+Revises: 1.7.1
+Create Date: 2023-04-17 12:03:19.163501
+
+"""
+from alembic import op
+import sqlalchemy as sa
+
+
+# revision identifiers, used by Alembic.
+revision = '1.7.2'
+down_revision = '1.7.1'
+branch_labels = None
+depends_on = None
+
+
+def upgrade() -> None:
+ # ### commands auto generated by Alembic - please adjust! ###
+ op.add_column('roms', sa.Column('p_name', sa.String(length=150), nullable=True))
+ op.add_column('roms', sa.Column('url_cover', sa.Text(), nullable=True))
+ op.alter_column('roms', 'name', new_column_name='r_name')
+ # ### end Alembic commands ###
+
+
+def downgrade() -> None:
+ # ### commands auto generated by Alembic - please adjust! ###
+ op.drop_column('roms', 'p_name')
+ op.drop_column('roms', 'url_cover')
+ op.alter_column('roms', 'r_name', new_column_name='name')
+ # ### end Alembic commands ###
diff --git a/backend/src/endpoints/platform.py b/backend/src/endpoints/platform.py
new file mode 100644
index 000000000..ccd9028a2
--- /dev/null
+++ b/backend/src/endpoints/platform.py
@@ -0,0 +1,12 @@
+from fastapi import APIRouter
+
+from handler import dbh
+
+router = APIRouter()
+
+
+@router.get("/platforms")
+def platforms() -> dict:
+ """Returns platforms data"""
+
+ return {'data': dbh.get_platforms()}
diff --git a/backend/src/endpoints/rom.py b/backend/src/endpoints/rom.py
new file mode 100644
index 000000000..7099ec1cc
--- /dev/null
+++ b/backend/src/endpoints/rom.py
@@ -0,0 +1,56 @@
+from fastapi import APIRouter, Request
+
+from logger.logger import log, COLORS
+from handler import igdbh, dbh
+from utils import fs
+
+router = APIRouter()
+
+
+@router.get("/platforms/{p_slug}/roms/{file_name}")
+def rom(p_slug: str, file_name: str) -> dict:
+ """Returns one rom data of the desired platform"""
+
+ return {'data': dbh.get_rom(p_slug, file_name)}
+
+
+@router.get("/platforms/{p_slug}/roms")
+def roms(p_slug: str) -> dict:
+ """Returns all roms of the desired platform"""
+
+ return {'data': dbh.get_roms(p_slug)}
+
+
+@router.patch("/platforms/{p_slug}/roms")
+async def updateRom(req: Request, p_slug: str) -> dict:
+ """Updates rom details"""
+
+ data: dict = await req.json()
+ rom: dict = data['rom']
+ updatedRom: dict = data['updatedRom']
+ log.info(f"Updating {COLORS['orange']}{updatedRom['file_name']}{COLORS['reset']} details")
+ updatedRom.update(igdbh.get_rom_details(updatedRom['file_name'], rom['p_igdb_id'], updatedRom['r_igdb_id']))
+ updatedRom.update(fs.get_cover_details(True, p_slug, updatedRom['file_name'], updatedRom['url_cover']))
+ updatedRom['p_igdb_id'] = rom['p_igdb_id']
+ updatedRom['p_slug'] = p_slug
+ updatedRom['file_path'] = rom['file_path']
+ updatedRom['file_size'] = rom['file_size']
+ updatedRom['multi'] = rom['multi']
+ updatedRom['file_extension'] = fs.get_file_extension(updatedRom)
+ reg, rev, other_tags = fs.parse_tags(updatedRom['file_name'])
+ updatedRom.update({'region': reg, 'revision': rev, 'tags': other_tags})
+ fs.rename_rom(p_slug, rom['file_name'], updatedRom['file_name'])
+ dbh.update_rom(p_slug, rom['file_name'], updatedRom)
+ return {'data': updatedRom}
+
+
+@router.delete("/platforms/{p_slug}/roms/{file_name}")
+def remove_rom(p_slug: str, file_name: str, filesystem: bool=False) -> dict:
+ """Detele rom from filesystem and database"""
+
+ log.info(f"Deleting {file_name} from database")
+ dbh.delete_rom(p_slug, file_name)
+ if filesystem:
+ log.info(f"Removing {file_name} from filesystem")
+ fs.remove_rom(p_slug, file_name)
+ return {'msg': 'success'}
diff --git a/backend/src/endpoints/scan.py b/backend/src/endpoints/scan.py
new file mode 100644
index 000000000..5e7bebb62
--- /dev/null
+++ b/backend/src/endpoints/scan.py
@@ -0,0 +1,37 @@
+from fastapi import APIRouter
+import emoji
+import json
+
+from logger.logger import log, COLORS
+from utils import fs, fastapi
+from handler import dbh
+from models.platform import Platform
+
+router = APIRouter()
+
+
+@router.get("/scan")
+def scan(platforms: str, full_scan: bool=False) -> dict:
+ """Scan platforms and roms and write them in database."""
+
+ log.info(emoji.emojize(":magnifying_glass_tilted_right: Scanning "))
+ fs.store_default_resources()
+ fs_platforms: list[str] = fs.get_platforms()
+ platforms: list[str] = json.loads(platforms) if len(json.loads(platforms)) > 0 else fs_platforms
+ log.info(f"Platforms to be scanned: {', '.join(platforms)}")
+ for p_slug in platforms:
+ log.info(emoji.emojize(f":video_game: {p_slug} {COLORS['reset']}"))
+ platform: Platform = fastapi.scan_platform(p_slug)
+ if p_slug != str(platform): log.info(f"Identified as {COLORS['blue']}{platform}{COLORS['reset']}")
+ dbh.add_platform(platform)
+ log.info(f"Searching new roms")
+ roms: list[dict] = fs.get_roms(p_slug, full_scan)
+ for rom in roms:
+ log.info(f"Getting {COLORS['orange']}{rom['file_name']}{COLORS['reset']} details")
+ if rom['multi']: [log.info(f"\t - {COLORS['orange_i']}{file}{COLORS['reset']}") for file in rom['files']]
+ rom = fastapi.scan_rom(platform, rom)
+ dbh.add_rom(rom)
+ log.info(emoji.emojize(":wastebasket: Purging database"))
+ [dbh.purge_roms(p_slug, fs.get_roms(p_slug, True)) for p_slug in platforms]
+ dbh.purge_platforms(fs_platforms)
+ return {'msg': 'success'}
\ No newline at end of file
diff --git a/backend/src/endpoints/search.py b/backend/src/endpoints/search.py
new file mode 100644
index 000000000..21c64e759
--- /dev/null
+++ b/backend/src/endpoints/search.py
@@ -0,0 +1,24 @@
+from fastapi import APIRouter, Request
+import emoji
+
+from logger.logger import log, COLORS
+from handler import igdbh
+
+router = APIRouter()
+
+
+@router.put("/search/roms/igdb")
+async def search_rom_igdb(req: Request, igdb_id: str = None) -> dict:
+ """Get all the roms matched from igdb."""
+
+ data: dict = await req.json()
+ log.info(emoji.emojize(":magnifying_glass_tilted_right: IGDB Searching"))
+ if igdb_id:
+ log.info(f"Searching by id: {igdb_id}")
+ matched_roms = igdbh.get_matched_roms_by_id(igdb_id)
+ else:
+ log.info(emoji.emojize(f":video_game: {data['rom']['p_slug']}: {COLORS['orange']}{data['rom']['file_name']}{COLORS['reset']}"))
+ matched_roms = igdbh.get_matched_roms(data['rom']['file_name'], data['rom']['p_igdb_id'], data['rom']['p_slug'])
+ log.info("Results:")
+ [log.info(f"\t - {COLORS['blue']}{rom['r_name']}{COLORS['reset']}") for rom in matched_roms]
+ return {'data': matched_roms}
diff --git a/backend/src/handler/igdb_handler.py b/backend/src/handler/igdb_handler.py
index 64e0125ae..107a11dc5 100644
--- a/backend/src/handler/igdb_handler.py
+++ b/backend/src/handler/igdb_handler.py
@@ -48,8 +48,8 @@ class IGDBHandler():
def get_rom_details(self, file_name: str, p_igdb_id: int, r_igdb_id_search: str) -> dict:
file_name_no_tags: str = re.sub('[\(\[].*?[\)\]]', '', file_name.split('.')[0])
r_igdb_id: str = ""
- slug: str = ""
- name: str = ""
+ r_slug: str = ""
+ r_name: str = ""
summary: str = ""
url_cover: str = ""
@@ -57,8 +57,8 @@ class IGDBHandler():
res_details: dict = requests.post("https://api.igdb.com/v4/games/", headers=self.headers,
data=f"fields id, slug, name, summary; where id={r_igdb_id_search};").json()[0]
r_igdb_id = res_details['id']
- slug = res_details['slug']
- name = res_details['name']
+ r_slug = res_details['slug']
+ r_name = res_details['name']
try:
summary = res_details['summary']
except KeyError:
@@ -72,8 +72,8 @@ class IGDBHandler():
res_details: dict = requests.post("https://api.igdb.com/v4/games/", headers=self.headers,
data=f"search \"{search_term}\";fields id, slug, name, summary; where platforms=[{p_igdb_id}] & category=0;").json()[0]
r_igdb_id = res_details['id']
- slug = res_details['slug']
- name = res_details['name']
+ r_slug = res_details['slug']
+ r_name = res_details['name']
try:
summary = res_details['summary']
except KeyError:
@@ -83,8 +83,8 @@ class IGDBHandler():
res_details: dict = requests.post("https://api.igdb.com/v4/games/", headers=self.headers,
data=f"search \"{search_term}\";fields name, id, slug, summary; where platforms=[{p_igdb_id}] & category=10;").json()[0]
r_igdb_id = res_details['id']
- slug = res_details['slug']
- name = res_details['name']
+ r_slug = res_details['slug']
+ r_name = res_details['name']
try:
summary = res_details['summary']
except KeyError:
@@ -94,8 +94,8 @@ class IGDBHandler():
res_details: dict = requests.post("https://api.igdb.com/v4/games/", headers=self.headers,
data=f"search \"{search_term}\";fields name, id, slug, summary; where platforms=[{p_igdb_id}];").json()[0]
r_igdb_id = res_details['id']
- slug = res_details['slug']
- name = res_details['name']
+ r_slug = res_details['slug']
+ r_name = res_details['name']
try:
summary = res_details['summary']
except KeyError:
@@ -108,9 +108,9 @@ class IGDBHandler():
data=f"fields url; where game={r_igdb_id};").json()[0]
url_cover: str = f"https:{res_details['url']}"
except IndexError:
- log.warning(f"{name} cover not found in IGDB")
- if not name: name = file_name_no_tags
- return (r_igdb_id, file_name_no_tags, slug, name, summary, url_cover)
+ log.warning(f"{r_name} cover not found in IGDB")
+ if not r_name: r_name = file_name_no_tags
+ return {'r_igdb_id': r_igdb_id, 'file_name_no_tags': file_name_no_tags, 'r_slug': r_slug, 'r_name': r_name, 'summary': summary, 'url_cover': url_cover}
@check_twitch_token
@@ -129,23 +129,28 @@ class IGDBHandler():
rom['url_cover'] = DEFAULT_URL_COVER_L
rom['r_igdb_id'] = rom.pop('id')
rom['r_slug'] = rom.pop('slug')
+ rom['r_name'] = rom.pop('name')
else:
log.warning(f"{p_slug} is not supported!")
return matched_roms
def get_matched_roms_by_id(self, igdb_id: str) -> list:
- matched_roms: list[dict] = []
- matched_roms: list = requests.post("https://api.igdb.com/v4/games/", headers=self.headers,
- data=f"fields name, id, slug, summary; where id={igdb_id};").json()
- for rom in matched_roms:
- try:
- res_details: dict = requests.post("https://api.igdb.com/v4/covers/", headers=self.headers,
- data=f"fields url; where game={rom['id']};").json()[0]
- rom['url_cover'] = f"https:{res_details['url']}".replace('t_thumb', f't_cover_big')
- except IndexError:
- rom['url_cover'] = DEFAULT_URL_COVER_L
- rom['r_igdb_id'] = rom.pop('id')
- rom['r_slug'] = rom.pop('slug')
+ res: list = requests.post("https://api.igdb.com/v4/games/", headers=self.headers,
+ data=f"fields name, id, slug, summary; where id={igdb_id};")
+ if res.status_code == 200:
+ matched_roms = res.json()
+ for rom in matched_roms:
+ try:
+ res_details: dict = requests.post("https://api.igdb.com/v4/covers/", headers=self.headers,
+ data=f"fields url; where game={rom['id']};").json()[0]
+ rom['url_cover'] = f"https:{res_details['url']}".replace('t_thumb', f't_cover_big')
+ except IndexError:
+ rom['url_cover'] = DEFAULT_URL_COVER_L
+ rom['r_igdb_id'] = rom.pop('id')
+ rom['r_slug'] = rom.pop('slug')
+ rom['r_name'] = rom.pop('name')
+ else:
+ matched_roms: list = []
return matched_roms
diff --git a/backend/src/main.py b/backend/src/main.py
index d13df73d7..65a22bb9b 100644
--- a/backend/src/main.py
+++ b/backend/src/main.py
@@ -1,17 +1,24 @@
-from fastapi import FastAPI, Request
+from fastapi import FastAPI
+from fastapi.middleware.cors import CORSMiddleware
import uvicorn
-import json
-import emoji
-from logger.logger import log, COLORS
-from handler import igdbh, dbh
from config import DEV_PORT, DEV_HOST
-from models.platform import Platform
-from utils import fs, fastapi
+from utils import fastapi
+from endpoints import scan, search, platform, rom
app = FastAPI()
-fastapi.allow_cors(app)
+app.add_middleware(
+ CORSMiddleware,
+ allow_origins=["*"],
+ allow_credentials=True,
+ allow_methods=["*"],
+ allow_headers=["*"],
+)
+app.include_router(scan.router)
+app.include_router(search.router)
+app.include_router(platform.router)
+app.include_router(rom.router)
@app.on_event("startup")
@@ -20,116 +27,5 @@ def startup() -> None:
pass
-@app.get("/scan")
-def scan(platforms: str, full_scan: bool=False) -> dict:
- """Scan platforms and roms and write them in database."""
-
- log.info(emoji.emojize(":magnifying_glass_tilted_right: Scanning "))
- fs.store_default_resources()
- fs_platforms: list[str] = fs.get_platforms()
- platforms: list[str] = json.loads(platforms) if len(json.loads(platforms)) > 0 else fs_platforms
- log.info(f"Platforms to be scanned: {', '.join(platforms)}")
- for p_slug in platforms:
- log.info(emoji.emojize(f":video_game: {p_slug} {COLORS['reset']}"))
- platform: Platform = fastapi.scan_platform(p_slug)
- if p_slug != str(platform): log.info(f"Identified as {COLORS['blue']}{platform}{COLORS['reset']}")
- dbh.add_platform(platform)
- log.info(f"Searching new roms")
- roms: list[dict] = fs.get_roms(p_slug, full_scan)
- for rom in roms:
- log.info(f"Getting {COLORS['orange']}{rom['file_name']}{COLORS['reset']} details")
- if rom['multi']: [log.info(f"\t - {COLORS['orange_i']}{file}{COLORS['reset']}") for file in rom['files']]
- rom = fastapi.scan_rom(platform, rom)
- dbh.add_rom(rom)
- log.info(emoji.emojize(":wastebasket: Purging database"))
- [dbh.purge_roms(p_slug, fs.get_roms(p_slug, True)) for p_slug in platforms]
- dbh.purge_platforms(fs_platforms)
- return {'msg': 'success'}
-
-
-@app.get("/platforms")
-def platforms() -> dict:
- """Returns platforms data"""
-
- return {'data': dbh.get_platforms()}
-
-
-@app.get("/platforms/{p_slug}/roms/{file_name}")
-def rom(p_slug: str, file_name: str) -> dict:
- """Returns one rom data of the desired platform"""
-
- return {'data': {
- **dbh.get_rom(p_slug, file_name).__dict__,
- 'platform': dbh.get_platform(p_slug)
- }}
-
-
-@app.get("/platforms/{p_slug}/roms")
-def roms(p_slug: str) -> dict:
- """Returns all roms of the desired platform"""
-
- return {'data': dbh.get_roms(p_slug)}
-
-
-@app.patch("/platforms/{p_slug}/roms")
-async def updateRom(req: Request, p_slug: str) -> dict:
- """Updates rom details"""
-
- data: dict = await req.json()
- rom: dict = data['rom']
- updatedRom: dict = data['updatedRom']
- log.info(f"Updating {COLORS['orange']}{updatedRom['file_name']}{COLORS['reset']} details")
- r_igdb_id, file_name_no_tags, r_slug, r_name, summary, url_cover = igdbh.get_rom_details(updatedRom['file_name'], rom['p_igdb_id'], updatedRom['r_igdb_id'])
- path_cover_s, path_cover_l, has_cover = fs.get_cover_details(True, p_slug, updatedRom['file_name'], url_cover)
- updatedRom['file_name_no_tags'] = file_name_no_tags
- updatedRom['r_igdb_id'] = r_igdb_id
- updatedRom['p_igdb_id'] = rom['p_igdb_id']
- updatedRom['r_slug'] = r_slug
- updatedRom['p_slug'] = p_slug
- updatedRom['name'] = r_name
- updatedRom['summary'] = summary
- updatedRom['path_cover_s'] = path_cover_s
- updatedRom['path_cover_l'] = path_cover_l
- updatedRom['has_cover'] = has_cover
- updatedRom['file_path'] = rom['file_path']
- updatedRom['file_size'] = rom['file_size']
- updatedRom['file_extension'] = updatedRom['file_name'].split('.')[-1] if '.' in updatedRom['file_name'] else ""
- reg, rev, other_tags = fs.parse_tags(updatedRom['file_name'])
- updatedRom.update({'region': reg, 'revision': rev, 'tags': other_tags})
- if 'url_cover' in updatedRom.keys(): del updatedRom['url_cover']
- fs.rename_rom(p_slug, rom['file_name'], updatedRom['file_name'])
- dbh.update_rom(p_slug, rom['file_name'], updatedRom)
- return {'data': updatedRom}
-
-
-@app.delete("/platforms/{p_slug}/roms/{file_name}")
-def remove_rom(p_slug: str, file_name: str, filesystem: bool=False) -> dict:
- """Detele rom from filesystem and database"""
-
- log.info(f"Deleting {file_name} from database")
- dbh.delete_rom(p_slug, file_name)
- if filesystem:
- log.info(f"Removing {file_name} from filesystem")
- fs.remove_rom(p_slug, file_name)
- return {'msg': 'success'}
-
-
-@app.put("/search/roms/igdb")
-async def search_rom_igdb(req: Request, igdb_id: str=None) -> dict:
- """Get all the roms matched from igdb."""
-
- data: dict = await req.json()
- log.info(emoji.emojize(":magnifying_glass_tilted_right: IGDB Searching"))
- if igdb_id:
- log.info(f"Searching by id: {igdb_id}")
- matched_roms = igdbh.get_matched_roms_by_id(igdb_id)
- else:
- log.info(emoji.emojize(f":video_game: {data['rom']['p_slug']}: {COLORS['orange']}{data['rom']['file_name']}{COLORS['reset']}"))
- matched_roms = igdbh.get_matched_roms(data['rom']['file_name'], data['rom']['p_igdb_id'], data['rom']['p_slug'])
- log.info("Results:")
- [log.info(f"\t - {COLORS['blue']}{rom['name']}{COLORS['reset']}") for rom in matched_roms]
- return {'data': matched_roms}
-
-
if __name__ == '__main__':
uvicorn.run("main:app", host=DEV_HOST, port=DEV_PORT, reload=True)
diff --git a/backend/src/models/rom.py b/backend/src/models/rom.py
index d499ae1b6..f8e58f21c 100644
--- a/backend/src/models/rom.py
+++ b/backend/src/models/rom.py
@@ -12,6 +12,7 @@ class Rom(BaseModel):
p_sgdb_id = Column(String(length=10), default="")
p_slug = Column(String(length=50), primary_key=True)
+ p_name = Column(String(length=150))
file_name = Column(String(length=450), primary_key=True)
file_name_no_tags = Column(String(length=450), default="")
@@ -20,7 +21,7 @@ class Rom(BaseModel):
file_size = Column(Float, default=0.0)
file_size_units = Column(String(length=10), default="")
- name = Column(String(length=350), default="")
+ r_name = Column(String(length=350), default="")
r_slug = Column(String(length=100), default="")
summary = Column(Text, default="")
@@ -28,6 +29,7 @@ class Rom(BaseModel):
path_cover_s = Column(Text, default=DEFAULT_PATH_COVER_S)
path_cover_l = Column(Text, default=DEFAULT_PATH_COVER_L)
has_cover = Column(Boolean, default=False)
+ url_cover = Column(Text, default=DEFAULT_PATH_COVER_L)
region = Column(String(20), default="")
revision = Column(String(20), default="")
diff --git a/backend/src/utils/fastapi.py b/backend/src/utils/fastapi.py
index a0eff8327..6fd3a7c18 100644
--- a/backend/src/utils/fastapi.py
+++ b/backend/src/utils/fastapi.py
@@ -1,21 +1,7 @@
-from fastapi import FastAPI
-from fastapi.middleware.cors import CORSMiddleware
-
from handler import igdbh
from utils import fs
from models.platform import Platform
from models.rom import Rom
-from logger.logger import log
-
-
-def allow_cors(app: FastAPI) -> None:
- app.add_middleware(
- CORSMiddleware,
- allow_origins=["*"],
- allow_credentials=True,
- allow_methods=["*"],
- allow_headers=["*"],
- )
def scan_platform(p_slug: str) -> Platform:
@@ -33,17 +19,10 @@ def scan_platform(p_slug: str) -> Platform:
def scan_rom(platform: Platform, rom: dict, r_igbd_id_search: str = '', overwrite: bool = False) -> None:
- r_igdb_id, file_name_no_tags, r_slug, r_name, summary, url_cover = igdbh.get_rom_details(rom['file_name'], platform.igdb_id, r_igbd_id_search)
- path_cover_s, path_cover_l, has_cover = fs.get_cover_details(overwrite, platform.slug, rom['file_name'], url_cover)
- rom['file_name_no_tags'] = file_name_no_tags
- rom['r_igdb_id'] = r_igdb_id
+ rom.update(igdbh.get_rom_details(rom['file_name'], platform.igdb_id, r_igbd_id_search))
+ rom.update(fs.get_cover_details(overwrite, platform.slug, rom['file_name'], rom['url_cover']))
rom['p_igdb_id'] = platform.igdb_id
- rom['r_slug'] = r_slug
rom['p_slug'] = platform.slug
- rom['name'] = r_name
- rom['summary'] = summary
- rom['path_cover_s'] = path_cover_s
- rom['path_cover_l'] = path_cover_l
- rom['has_cover'] = has_cover
+ rom['p_name'] = platform.name
rom = Rom(**rom)
return rom
diff --git a/backend/src/utils/fs.py b/backend/src/utils/fs.py
index 9e3bb929d..a4212e51d 100644
--- a/backend/src/utils/fs.py
+++ b/backend/src/utils/fs.py
@@ -127,8 +127,8 @@ def parse_tags(file_name: str) -> tuple:
return reg, rev, other_tags
-def _get_file_extension(rom: dict) -> str:
- return rom['file'].split('.')[-1] if not rom['multi'] else ''
+def get_file_extension(rom: dict) -> str:
+ return rom['file_name'].split('.')[-1] if not rom['multi'] else ''
def _get_rom_files(multi: bool, rom: str, roms_path: str) -> list[str]:
@@ -166,18 +166,18 @@ def get_roms(p_slug: str, full_scan: bool, only_amount: bool = False) -> list[di
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)]
+ fs_roms: list[dict] = [{'multi': False, 'file_name': rom} for rom in _exclude_single_roms(fs_single_roms)] + \
+ [{'multi': True, 'file_name': 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 and not rom['multi']: continue
- reg, rev, other_tags = parse_tags(rom['file'])
- file_extension: str = _get_file_extension(rom)
- files: list = _get_rom_files(rom['multi'], rom['file'], roms_path)
- file_size, file_size_units = _get_file_size(rom['multi'], rom['file'], files, roms_path)
- roms.append({'file_name': rom['file'], 'file_path': roms_path, 'multi': rom['multi'],
+ if rom['file_name'] in db_roms and not full_scan and not rom['multi']: continue
+ reg, rev, other_tags = parse_tags(rom['file_name'])
+ file_extension: str = get_file_extension(rom)
+ files: list = _get_rom_files(rom['multi'], rom['file_name'], roms_path)
+ file_size, file_size_units = _get_file_size(rom['multi'], rom['file_name'], files, roms_path)
+ roms.append({'file_name': rom['file_name'], 'file_path': roms_path, 'multi': rom['multi'],
'files': files, 'file_size': file_size, 'file_size_units': file_size_units, 'file_extension': file_extension,
'region': reg, 'revision': rev, 'tags': other_tags})
return roms
@@ -278,4 +278,4 @@ def get_cover_details(overwrite: bool, p_slug: str, file_name: str, url_cover: s
if _cover_exists(p_slug, file_name, 'l'):
path_cover_l = _get_cover_path(p_slug, file_name, 'l')
has_cover = 1
- return path_cover_s, path_cover_l, has_cover
+ return {'path_cover_s': path_cover_s, 'path_cover_l': path_cover_l, 'has_cover': has_cover}
diff --git a/frontend/.env b/frontend/.env
index 481f0e387..991c5025e 100644
--- a/frontend/.env
+++ b/frontend/.env
@@ -1 +1 @@
-VITE_ROMM_VERSION=1.7.1
\ No newline at end of file
+VITE_ROMM_VERSION=1.7.2
\ No newline at end of file
diff --git a/frontend/index.html b/frontend/index.html
index 08739aa03..3aede4431 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 ced47a315..7c43a5f34 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "romm",
- "version": "1.7.1",
+ "version": "1.7.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "romm",
- "version": "1.7.1",
+ "version": "1.7.2",
"dependencies": {
"@mdi/font": "7.0.96",
"axios": "^1.3.4",
diff --git a/frontend/package.json b/frontend/package.json
index 7159d72b1..af3b395fb 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -1,6 +1,6 @@
{
"name": "romm",
- "version": "1.7.1",
+ "version": "1.7.2",
"private": true,
"scripts": {
"dev": "vite --host",
diff --git a/frontend/public/favicon.ico b/frontend/public/favicon.ico
new file mode 100644
index 000000000..47aded8d2
Binary files /dev/null and b/frontend/public/favicon.ico differ
diff --git a/frontend/public/favicon.svg b/frontend/public/favicon.svg
deleted file mode 100644
index 48a228114..000000000
--- a/frontend/public/favicon.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/frontend/src/App.vue b/frontend/src/App.vue
index d826b65b7..ad630fe19 100644
--- a/frontend/src/App.vue
+++ b/frontend/src/App.vue
@@ -58,25 +58,4 @@ emitter.on('refresh', () => { refresh.value = !refresh.value })
background-color: #808080;
border-radius: 5px;
}
-
-rommDark {
- primary: #161b22;
- secondary: #a452fe;
- background: #0d1117;
-
- notification: #0d1117;
- surface: #161b22;
- tooltip: #161b22;
- chip: #161b22;
-
- rommAccent1: #a452fe;
- rommAccent2: #9a00ea;
- rommAccent3: #7b00e1;
- rommAccent4: #702bcf;
- rommAccent5: #3808a4;
- rommWhite: #fefdfe;
- rommBlack: #000000;
- rommRed: #da3633;
-}
-
diff --git a/frontend/src/components/AppBar/Base.vue b/frontend/src/components/AppBar/Base.vue
index 4263d414b..23553ee82 100644
--- a/frontend/src/components/AppBar/Base.vue
+++ b/frontend/src/components/AppBar/Base.vue
@@ -23,9 +23,9 @@ async function goHome(){
-
+
-
+
diff --git a/frontend/src/components/GameGallery/Card/Cover.vue b/frontend/src/components/GameGallery/Card/Cover.vue
index dd8785502..1d86bd838 100644
--- a/frontend/src/components/GameGallery/Card/Cover.vue
+++ b/frontend/src/components/GameGallery/Card/Cover.vue
@@ -18,7 +18,7 @@ const forceImgReload = Date.now()
cover>
-
+
diff --git a/frontend/src/components/GameGallery/ListItem/Item.vue b/frontend/src/components/GameGallery/ListItem/Item.vue
index 365d75c6d..868e568a1 100644
--- a/frontend/src/components/GameGallery/ListItem/Item.vue
+++ b/frontend/src/components/GameGallery/ListItem/Item.vue
@@ -18,7 +18,7 @@ const emitter = inject('emitter')
:key="rom.file_name"
class="pa-2">
- {{ rom.name }}
+ {{ rom.r_name }}
{{ rom.file_name }}
{{ rom.p_slug }}
{{ rom.file_size }} {{ rom.file_size_units }}
diff --git a/frontend/src/components/PlatformsDrawer/Platform.vue b/frontend/src/components/PlatformsDrawer/Platform.vue
index 3a1d1d05d..7f4a98933 100644
--- a/frontend/src/components/PlatformsDrawer/Platform.vue
+++ b/frontend/src/components/PlatformsDrawer/Platform.vue
@@ -12,7 +12,7 @@ const props = defineProps(['platform', 'rail'])
- {{ platform.n_roms }}
+ {{ platform.n_roms }}
diff --git a/frontend/src/components/PlatformsDrawer/RailBtn.vue b/frontend/src/components/PlatformsDrawer/RailBtn.vue
index 713844969..570cf1e67 100644
--- a/frontend/src/components/PlatformsDrawer/RailBtn.vue
+++ b/frontend/src/components/PlatformsDrawer/RailBtn.vue
@@ -12,6 +12,7 @@ const emitter = inject('emitter')
mdi-arrow-collapse-right
mdi-arrow-collapse-left
diff --git a/frontend/src/components/SettingsDrawer/Base.vue b/frontend/src/components/SettingsDrawer/Base.vue
index 27f90a4e2..d6b0431a4 100644
--- a/frontend/src/components/SettingsDrawer/Base.vue
+++ b/frontend/src/components/SettingsDrawer/Base.vue
@@ -3,7 +3,7 @@ import { ref, inject } from "vue"
import SettingsHeader from '@/components/SettingsDrawer/Header.vue'
import Scan from '@/components/SettingsDrawer/Scan.vue'
import ThemeToggle from '@/components/SettingsDrawer/ThemeToggle.vue'
-import VersionLabel from '@/components/SettingsDrawer/VersionLabel.vue'
+import SettingsFooter from '@/components/SettingsDrawer/Footer.vue'
// Props
const settingsDrawer = ref(false)
@@ -19,7 +19,7 @@ emitter.on('toggleSettings', () => { settingsDrawer.value = !settingsDrawer.valu
v-model="settingsDrawer"
location="right"
width="270"
- class="bg-background"
+ class="bg-secondary"
temporary
floating>
@@ -33,7 +33,7 @@ emitter.on('toggleSettings', () => { settingsDrawer.value = !settingsDrawer.valu
-
+
diff --git a/frontend/src/components/SettingsDrawer/VersionLabel.vue b/frontend/src/components/SettingsDrawer/Footer.vue
similarity index 66%
rename from frontend/src/components/SettingsDrawer/VersionLabel.vue
rename to frontend/src/components/SettingsDrawer/Footer.vue
index 5237aa6bd..57411281f 100644
--- a/frontend/src/components/SettingsDrawer/VersionLabel.vue
+++ b/frontend/src/components/SettingsDrawer/Footer.vue
@@ -4,6 +4,6 @@ const ROMM_VERSION = import.meta.env.VITE_ROMM_VERSION
- RomM v{{ ROMM_VERSION }}
+ RomM v{{ ROMM_VERSION }}
\ No newline at end of file
diff --git a/frontend/src/components/SettingsDrawer/Scan.vue b/frontend/src/components/SettingsDrawer/Scan.vue
index be5e281f3..08975258c 100644
--- a/frontend/src/components/SettingsDrawer/Scan.vue
+++ b/frontend/src/components/SettingsDrawer/Scan.vue
@@ -54,14 +54,14 @@ async function scan() {
@click="scan()"
:disabled="scanning"
prepend-icon="mdi-magnify-scan"
- class="ml-7 bg-scanBtn"
+ class="ml-7"
rounded="0"
inset>
Scan
diff --git a/frontend/src/plugins/vuetify.js b/frontend/src/plugins/vuetify.js
index 32ca4e2d6..3b3dea398 100644
--- a/frontend/src/plugins/vuetify.js
+++ b/frontend/src/plugins/vuetify.js
@@ -7,53 +7,11 @@
// Styles
import '@mdi/font/css/materialdesignicons.css'
import 'vuetify/styles'
+import { rommDark, rommLight } from '@/styles/themes.js'
// Composables
import { createVuetify } from 'vuetify'
-const rommDark = {
- dark: true,
- colors: {
- primary: '#161b22',
- secondary: '#a452fe',
- background: '#0d1117',
-
- notification: '#0d1117',
- surface: '#161b22',
- tooltip: '#161b22',
- chip: '#161b22',
-
- rommAccent1: '#a452fe',
- rommAccent2: '#c400f7',
- rommAccent2: '#3808a4',
- rommWhite: '#fefdfe',
- rommBlack: '#000000',
- rommRed: '#da3633',
- rommGreen: '#3FB950'
- }
-}
-const rommLight = {
- dark: false,
- colors: {
- primary: '#fefdfe',
- secondary: '#a452fe',
- background: '#fefdfe',
-
- notification: '#0d1117',
- surface: '#fefdfe',
- tooltip: '#fefdfe',
- chip: '#161b22',
-
- rommAccent1: '#a452fe',
- rommAccent2: '#c400f7',
- rommAccent2: '#3808a4',
- rommWhite: '#fefdfe',
- rommBlack: '#000000',
- rommRed: '#da3633',
- rommGreen: '#3FB950'
- }
-}
-
export default createVuetify({
icons: {
iconfont: 'mdi'
diff --git a/frontend/src/styles/themes.js b/frontend/src/styles/themes.js
new file mode 100644
index 000000000..f4230600f
--- /dev/null
+++ b/frontend/src/styles/themes.js
@@ -0,0 +1,43 @@
+export const rommDark = {
+ dark: true,
+ colors: {
+ primary: '#161b22',
+ secondary: '#0d1117',
+ background: '#0d1117',
+
+ surface: '#161b22',
+ tooltip: '#161b22',
+ chip: '#161b22',
+
+ rommAccent1: '#a452fe',
+ rommAccent2: '#c400f7',
+ rommAccent3: '#3808a4',
+
+ rommRed: '#da3633',
+ rommGreen: '#3FB950',
+ rommWhite: '#fefdfe',
+ rommBlack: '#000000',
+ }
+}
+
+export const rommLight = {
+ dark: false,
+ colors: {
+ primary: '#fefdfe',
+ secondary: '#fefdfe',
+ background: '#fefdfe',
+
+ surface: '#fefdfe',
+ tooltip: '#fefdfe',
+ chip: '#fefdfe',
+
+ rommAccent1: '#a452fe',
+ rommAccent2: '#c400f7',
+ rommAccent3: '#3808a4',
+
+ rommRed: '#da3633',
+ rommGreen: '#3FB950',
+ rommWhite: '#fefdfe',
+ rommBlack: '#000000',
+ }
+}
\ No newline at end of file
diff --git a/frontend/src/views/Details.vue b/frontend/src/views/Details.vue
index 227dc1377..8ef0c44d1 100644
--- a/frontend/src/views/Details.vue
+++ b/frontend/src/views/Details.vue
@@ -24,11 +24,13 @@ const dialogSearchRom = ref(false)
const dialogEditRom = ref(false)
const dialogDeleteRom = ref(false)
const deleteFromFs = ref(false)
-
const filesToDownload = ref([])
const tab = ref('info')
const { xs, sm, mdAndUp } = useDisplay()
+// Event listeners bus
+const emitter = inject('emitter')
+
// Functions
async function searchRomIGDB() {
searching.value = true
@@ -45,7 +47,7 @@ async function updateRom(updatedRom=Object.assign({},rom.value), newName=rom.val
updating.value = true
dialogSearchRom.value = false
if (renameAsIGDB.value) {
- updatedRom.file_name = rom.value.file_name.replace(rom.value.file_name_no_tags.trim(), updatedRom.name)
+ updatedRom.file_name = rom.value.file_name.replace(rom.value.file_name_no_tags.trim(), updatedRom.r_name)
editedRomName.value = updatedRom.file_name
renameAsIGDB.value = false
}
@@ -58,6 +60,7 @@ async function updateRom(updatedRom=Object.assign({},rom.value), newName=rom.val
}).then((response) => {
emitter.emit('snackbarScan', {'msg': rom.value.file_name+" updated successfully!", 'icon': 'mdi-check-bold', 'color': 'green'})
rom.value = response.data.data
+ router.push('/'+rom.value.p_slug+'/roms/'+rom.value.file_name)
}).catch((error) => {
console.log(error)
emitter.emit('snackbarScan', {'msg': "Couldn't updated "+rom.value.file_name+". Something went wrong...", 'icon': 'mdi-close-circle', 'color': 'red'})
@@ -102,7 +105,7 @@ onMounted(() => {
-
+
@@ -111,7 +114,7 @@ onMounted(() => {
-
+
@@ -120,7 +123,7 @@ onMounted(() => {
-
+
@@ -153,23 +156,23 @@ onMounted(() => {
-
+
Info
Saves
Screenshots
@@ -228,7 +231,7 @@ onMounted(() => {
-
+
{
hide-details
clearable/>
-
+
No results found
@@ -252,7 +255,7 @@ onMounted(() => {
- {{ rom.name }}
+ {{ rom.r_name }}
@@ -279,12 +282,15 @@ onMounted(() => {
-
+
- Apply
+
+ Apply
+ Cancel
+
@@ -298,7 +304,7 @@ onMounted(() => {
-
+
Deleting from RomM. Do you confirm?
@@ -317,7 +323,7 @@ onMounted(() => {
-
+
@@ -343,7 +349,7 @@ onMounted(() => {
padding-left: 25px;
padding-right: 25px;
}
-.info-header{
+.rom-name, .rom-platform {
text-shadow: 1px 1px 3px #000000, 0 0 3px #000000;
}
.info-content{
diff --git a/frontend/src/views/Gallery.vue b/frontend/src/views/Gallery.vue
index 87378866c..ed7a67be5 100644
--- a/frontend/src/views/Gallery.vue
+++ b/frontend/src/views/Gallery.vue
@@ -68,16 +68,16 @@ onBeforeRouteUpdate(async (to, from) => {
-
+
-
+
-
+
diff --git a/romm.svg b/romm.svg
index a1330c532..13fa4d7ec 100644
--- a/romm.svg
+++ b/romm.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file