resources structure refactor

This commit is contained in:
zurdi zurdo
2023-03-11 12:37:39 +01:00
parent aa2d24302a
commit c473fed6d0
4 changed files with 24 additions and 14 deletions

View File

@@ -13,7 +13,7 @@ EXPOSE 5000
# Copy frontend and install npm packages
COPY frontend /frontend
COPY frontend/package.json /frontend/package.json
RUN ln -s /emulation /frontend/src/assets/emulation
RUN ln -s /emulation /frontend/assets/emulation
WORKDIR /frontend
RUN npm install
EXPOSE 5173

View File

@@ -31,10 +31,9 @@ async def scan(overwrite: bool=False):
log.info("scaning...")
fs.store_platform_logo('defaults', DEFAULT_IMAGE_URL)
fs.store_platform_logo('placeholder', DEFAULT_IMAGE_URL)
platforms: list = []
for slug in fs.get_platforms():
igdb_id, name, url_logo = igdbh.get_platform_details(slug)
sgdb_id: str = ""

View File

@@ -17,7 +17,7 @@ def get_platforms() -> list:
"""
try:
platforms: list = list(os.walk(EMULATION_BASE_PATH))[0][1]
if 'defaults' in platforms: platforms.remove('defaults')
if 'resources' in platforms: platforms.remove('resources')
log.info(f"filesystem platforms found: {platforms}")
return platforms
except IndexError:
@@ -48,12 +48,12 @@ def platform_logo_exists(slug: str) -> bool:
Returns
True if logo exists in filesystem else False
"""
logo_path: str = f"{EMULATION_BASE_PATH}/{slug}/resources/logo.png"
logo_path: str = f"{EMULATION_BASE_PATH}/resources/{slug}/logo.png"
return True if os.path.exists(logo_path) else False
def get_platform_logo_path(slug: str) -> str:
return f"{EMULATION_BASE_PATH}/{slug}/resources/logo.png"
return f"{EMULATION_BASE_PATH}/resources/{slug}/logo.png"
def store_platform_logo(slug: str, url_logo: str) -> None:
@@ -65,7 +65,7 @@ def store_platform_logo(slug: str, url_logo: str) -> None:
"""
file_ext: str = url_logo.split('.')[-1]
logo_file: str = f"logo.{file_ext}"
logo_path: str = f"{EMULATION_BASE_PATH}/{slug}/resources"
logo_path: str = f"{EMULATION_BASE_PATH}/resources/{slug}"
res = requests.get(url_logo, stream=True)
if res.status_code == 200:
Path(logo_path).mkdir(parents=True, exist_ok=True)

View File

@@ -17,12 +17,12 @@ const GetPlatforms = async () => {
}
GetPlatforms()
const scan = (overwrite) => {
scaning = true
axios.get('http://'+server+':'+port+'/scan?overwrite='+overwrite).then((response) => {
const scanOverwrite = ref(false)
const scan = async () => {
await axios.get('http://'+server+':'+port+'/scan?overwrite='+scanOverwrite.value).then((response) => {
console.log("scan completed")
console.log(response.data)
scaning = false
GetPlatforms()
})
}
@@ -37,7 +37,7 @@ const toggleTheme = () => {
<template>
<v-navigation-drawer width="250">
<v-navigation-drawer width="250" permanent>
<v-list>
<v-list-item prepend-icon="mdi mdi-controller">Rom Manager</v-list-item>
</v-list>
@@ -55,13 +55,24 @@ const toggleTheme = () => {
<v-divider ></v-divider>
<v-list>
<v-btn color="secondary" prepend-icon="mdi mdi-magnify-scan" @click="scan()" inset class="ml-3">Scan</v-btn>
<v-row>
<div class="font-weight-bold d-flex align-center justify-center fill-height ml-3">
<v-col>
<v-btn color="secondary" prepend-icon="mdi mdi-magnify-scan" @click="scan()" inset >Scan</v-btn>
</v-col>
<v-col class="font-weight-bold d-flex align-center justify-center ml-3">
<v-checkbox v-model="scanOverwrite" label="Full"></v-checkbox>
</v-col>
</div>
</v-row>
</v-list>
<v-divider ></v-divider>
<v-list>
<v-switch prepend-icon="mdi mdi-brightness-6" v-model="darkMode" @change="toggleTheme()" inset class="pl-3"/>
<div class="font-weight-bold d-flex align-center justify-center fill-height">
<v-switch prepend-icon="mdi mdi-brightness-6" v-model="darkMode" @change="toggleTheme()" inset class="ml-3"/>
</div>
</v-list>
</v-navigation-drawer>