Skip to content

Commit

Permalink
Merge pull request #1659 from rommapp/dev-mode-sync-scan
Browse files Browse the repository at this point in the history
[HOTFIX] Misc fixe for alpha.7
  • Loading branch information
gantoine authored Feb 24, 2025
2 parents 6cdc467 + ea4746f commit 7906ecc
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 10 deletions.
16 changes: 8 additions & 8 deletions backend/endpoints/sockets/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import emoji
import socketio # type: ignore
from config import REDIS_URL, SCAN_TIMEOUT
from config import DEV_MODE, REDIS_URL, SCAN_TIMEOUT
from endpoints.responses.platform import PlatformSchema
from endpoints.responses.rom import SimpleRomSchema
from exceptions.fs_exceptions import (
Expand Down Expand Up @@ -545,13 +545,13 @@ async def scan_handler(_sid: str, options: dict):
roms_ids = options.get("roms_ids", [])
metadata_sources = options.get("apis", [])

# Uncomment this to run scan in the current process
# await scan_platforms(
# platform_ids=platform_ids,
# scan_type=scan_type,
# roms_ids=roms_ids,
# metadata_sources=metadata_sources,
# )
if DEV_MODE:
return await scan_platforms(
platform_ids=platform_ids,
scan_type=scan_type,
roms_ids=roms_ids,
metadata_sources=metadata_sources,
)

return high_prio_queue.enqueue(
scan_platforms,
Expand Down
12 changes: 10 additions & 2 deletions backend/handler/metadata/igdb_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,9 @@ class IGDBHandler(MetadataHandler):
def __init__(self) -> None:
self.BASE_URL = "https://api.igdb.com/v4"
self.platform_endpoint = f"{self.BASE_URL}/platforms"
self.platform_version_endpoint = f"{self.BASE_URL}/platform_versions"
self.platforms_fields = PLATFORMS_FIELDS
self.platform_version_endpoint = f"{self.BASE_URL}/platform_versions"
self.platform_version_fields = PLATFORMS_VERSION_FIELDS
self.games_endpoint = f"{self.BASE_URL}/games"
self.games_fields = GAMES_FIELDS
self.search_endpoint = f"{self.BASE_URL}/search"
Expand Down Expand Up @@ -415,7 +416,7 @@ async def get_platform(self, slug: str) -> IGDBPlatform:
# Check if platform is a version if not found
platform_versions = await self._request(
self.platform_version_endpoint,
data=f'fields {",".join(self.platforms_fields)}; where slug="{slug.lower()}";',
data=f'fields {",".join(self.platform_version_fields)}; where slug="{slug.lower()}";',
)
version = pydash.get(platform_versions, "[0]", None)
if version:
Expand Down Expand Up @@ -747,6 +748,13 @@ async def get_oauth_token(self) -> str:
"platform_logo.url",
)

PLATFORMS_VERSION_FIELDS = (
"id",
"name",
"url",
"platform_logo.url",
)

GAMES_FIELDS = (
"id",
"name",
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/views/Gallery/Collection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ onMounted(async () => {
window.addEventListener("wheel", onScroll);
window.addEventListener("scroll", onScroll);
window.addEventListener("touchmove", onScroll);
}
},
{ immediate: true }, // Ensure watcher is triggered immediately
Expand Down Expand Up @@ -277,6 +278,7 @@ onMounted(async () => {
window.addEventListener("wheel", onScroll);
window.addEventListener("scroll", onScroll);
window.addEventListener("touchmove", onScroll);
}
},
{ immediate: true }, // Ensure watcher is triggered immediately
Expand Down Expand Up @@ -344,6 +346,7 @@ onBeforeRouteUpdate(async (to, from) => {
onBeforeUnmount(() => {
window.removeEventListener("wheel", onScroll);
window.removeEventListener("scroll", onScroll);
window.removeEventListener("touchmove", onScroll);
});
</script>

Expand Down
4 changes: 4 additions & 0 deletions frontend/src/views/Gallery/Platform.vue
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ function onGameTouchEnd() {
function onScroll() {
if (galleryViewStore.currentView != 2) {
clearTimeout(timeout);
window.setTimeout(async () => {
const { scrollTop, scrollHeight, clientHeight } =
document.documentElement;
Expand Down Expand Up @@ -252,6 +254,7 @@ onMounted(async () => {
window.addEventListener("wheel", onScroll);
window.addEventListener("scroll", onScroll);
window.addEventListener("touchmove", onScroll);
} else {
noPlatformError.value = true;
}
Expand Down Expand Up @@ -298,6 +301,7 @@ onBeforeRouteUpdate(async (to, from) => {
onBeforeUnmount(() => {
window.removeEventListener("wheel", onScroll);
window.removeEventListener("scroll", onScroll);
window.removeEventListener("touchmove", onScroll);
});
</script>

Expand Down
2 changes: 2 additions & 0 deletions frontend/src/views/Gallery/Search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,13 @@ onMounted(async () => {
resetGallery();
window.addEventListener("wheel", onScroll);
window.addEventListener("scroll", onScroll);
window.addEventListener("touchmove", onScroll);
});
onBeforeUnmount(() => {
window.removeEventListener("wheel", onScroll);
window.removeEventListener("scroll", onScroll);
window.removeEventListener("touchmove", onScroll);
searchText.value = "";
});
</script>
Expand Down

0 comments on commit 7906ecc

Please sign in to comment.