Merge branch 'master' into feature-28-mini-admin-menu

This commit is contained in:
zurdi
2023-08-09 01:23:13 +02:00
26 changed files with 42580 additions and 220 deletions

1
.gitignore vendored
View File

@@ -46,6 +46,7 @@ romm_mock
# testing
backend/romm_test/resources
backend/romm_test/logs
.pytest_cache
# service worker
frontend/dev-dist

View File

@@ -51,6 +51,14 @@ cd backend
python main.py
```
### - Start a worker
```sh
cd backend
python worker.py
```
## Setting up the frontend
### - Install node.js dependencies

View File

@@ -27,12 +27,23 @@ DEFAULT_URL_COVER_S: str = (
)
DEFAULT_PATH_COVER_S: str = "default/default/cover/small.png"
# MARIADB
DB_HOST = os.environ.get("DB_HOST", "127.0.0.1")
DB_PORT: int = int(os.environ.get("DB_PORT", 3306))
DB_USER = os.environ.get("DB_USER")
DB_PASSWD = os.environ.get("DB_PASSWD")
DB_NAME = os.environ.get("DB_NAME", "romm")
# REDIS
REDIS_HOST = os.environ.get('REDIS_HOST', 'localhost')
REDIS_PORT = os.environ.get('REDIS_PORT', '6379')
# IGDB
CLIENT_ID: str = os.environ.get("CLIENT_ID", "")
CLIENT_SECRET: str = os.environ.get("CLIENT_SECRET", "")
CLIENT_ID = os.environ.get("CLIENT_ID")
CLIENT_SECRET = os.environ.get("CLIENT_SECRET")
# STEAMGRIDDB
STEAMGRIDDB_API_KEY: str = os.environ.get("STEAMGRIDDB_API_KEY", "")
STEAMGRIDDB_API_KEY = os.environ.get("STEAMGRIDDB_API_KEY")
# DB DRIVERS
ROMM_DB_DRIVER: str = os.environ.get("ROMM_DB_DRIVER", "sqlite")
ROMM_DB_DRIVER = os.environ.get("ROMM_DB_DRIVER", "sqlite")

View File

@@ -9,6 +9,11 @@ from config import (
ROMM_DB_DRIVER,
SQLITE_DB_BASE_PATH,
ROMM_USER_CONFIG_PATH,
DB_HOST,
DB_PORT,
DB_USER,
DB_PASSWD,
DB_NAME,
)
from logger.logger import log
@@ -27,16 +32,6 @@ class ConfigLoader:
@staticmethod
def get_db_engine() -> str:
if ROMM_DB_DRIVER == "mariadb":
DB_HOST: str = os.environ.get("DB_HOST", "127.0.0.1")
try:
DB_PORT: int = int(os.environ.get("DB_PORT", 3306))
except TypeError:
log.critical("DB_PORT variable not set properly")
sys.exit(3)
DB_USER: str = os.environ.get("DB_USER", "")
DB_PASSWD: str = os.environ.get("DB_PASSWD", "")
DB_NAME: str = os.environ.get("DB_NAME", "romm")
return (
f"mariadb+mariadbconnector://{DB_USER}:%s@{DB_HOST}:{DB_PORT}/{DB_NAME}"
% quote_plus(DB_PASSWD)

View File

View File

@@ -1,37 +1,38 @@
import json
import emoji
import socketio
from rq import Queue
from logger.logger import log
from utils import fs, fastapi
from utils.exceptions import PlatformsNotFoundException, RomsNotFoundException
from handler import dbh
from models.platform import Platform
from models.rom import Rom
from handler.socket_manager import SocketManager
from utils.socket import socket_server
from utils.cache import redis_client, redis_url, redis_connectable
scan_queue = Queue(connection=redis_client)
async def scan(
sm: SocketManager, _sid: str, platforms_to_scan: str, complete_rescan: bool = True
):
"""Scan platforms and roms and write them in database."""
async def scan_platforms(paltforms: str, complete_rescan: bool):
# Connect to external socketio server
sm = (
socketio.AsyncRedisManager(redis_url, write_only=True)
if redis_connectable
else socket_server
)
log.info(emoji.emojize(":magnifying_glass_tilted_right: Scanning "))
fs.store_default_resources()
try: # Scanning platforms
# Scanning file system
try:
fs_platforms: list[str] = fs.get_platforms()
except PlatformsNotFoundException as e:
log.error(e)
await sm.emit("scan:done_ko", e.message)
return
platforms: list[str] = (
json.loads(platforms_to_scan) if len(json.loads(platforms_to_scan)) > 0 else fs_platforms
)
log.info(f"Platforms to be scanned: {', '.join(platforms)}")
for platform in platforms:
platform_list = paltforms.split(",") if paltforms else fs_platforms
for p_slug in platform_list:
try:
scanned_platform: Platform = fastapi.scan_platform(platform)
# Verify that platform exists
scanned_platform = fastapi.scan_platform(p_slug)
except RomsNotFoundException as e:
log.error(e)
continue
@@ -39,35 +40,49 @@ async def scan(
await sm.emit(
"scan:scanning_platform",
{"p_name": scanned_platform.name, "p_slug": scanned_platform.slug},
ignore_queue=True,
)
dbh.add_platform(scanned_platform)
# Scanning roms
fs_roms: list[dict] = fs.get_roms(scanned_platform.fs_slug) # type: ignore
fs_roms: list[dict] = fs.get_roms(scanned_platform.fs_slug) # type: ignore
for rom in fs_roms:
rom_id: int = dbh.rom_exists(scanned_platform.slug, rom["file_name"]) # type: ignore
rom_id: int = dbh.rom_exists(scanned_platform.slug, rom["file_name"]) # type: ignore
if rom_id and not complete_rescan:
continue
scanned_rom: Rom = fastapi.scan_rom(scanned_platform, rom)
scanned_rom = fastapi.scan_rom(scanned_platform, rom)
await sm.emit(
"scan:scanning_rom",
{
"p_slug": scanned_platform.slug,
"p_name": scanned_platform.name,
"file_name": scanned_rom.file_name,
"r_name": scanned_rom.r_name,
"r_igdb_id": scanned_rom.r_igdb_id,
},
ignore_queue=True,
)
if rom_id:
scanned_rom.id = rom_id # type: ignore
scanned_rom.id = rom_id # type: ignore
dbh.add_rom(scanned_rom)
dbh.purge_roms(scanned_platform.slug, [rom["file_name"] for rom in fs_roms]) # type: ignore
dbh.update_n_roms(scanned_platform.slug) # type: ignore
dbh.update_n_roms(scanned_platform.slug) # type: ignore
dbh.purge_platforms(fs_platforms)
await sm.emit("scan:done")
await sm.emit("scan:done", {})
@socket_server.on("scan")
async def scan_handler(_sid: str, platforms: str, complete_rescan: bool = True):
"""Scan platforms and roms and write them in database."""
log.info(emoji.emojize(":magnifying_glass_tilted_right: Scanning "))
fs.store_default_resources()
# Run in worker if redis is available
if redis_connectable:
scan_queue.enqueue(scan_platforms, platforms, complete_rescan)
else:
await scan_platforms(platforms, complete_rescan)

View File

@@ -19,6 +19,7 @@ async def search_rom_igdb(
matched_roms: list = []
log.info(f"Searching by {search_by}: {search_term}")
log.info(emoji.emojize(f":video_game: {rom['p_slug']}: {rom['file_name']}"))
if search_by.lower() == "id":
matched_roms = igdbh.get_matched_roms_by_id(int(search_term))
elif search_by.lower() == "name":

View File

@@ -2,14 +2,25 @@ import sys
import functools
import pydash
import requests
import re
import time
from time import time
from unidecode import unidecode as uc
from requests.exceptions import HTTPError, Timeout
from config import CLIENT_ID, CLIENT_SECRET, DEFAULT_URL_COVER_S
from utils import get_file_name_with_no_tags as get_search_term
from logger.logger import log
from utils.cache import cache
from .ps2_opl_index import opl_index
MAIN_GAME_CATEGORY = 0
EXPANDED_GAME_CATEGORY = 10
N_SCREENSHOTS = 5
ps2_opl_regex = r"^([A-Z]{4}_\d{3}\.\d{2})\..*$"
PS2_IGDB_ID = 8
class IGDBHandler:
@@ -20,7 +31,7 @@ class IGDBHandler:
self.screenshots_url = "https://api.igdb.com/v4/screenshots/"
self.twitch_auth = TwitchAuth()
self.headers = {
"Client-ID": self.twitch_auth.client_id,
"Client-ID": CLIENT_ID,
"Authorization": f"Bearer {self.twitch_auth.get_oauth_token()}",
"Accept": "application/json",
}
@@ -79,7 +90,7 @@ class IGDBHandler:
def _search_screenshots(self, rom_id: int) -> list:
screenshots = self._request(
self.screenshots_url,
data=f"fields url; where game={rom_id}; limit 5;",
data=f"fields url; where game={rom_id}; limit {N_SCREENSHOTS};",
)
return [
@@ -112,11 +123,20 @@ class IGDBHandler:
@check_twitch_token
def get_rom(self, file_name: str, p_igdb_id: int):
search_term = uc(get_search_term(file_name))
search_term = get_search_term(file_name)
# Patch support for PS2 OPL filename format
match = re.match(ps2_opl_regex, search_term)
if p_igdb_id == PS2_IGDB_ID and match:
serial_code = match.group(1)
index_entry = opl_index.get(serial_code, None)
if index_entry:
search_term = index_entry["Name"]
res = (
self._search_rom(search_term, p_igdb_id, 0)
or self._search_rom(search_term, p_igdb_id, 10)
or self._search_rom(search_term, p_igdb_id)
self._search_rom(uc(search_term), p_igdb_id, MAIN_GAME_CATEGORY)
or self._search_rom(uc(search_term), p_igdb_id, EXPANDED_GAME_CATEGORY)
or self._search_rom(uc(search_term), p_igdb_id)
)
r_igdb_id = res.get("id", 0)
@@ -185,50 +205,44 @@ class IGDBHandler:
class TwitchAuth:
def __init__(self) -> None:
self.base_url = "https://id.twitch.tv/oauth2/token"
self.token = ""
self.token_checkout = int(time())
self.secure_seconds_offset = 10 # seconds offset to avoid invalid token
self.token_valid_seconds = 0
self.client_id = CLIENT_ID
self.client_secret = CLIENT_SECRET
def _is_token_valid(self) -> bool:
return (
int(time()) + self.secure_seconds_offset - self.token_checkout
< self.token_valid_seconds
)
def _update_twitch_token(self):
def _update_twitch_token(self) -> str:
res = requests.post(
url=self.base_url,
url="https://id.twitch.tv/oauth2/token",
params={
"client_id": self.client_id,
"client_secret": self.client_secret,
"client_id": CLIENT_ID,
"client_secret": CLIENT_SECRET,
"grant_type": "client_credentials",
},
timeout=30,
).json()
self.token_checkout = int(time())
self.token_valid_seconds = res.get("expires_in", 0)
self.token = res.get("access_token", "")
if not self.token:
token = res.get("access_token", "")
expires_in = res.get("expires_in", 0)
if not token or expires_in == 0:
log.error(
"Could not get twitch auth token: check client_id and client_secret"
)
sys.exit(2)
# Set token in redis to expire in <expires_in> seconds
cache.set("twitch_token", token, ex=expires_in - 10)
cache.set("twitch_token_expires_at", time.time() + expires_in - 10)
log.info("Twitch token fetched!")
return token
def get_oauth_token(self) -> str:
# Use a fake token when running tests
if "pytest" in sys.modules:
return "test_token"
if not self._is_token_valid():
log.warning("Twitch token invalid: fetching a new one...")
self._update_twitch_token()
# Fetch the token cache
token = cache.get("twitch_token")
token_expires_at = cache.get("twitch_token_expires_at")
return self.token
if not token or time.time() > float(token_expires_at or 0):
log.warning("Twitch token invalid: fetching a new one...")
return self._update_twitch_token()
return token

File diff suppressed because it is too large Load Diff

View File

@@ -1,32 +0,0 @@
import socketio
class SocketManager(object):
def __new__(cls):
if not hasattr(cls, "instance"):
cls.instance = super(SocketManager, cls).__new__(cls)
return cls.instance
def __init__(self):
self.server = socketio.AsyncServer(
cors_allowed_origins="*",
async_mode="asgi",
logger=False,
engineio_logger=False,
)
self.app = socketio.ASGIApp(self.server)
@property
def on(self):
return self.server.on
@property
def send(self):
return self.server.send
@property
def emit(self):
return self.server.emit
def mount_to(self, path: str, app):
app.mount(path, self.app)

View File

@@ -0,0 +1,642 @@
interactions:
- request:
body: "\n search \"WWE Smack\";\n fields id, slug,
name, summary, screenshots;\n where platforms=[8] ;\n "
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Authorization:
- Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Client-ID:
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection:
- keep-alive
Content-Length:
- '148'
User-Agent:
- python-requests/2.31.0
method: POST
uri: https://api.igdb.com/v4/games/
response:
body:
string: '[]'
headers:
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 7f3aed54583736cc-YYZ
Connection:
- keep-alive
Content-Length:
- '2'
Content-Type:
- application/json
Date:
- Tue, 08 Aug 2023 21:42:04 GMT
Server:
- cloudflare
Set-Cookie:
- __cf_bm=2FZ8yXd6kJCZczwShE3trToMz6isxk3pRUdc56wkEYI-1691530924-0-AaqEUxKzxOgi0q16HWpEhnxkee2iScFmFmmwLDzJ7V8+Lm65RvQWP9+x+2SsA08kOrB4y76l/LHK/K17sx8OwhQ=;
path=/; expires=Tue, 08-Aug-23 22:12:04 GMT; domain=.igdb.com; HttpOnly; Secure;
SameSite=None
Strict-Transport-Security:
- max-age=31536000; includeSubDomains; preload
Via:
- 1.1 0cf68108b8820db4a096a661da0108ba.cloudfront.net (CloudFront)
X-Amz-Cf-Id:
- yWhkDdhd8nwU3D_xJgnuyJJT0ZozkSB-Fzb_Kv24Iy3_KAqMa81ATw==
X-Amz-Cf-Pop:
- YUL62-C2
X-Cache:
- Miss from cloudfront
X-Content-Type-Options:
- nosniff
X-Count:
- '0'
alt-svc:
- h3=":443"; ma=86400
x-amz-apigw-id:
- JXF69GAEvHcFSFw=
x-amzn-Remapped-Content-Length:
- '2'
x-amzn-Remapped-Date:
- Tue, 08 Aug 2023 21:42:04 GMT
x-amzn-RequestId:
- f89b0a7e-0132-468a-9765-e860db9af0e5
status:
code: 200
message: OK
- request:
body: "\n search \"WWE Smack\";\n fields id, slug,
name, summary, screenshots;\n where platforms=[8] & category=10;\n
\ "
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Authorization:
- Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Client-ID:
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection:
- keep-alive
Content-Length:
- '161'
User-Agent:
- python-requests/2.31.0
method: POST
uri: https://api.igdb.com/v4/games/
response:
body:
string: '[]'
headers:
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 7f3aed55b93fa1e4-YYZ
Connection:
- keep-alive
Content-Length:
- '2'
Content-Type:
- application/json
Date:
- Tue, 08 Aug 2023 21:42:04 GMT
Server:
- cloudflare
Set-Cookie:
- __cf_bm=Puva_j5o1yiq.tnKDbNcV9pRuJbwrDYniBPvgoCQRXY-1691530924-0-ARyofbQZWmGWeXv8t7ZyqA9cLRh4bt44QD551g2b/4ovRPGCxYEce8NyjxvhPQoeZwdzuWtPOX4XhuRF0cj0dFc=;
path=/; expires=Tue, 08-Aug-23 22:12:04 GMT; domain=.igdb.com; HttpOnly; Secure;
SameSite=None
Strict-Transport-Security:
- max-age=31536000; includeSubDomains; preload
Via:
- 1.1 17eb4ce9c34597b3328325a19f8138fe.cloudfront.net (CloudFront)
X-Amz-Cf-Id:
- LlXMW-vJq3MPlx4V-D3RBkS_BeLRWZP6EnqmwClehjo-DKCuMEYqBQ==
X-Amz-Cf-Pop:
- JFK50-P6
X-Cache:
- Miss from cloudfront
X-Content-Type-Options:
- nosniff
X-Count:
- '0'
alt-svc:
- h3=":443"; ma=86400
x-amz-apigw-id:
- JXF6_HRsPHcFfQg=
x-amzn-Remapped-Content-Length:
- '2'
x-amzn-Remapped-Date:
- Tue, 08 Aug 2023 21:42:04 GMT
x-amzn-RequestId:
- 738c513a-5c6d-4b7c-b10d-0eb712ade4e5
status:
code: 200
message: OK
- request:
body: "\n search \"WWE Smack\";\n fields id, slug,
name, summary, screenshots;\n where platforms=[8] ;\n "
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Authorization:
- Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Client-ID:
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection:
- keep-alive
Content-Length:
- '148'
User-Agent:
- python-requests/2.31.0
method: POST
uri: https://api.igdb.com/v4/games/
response:
body:
string: '[]'
headers:
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 7f3aed575c81a226-YYZ
Connection:
- keep-alive
Content-Length:
- '2'
Content-Type:
- application/json
Date:
- Tue, 08 Aug 2023 21:42:04 GMT
Server:
- cloudflare
Set-Cookie:
- __cf_bm=jlhBpkzNgFQ60YxJyjPoZQeFRys3Boz2kkiA0GzSM4E-1691530924-0-ARN2bowq/YOIbetCAuqjH8574ysfCvbCuUSI3sSC9HBViMCrAeK+BQMkCe6DAParzXuxnB8omL4Dkonp5Q+j1q0=;
path=/; expires=Tue, 08-Aug-23 22:12:04 GMT; domain=.igdb.com; HttpOnly; Secure;
SameSite=None
Strict-Transport-Security:
- max-age=31536000; includeSubDomains; preload
Via:
- 1.1 6e810acc9d798bdf126180508d1b511e.cloudfront.net (CloudFront)
X-Amz-Cf-Id:
- UeAJtI52TSI8rQ7RlwlHc6jftX4OvgNz3Gw2IfioYp_ZNqV14aku7Q==
X-Amz-Cf-Pop:
- JFK50-P6
X-Cache:
- Miss from cloudfront
X-Content-Type-Options:
- nosniff
X-Count:
- '0'
alt-svc:
- h3=":443"; ma=86400
x-amz-apigw-id:
- JXF7DFU_vHcFQJQ=
x-amzn-Remapped-Content-Length:
- '2'
x-amzn-Remapped-Date:
- Tue, 08 Aug 2023 21:42:04 GMT
x-amzn-RequestId:
- 0f819ab1-564f-422e-925d-5cd09471dfb6
status:
code: 200
message: OK
- request:
body: fields url; where game=0;
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Authorization:
- Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Client-ID:
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection:
- keep-alive
Content-Length:
- '25'
User-Agent:
- python-requests/2.31.0
method: POST
uri: https://api.igdb.com/v4/covers/
response:
body:
string: '[]'
headers:
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 7f3aed59ddaea250-YYZ
Connection:
- keep-alive
Content-Length:
- '2'
Content-Type:
- application/json
Date:
- Tue, 08 Aug 2023 21:42:05 GMT
Server:
- cloudflare
Set-Cookie:
- __cf_bm=5hfxta3kbDkpYYMbi4pWqTE4TCxYZTOLNpZZFnLi3BY-1691530925-0-AXngRGKN3b+A560jM6xfcJC8ybSeSrB84RN5cVumXhBcW7x4aeWkFMsvETU9eL0uuUqRx8EHCa+f2Imgohg76+o=;
path=/; expires=Tue, 08-Aug-23 22:12:05 GMT; domain=.igdb.com; HttpOnly; Secure;
SameSite=None
Strict-Transport-Security:
- max-age=31536000; includeSubDomains; preload
Via:
- 1.1 0252b483f7b420504a413a83f987b080.cloudfront.net (CloudFront)
X-Amz-Cf-Id:
- lFMJmVctmUi1nCqdc39Ou5-RXXPbx-OlBzhX8HZzWZSYVbOv6GMTOA==
X-Amz-Cf-Pop:
- JFK50-P6
X-Cache:
- Miss from cloudfront
X-Content-Type-Options:
- nosniff
X-Count:
- '0'
alt-svc:
- h3=":443"; ma=86400
x-amz-apigw-id:
- JXF7GGvlPHcFkfg=
x-amzn-Remapped-Content-Length:
- '2'
x-amzn-Remapped-Date:
- Tue, 08 Aug 2023 21:42:05 GMT
x-amzn-RequestId:
- 2d66b17c-39e7-48c4-ad47-471ad90fecc4
status:
code: 200
message: OK
- request:
body: fields url; where game=0; limit 5;
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Authorization:
- Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Client-ID:
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection:
- keep-alive
Content-Length:
- '34'
User-Agent:
- python-requests/2.31.0
method: POST
uri: https://api.igdb.com/v4/screenshots/
response:
body:
string: '[]'
headers:
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 7f3aed5b3f3439e7-YYZ
Connection:
- keep-alive
Content-Length:
- '2'
Content-Type:
- application/json
Date:
- Tue, 08 Aug 2023 21:42:05 GMT
Server:
- cloudflare
Set-Cookie:
- __cf_bm=xQhaAjFgeVf91imq1V7u_fKbBT.2iuPS0fOuXwyjaY0-1691530925-0-AYwl6RE7yyGBd7ZHNqOtw8YOSkuqle6edPWbN2C/FPRjSMLARxkSSGyajCWulxpJYGkoC33IvmlvXhE/Dux7KFk=;
path=/; expires=Tue, 08-Aug-23 22:12:05 GMT; domain=.igdb.com; HttpOnly; Secure;
SameSite=None
Strict-Transport-Security:
- max-age=31536000; includeSubDomains; preload
Via:
- 1.1 0cf68108b8820db4a096a661da0108ba.cloudfront.net (CloudFront)
X-Amz-Cf-Id:
- oCOyIQwsjsGRFEH-VmwCpuhNE_QdXBNxeyPcz1uWsBE52WoKHmUyKg==
X-Amz-Cf-Pop:
- YUL62-C2
X-Cache:
- Miss from cloudfront
X-Content-Type-Options:
- nosniff
X-Count:
- '0'
alt-svc:
- h3=":443"; ma=86400
x-amz-apigw-id:
- JXF7JHGPvHcFjyw=
x-amzn-Remapped-Content-Length:
- '2'
x-amzn-Remapped-Date:
- Tue, 08 Aug 2023 21:42:05 GMT
x-amzn-RequestId:
- 9b979995-d6e6-46d8-afb8-e93c06120852
status:
code: 200
message: OK
- request:
body: "\n search \"WWE SmackDown! vs. RAW\";\n fields
id, slug, name, summary, screenshots;\n where platforms=[8] ;\n
\ "
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Authorization:
- Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Client-ID:
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection:
- keep-alive
Content-Length:
- '161'
User-Agent:
- python-requests/2.31.0
method: POST
uri: https://api.igdb.com/v4/games/
response:
body:
string: "[\n {\n \"id\": 80852,\n \"name\": \"WWE Smackdown! vs. Raw\",\n
\ \"screenshots\": [\n 337102,\n 337103,\n 337104,\n 337105,\n
\ 337106,\n 337107,\n 337108\n ],\n \"slug\": \"wwe-smackdown-vs-raw\",\n
\ \"summary\": \"WWE SmackDown! vs. Raw brings two of wrestling\\u0027s
most popular game series together on the PS2. The game re-creates WWE programming
with voice-overs and commentary throughout the season mode. During matches,
you can learn a host of new gameplay moves, such as stare-downs, chop battles,
and submission reversals. You can also try out situational challenges or create
your own championship. Play as your favorite wrestler, including legends and
Divas, and prove to the world that you have what it takes to be the WWE champion.\"\n
\ },\n {\n \"id\": 2265,\n \"name\": \"WWE SmackDown vs. Raw 2011\",\n
\ \"screenshots\": [\n 25356,\n 25357,\n 25358,\n 25359,\n
\ 25360\n ],\n \"slug\": \"wwe-smackdown-vs-raw-2011\",\n \"summary\":
\"WWE SmackDown vs. Raw 2011 will empower players more than ever to define
their destiny and gameplay experiences in a dynamic and ever-changing WWE.
Along the way, your decisions will decide gameplay scenarios, allowing for
more spontaneous WWE action in and out of the ring. Enjoy a greater level
of interactivity that allows you to customize your WWE experience and control
your destinies in all-new Road to WrestleMania story-driven campaigns.\\n\\nYou\\u0027ve
seen the Superstars\\u0027 greatest moments on WWE programming. You\u2019ve
shared them and lived through them on television, on the web, and at the arenas.
Now, it\\u0027s time for you to define your ultimate WWE moment, in the most
interactive experience in the WWE Universe. This is your moment.\"\n },\n
\ {\n \"id\": 5300,\n \"name\": \"WWE SmackDown vs. Raw 2010\",\n \"screenshots\":
[\n 27682\n ],\n \"slug\": \"wwe-smackdown-vs-raw-2010\",\n \"summary\":
\"The best-selling fighting videogame franchise returns to the virtual ring
with the most authentic, entertaining and compelling simulation of WWE programming
to date. Featuring unparalleled creation tools, a robust Superstar roster,
key franchise improvements and a few surprises, WWE SmackDown vs. Raw 2010
delivers the empowering freedom to create, customize and share gameplay experiences.
It\\u0027s your world now.\"\n },\n {\n \"id\": 5299,\n \"name\":
\"WWE SmackDown vs. Raw 2009\",\n \"screenshots\": [\n 27080\n ],\n
\ \"slug\": \"wwe-smackdown-vs-raw-2009\",\n \"summary\": \"WWE SmackDown
vs. Raw 2009 for the Wii builds upon its inaugural offering by significantly
expanding its match type options, giving players more ways to enjoy the platform\\u0027s
unique pick-up-and-play experience. The game also takes full combat sports
entertainment to the next level by giving players more superstar control with
interactive entrances and victory scenes.\"\n },\n {\n \"id\": 18323,\n
\ \"name\": \"WWE SmackDown! vs. Raw 2006\",\n \"screenshots\": [\n 337109,\n
\ 337110,\n 337111,\n 337112\n ],\n \"slug\": \"wwe-smackdown-vs-raw-2006\",\n
\ \"summary\": \"The debut PlayStation Portable offering of THQ and Yuke\\u0027s
long-running 3D wrestling series. WWE SmackDown! vs. RAW 2006 expands on THQ\\u0027s
popular multi-million unit-selling franchise with a number of key new features.
The Buried Alive Casket match, two new wrestler attributes (Stamina and Hardcore),
and a realistic momentum system all combine to turn the series away from its
arcade roots and towards that of a simulation. The PSP version follows closely
on the heels of its PS2 tag-teammate in terms of features and wrestler rosters,
with exclusive extras including additional characters and other features for
the PSP version, plus USB system link to connect the two versions together.\"\n
\ },\n {\n \"id\": 7252,\n \"name\": \"WWE SmackDown vs. Raw 2007\",\n
\ \"screenshots\": [\n 27298\n ],\n \"slug\": \"wwe-smackdown-vs-raw-2007\",\n
\ \"summary\": \"A brand new Analog Control System makes fighting more realistic
than ever with intuitive movement and new elements of control. An enhanced
Season Mode provides multiple branching storylines and unprecedented levels
of player choice. In and out of the ring, dozens of user-controlled environmental
hotspots let players take advantage of anything at their disposal to inflict
damage on opponents in new and unique ways. Additionally, new high impact
combination moves let players take the power of WWE Superstars into their
own hands. Experience the intensity of WWE fans in a brand new, fully loaded
interactive fighting area. Players can take advantage of multiple weapons,
environmental damage and grabbing signs and weapons from the crowd. WWE SmackDown
vs. RAW 2007 offers multiple enhancements, including incredible high definition
graphics, updated rosters for both RAW and SmackDown, an expanded General
Manager Mode, online multiplayer game play with voice chat support and more.\"\n
\ },\n {\n \"id\": 5298,\n \"name\": \"WWE SmackDown vs. Raw 2008\",\n
\ \"screenshots\": [\n 26973,\n 178914,\n 178915,\n 178916,\n
\ 178917,\n 178918,\n 178919,\n 178920,\n 178921,\n
\ 178922,\n 178923,\n 178924\n ],\n \"slug\": \"wwe-smackdown-vs-raw-2008\",\n
\ \"summary\": \"The 2008 edition in the Smackdown vs. Raw series holds
new features to the WWE game franchise. This is the first in the series to
include the extremists of ECW, including The Sandman, Marcus Cor Von and CM
Punk.\\n\\nThe game also features a new struggle submission system, new weapon
choices including guitars, and eight superstar fighting styles, including
Showman, Powerhouse, High-Flyer and more. Each player can now choose a primary
and a secondary fighting style. It continues the legend trend and new arenas,
such as Wrestlemania 23, Unforgiven and Summerslam as well as the classic
superstars like Undertaker, Shawn Michaels and Ric Flair. The roster largely
depends on the platform, and some versions include wrestlers not available
in the other ones.\"\n }\n]"
headers:
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 7f3aed5dd96ba216-YYZ
Connection:
- keep-alive
Content-Encoding:
- gzip
Content-Length:
- '2424'
Content-Type:
- application/json
Date:
- Tue, 08 Aug 2023 21:42:05 GMT
Server:
- cloudflare
Set-Cookie:
- __cf_bm=lFnWxIux8YDNP5ICYrRJNZN30Jxkv2T1QzKICAHLqOM-1691530925-0-AZHMsgCTbsWbvEU3UIsf90t5Ef/i7SGyz4Z4TwsBDzvH2+0mANJkeHp53rWNzYfkN4Mz1wJAgFz8tfKtoydRRow=;
path=/; expires=Tue, 08-Aug-23 22:12:05 GMT; domain=.igdb.com; HttpOnly; Secure;
SameSite=None
Strict-Transport-Security:
- max-age=31536000; includeSubDomains; preload
Via:
- 1.1 0252b483f7b420504a413a83f987b080.cloudfront.net (CloudFront)
X-Amz-Cf-Id:
- qMI0thyxNG4YqxaWxxTBgXkpeDOXi8Bs0zUkoQsOxxTo_XrbvaVCyg==
X-Amz-Cf-Pop:
- JFK50-P6
X-Cache:
- Miss from cloudfront
X-Content-Type-Options:
- nosniff
X-Count:
- '7'
alt-svc:
- h3=":443"; ma=86400
x-amz-apigw-id:
- JXF7MF6bPHcFZ_w=
x-amzn-Remapped-Content-Length:
- '2424'
x-amzn-Remapped-Date:
- Tue, 08 Aug 2023 21:42:05 GMT
x-amzn-RequestId:
- 401f41a8-2a6b-4964-920b-eb774319cfda
status:
code: 200
message: OK
- request:
body: fields url; where game=80852;
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Authorization:
- Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Client-ID:
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection:
- keep-alive
Content-Length:
- '29'
User-Agent:
- python-requests/2.31.0
method: POST
uri: https://api.igdb.com/v4/covers/
response:
body:
string: "[\n {\n \"id\": 209154,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/co4hdu.jpg\"\n
\ }\n]"
headers:
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 7f3aed5f2ddd36bf-YYZ
Connection:
- keep-alive
Content-Encoding:
- gzip
Content-Type:
- application/json
Date:
- Tue, 08 Aug 2023 21:42:06 GMT
Server:
- cloudflare
Set-Cookie:
- __cf_bm=NBzU8tnnDPzzbIAUPFzzHf10sB1qjmrChgr4Ut46Ox4-1691530926-0-AdGbP+m+iP2Llc9wZ0uUxmpsDceQbzmnbkQ4M7VXQz85LhsD6qkxyqkdlu6iWeq+0Yir4PaVw3gfSMjnzHcT0X0=;
path=/; expires=Tue, 08-Aug-23 22:12:06 GMT; domain=.igdb.com; HttpOnly; Secure;
SameSite=None
Strict-Transport-Security:
- max-age=31536000; includeSubDomains; preload
Transfer-Encoding:
- chunked
Via:
- 1.1 0cf68108b8820db4a096a661da0108ba.cloudfront.net (CloudFront)
X-Amz-Cf-Id:
- o_MYoqRnT-DeRtef1fxWHzCYrIqFijaFAWrmcj15zvdCq0rXCY4UNw==
X-Amz-Cf-Pop:
- YUL62-C2
X-Cache:
- Miss from cloudfront
X-Content-Type-Options:
- nosniff
X-Count:
- '1'
alt-svc:
- h3=":443"; ma=86400
x-amz-apigw-id:
- JXF7QHazPHcFcww=
x-amzn-Remapped-Content-Length:
- '97'
x-amzn-Remapped-Date:
- Tue, 08 Aug 2023 21:42:06 GMT
x-amzn-RequestId:
- a71761ba-563f-47a0-8a38-2154eec2f4ce
status:
code: 200
message: OK
- request:
body: fields url; where game=80852; limit 5;
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Authorization:
- Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Client-ID:
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection:
- keep-alive
Content-Length:
- '38'
User-Agent:
- python-requests/2.31.0
method: POST
uri: https://api.igdb.com/v4/screenshots/
response:
body:
string: "[\n {\n \"id\": 337103,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/sc783z.jpg\"\n
\ },\n {\n \"id\": 337104,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/sc7840.jpg\"\n
\ },\n {\n \"id\": 337105,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/sc7841.jpg\"\n
\ },\n {\n \"id\": 337102,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/sc783y.jpg\"\n
\ },\n {\n \"id\": 337107,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/sc7843.jpg\"\n
\ }\n]"
headers:
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 7f3aed623f323703-YYZ
Connection:
- keep-alive
Content-Encoding:
- gzip
Content-Type:
- application/json
Date:
- Tue, 08 Aug 2023 21:42:06 GMT
Server:
- cloudflare
Set-Cookie:
- __cf_bm=zB0ETxnaV0kJzmyVyhhM2ZwIFSuA0eNxJ2FvRuPgG9s-1691530926-0-AQLXHBSsCwuXuiOXkg86hSIKr1UR1ihHIGDIrlfZ+zv0MVziB/rpH6H+EknfKKjcJMyFjIjACi8tggV87C83JS0=;
path=/; expires=Tue, 08-Aug-23 22:12:06 GMT; domain=.igdb.com; HttpOnly; Secure;
SameSite=None
Strict-Transport-Security:
- max-age=31536000; includeSubDomains; preload
Transfer-Encoding:
- chunked
Via:
- 1.1 fe2c65104051140806cad998f531e478.cloudfront.net (CloudFront)
X-Amz-Cf-Id:
- QfT8ouLqo-_tJw0mOCqRGudg1z4R5KlILNRHYGG4ehbuHDse4k4OWQ==
X-Amz-Cf-Pop:
- YUL62-C2
X-Cache:
- Miss from cloudfront
X-Content-Type-Options:
- nosniff
X-Count:
- '7'
alt-svc:
- h3=":443"; ma=86400
x-amz-apigw-id:
- JXF7VFzivHcFS_w=
x-amzn-Remapped-Content-Length:
- '477'
x-amzn-Remapped-Date:
- Tue, 08 Aug 2023 21:42:06 GMT
x-amzn-RequestId:
- 54fb9c00-2b9c-4a62-9efd-89e44f768f66
status:
code: 200
message: OK
version: 1

View File

@@ -28,14 +28,31 @@ def test_get_rom():
assert urlparse(rom["url_screenshots"][0]).hostname == "images.igdb.com"
rom = igdbh.get_rom("Not a real game title", 4)
assert rom == {
"r_igdb_id": 0,
"r_slug": "",
"r_name": "Not a real game title",
"summary": "",
"url_cover": "",
"url_screenshots": [],
}
assert rom["r_igdb_id"] == 0
assert rom["r_slug"] == ""
assert rom["r_name"] == "Not a real game title"
assert not rom["summary"]
assert not rom["url_cover"]
assert not rom["url_screenshots"]
@pytest.mark.vcr()
def test_get_ps2_opl_rom():
rom = igdbh.get_rom("WWE Smack.iso", 8)
assert rom["r_igdb_id"] == 0
assert rom["r_slug"] == ""
assert rom["r_name"] == "WWE Smack"
assert not rom["summary"]
assert not rom["url_cover"]
assert not rom["url_screenshots"]
rom = igdbh.get_rom("SLUS_210.60.WWE Smack.iso", 8)
assert rom["r_igdb_id"] == 80852
assert rom["r_slug"] == "wwe-smackdown-vs-raw"
assert rom["r_name"] == "WWE Smackdown! vs. Raw"
assert rom["summary"]
assert urlparse(rom["url_cover"]).hostname == "images.igdb.com"
assert urlparse(rom["url_screenshots"][0]).hostname == "images.igdb.com"
@pytest.mark.vcr()

View File

@@ -5,8 +5,8 @@ from fastapi.middleware.cors import CORSMiddleware
from fastapi_pagination import add_pagination
from config import DEV_PORT, DEV_HOST
from handler.socket_manager import SocketManager
from endpoints import scan, search, platform, rom
from endpoints import search, platform, rom, scan # noqa
from utils.socket import socket_app
app = FastAPI()
app.add_middleware(
@@ -21,20 +21,7 @@ app.include_router(platform.router)
app.include_router(rom.router)
add_pagination(app)
sm = SocketManager()
sm.mount_to("/ws", app)
async def scan_handler(*args):
try:
await scan.scan(sm, *args)
except Exception as err:
await sm.emit("scan:done_ko", str(err))
raise (err)
sm.on("scan", handler=scan_handler)
app.mount("/ws", socket_app)
@app.on_event("startup")

42
backend/utils/cache.py Normal file
View File

@@ -0,0 +1,42 @@
from redis import Redis, ConnectionError
from config import REDIS_HOST, REDIS_PORT
redis_client = Redis(host=REDIS_HOST, port=REDIS_PORT, db=0)
redis_url = f"redis://{REDIS_HOST}:{REDIS_PORT}"
try:
redis_connectable = redis_client.ping()
except ConnectionError:
redis_connectable = False
class FallbackCache:
def __init__(self) -> None:
self.fallback = {}
def get(self, key: str, *args, **kwargs) -> str:
return self.fallback.get(key, "")
def set(self, key: str, value: str, *args, **kwargs) -> None:
self.fallback[key] = value
def delete(self, key: str, *args, **kwargs) -> None:
self.fallback.pop(key, None)
def exists(self, key: str, *args, **kwargs) -> bool:
return key in self.fallback
def flushall(self) -> None:
self.fallback = {}
def __repr__(self) -> str:
return f"<FallbackCache {self.fallback}>"
def __str__(self) -> str:
return repr(self)
# A seperate client that auto-decodes responses is needed
_cache_client = Redis(host=REDIS_HOST, port=REDIS_PORT, db=0, decode_responses=True)
cache = _cache_client if redis_connectable else FallbackCache()

14
backend/utils/socket.py Normal file
View File

@@ -0,0 +1,14 @@
import socketio
from utils.cache import redis_url, redis_connectable
socket_server = socketio.AsyncServer(
cors_allowed_origins="*",
async_mode="asgi",
logger=False,
engineio_logger=False,
client_manager=socketio.AsyncRedisManager(redis_url) if redis_connectable else None,
)
socket_app = socketio.ASGIApp(socket_server)

15
backend/worker.py Executable file
View File

@@ -0,0 +1,15 @@
import sys
from rq import Worker, Queue, Connection
from utils.cache import redis_client, redis_connectable
listen = ["high", "default", "low"]
if __name__ == "__main__":
# Exit if Redis is not connectable
if not redis_connectable:
sys.exit(0)
with Connection(redis_client):
worker = Worker(map(Queue, listen))
worker.work()

View File

@@ -3,11 +3,18 @@ services:
mariadb:
image: mariadb:latest
container_name: mariadb
restart: unless-stopped
environment:
- MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWD}
- MYSQL_DATABASE=${DB_NAME}
- MYSQL_USER=${DB_USER}
- MYSQL_PASSWORD=${DB_PASSWD}
- MYSQL_ROOT_PASSWORD=$DB_ROOT_PASSWD
- MYSQL_DATABASE=$DB_NAME
- MYSQL_USER=$DB_USER
- MYSQL_PASSWORD=$DB_PASSWD
ports:
- ${DB_PORT}:3306
restart: "no"
- $DB_PORT:3306
redis:
image: redis:alpine
container_name: redis
restart: unless-stopped
ports:
- ${REDIS_PORT}:6379

View File

@@ -1,11 +1,16 @@
#!/bin/bash
# Run migrations and start uvicorn
/init_back &
# Start nginx
/init_front &
# Start rq worker
/init_worker &
# Wait for any process to exit
wait -n
# Exit with status of process that exited first
exit $?

View File

@@ -0,0 +1,4 @@
#!/bin/bash
cd /back
rq worker high default low --logging_level WARN

View File

@@ -18,3 +18,7 @@ DB_NAME=romm
DB_USER=romm
DB_PASSWD=
DB_ROOT_PASSWD=
# Redis config (optional)
REDIS_HOST=127.0.0.1
REDIS_PORT=6379

View File

@@ -12,9 +12,11 @@ services:
- DB_USER=romm-user # [Optional] Only needed if ROMM_DB_DRIVER=mariadb
- DB_NAME=romm # [Optional] Only needed if ROMM_DB_DRIVER=mariadb. Can be optionally changed, and should match the MYSQL_DATABASE value in the mariadb container.
- DB_PASSWD=<database password> # [Optional] Only needed if ROMM_DB_DRIVER=mariadb
- REDIS_HOST=redis # [Optional]
- REDIS_PORT=6379 # [Optional]
- CLIENT_ID=<IGDB client id>
- CLIENT_SECRET=<IGDB client secret>
- STEAMGRIDDB_API_KEY=<SteamGridDB api key>
- STEAMGRIDDB_API_KEY=<SteamGridDB api key> # [Optional]
volumes:
- '/path/to/library:/romm/library'
- '/path/to/resources:/romm/resources' # [Optional] Path where roms metadata (cover) are stored

View File

@@ -66,7 +66,7 @@ async function scan() {
});
if (!socket.connected) socket.connect();
socket.emit("scan", JSON.stringify([route.params.platform]), false);
socket.emit("scan", route.params.platform, false);
}
async function fetchMoreSearch() {

View File

@@ -15,24 +15,40 @@ const completeRescan = ref(false);
// Event listeners bus
const emitter = inject("emitter");
function scrollToBottom() {
window.scrollTo(0, document.body.scrollHeight);
}
socket.on("scan:scanning_platform", ({ p_name, p_slug }) => {
scannedPlatforms.value.push({
name: p_name,
slug: p_slug,
roms: [],
});
window.setTimeout(scrollToBottom, 100);
});
socket.on("scan:scanning_rom", ({ p_slug, file_name, r_name }) => {
const platform = scannedPlatforms.value.find((p) => p.slug === p_slug);
platform.roms.push({
name: r_name,
file_name: file_name,
});
socket.on("scan:scanning_rom", ({ p_slug, p_name, ...rom }) => {
let platform = scannedPlatforms.value.find((p) => p.slug === p_slug);
// Add the platform if the socket dropped and it's missing
if (!platform) {
scannedPlatforms.value.push({
name: p_name,
slug: p_slug,
roms: [],
});
platform = scannedPlatforms.slice(-1);
}
platform.roms.push(rom);
window.setTimeout(scrollToBottom, 100);
});
socket.on("scan:done", () => {
scanning.set(false);
emitter.emit("refreshPlatforms");
emitter.emit("snackbarShow", {
msg: "Scan completed successfully!",
@@ -44,6 +60,7 @@ socket.on("scan:done", () => {
socket.on("scan:done_ko", (msg) => {
scanning.set(false);
emitter.emit("snackbarShow", {
msg: `Scan couldn't be completed. Something went wrong: ${msg}`,
icon: "mdi-close-circle",
@@ -61,7 +78,7 @@ async function scan() {
socket.emit(
"scan",
JSON.stringify(platformsToScan.value.map((p) => p.fs_slug)),
platformsToScan.value.map((p) => p.fs_slug).join(","),
completeRescan.value
);
}
@@ -135,8 +152,8 @@ async function scan() {
</v-avatar>
<span class="text-body-2 ml-5"> {{ platform.name }}</span>
<v-list-item v-for="rom in platform.roms" class="text-body-2" disabled>
<span v-if="rom.name" class="ml-10">
• Identified <b>{{ rom.name }} 👾</b>
<span v-if="rom.r_igdb_id" class="ml-10">
• Identified <b>{{ rom.r_name }} 👾</b>
</span>
<span v-else class="ml-10">
• {{ rom.file_name }} not found in IGDB

134
poetry.lock generated
View File

@@ -1,10 +1,27 @@
# This file is automatically @generated by Poetry 1.4.2 and should not be changed by hand.
# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand.
[[package]]
name = "aioredis"
version = "2.0.1"
description = "asyncio (PEP 3156) Redis support"
optional = false
python-versions = ">=3.6"
files = [
{file = "aioredis-2.0.1-py3-none-any.whl", hash = "sha256:9ac0d0b3b485d293b8ca1987e6de8658d7dafcca1cddfcd1d506cae8cdebfdd6"},
{file = "aioredis-2.0.1.tar.gz", hash = "sha256:eaa51aaf993f2d71f54b70527c440437ba65340588afeb786cd87c55c89cd98e"},
]
[package.dependencies]
async-timeout = "*"
typing-extensions = "*"
[package.extras]
hiredis = ["hiredis (>=1.0)"]
[[package]]
name = "alembic"
version = "1.10.4"
description = "A database migration tool for SQLAlchemy."
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -24,7 +41,6 @@ tz = ["python-dateutil"]
name = "anyio"
version = "3.6.2"
description = "High level compatibility layer for multiple asynchronous event loop implementations"
category = "main"
optional = false
python-versions = ">=3.6.2"
files = [
@@ -45,7 +61,6 @@ trio = ["trio (>=0.16,<0.22)"]
name = "appnope"
version = "0.1.3"
description = "Disable App Nap on macOS >= 10.9"
category = "main"
optional = false
python-versions = "*"
files = [
@@ -57,7 +72,6 @@ files = [
name = "asttokens"
version = "2.2.1"
description = "Annotate AST trees with source code positions"
category = "main"
optional = false
python-versions = "*"
files = [
@@ -71,11 +85,21 @@ six = "*"
[package.extras]
test = ["astroid", "pytest"]
[[package]]
name = "async-timeout"
version = "4.0.2"
description = "Timeout context manager for asyncio programs"
optional = false
python-versions = ">=3.6"
files = [
{file = "async-timeout-4.0.2.tar.gz", hash = "sha256:2163e1640ddb52b7a8c80d0a67a08587e5d245cc9c553a74a847056bc2976b15"},
{file = "async_timeout-4.0.2-py3-none-any.whl", hash = "sha256:8ca1e4fcf50d07413d66d1a5e416e42cfdf5851c981d679a09851a6853383b3c"},
]
[[package]]
name = "backcall"
version = "0.2.0"
description = "Specifications for callback functions passed in to an API"
category = "main"
optional = false
python-versions = "*"
files = [
@@ -87,7 +111,6 @@ files = [
name = "bidict"
version = "0.22.1"
description = "The bidirectional mapping library for Python."
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -104,7 +127,6 @@ test = ["hypothesis", "pytest", "pytest-benchmark[histogram]", "pytest-cov", "py
name = "certifi"
version = "2023.7.22"
description = "Python package for providing Mozilla's CA Bundle."
category = "main"
optional = false
python-versions = ">=3.6"
files = [
@@ -116,7 +138,6 @@ files = [
name = "charset-normalizer"
version = "3.1.0"
description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet."
category = "main"
optional = false
python-versions = ">=3.7.0"
files = [
@@ -201,7 +222,6 @@ files = [
name = "click"
version = "8.1.3"
description = "Composable command line interface toolkit"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -216,7 +236,6 @@ colorama = {version = "*", markers = "platform_system == \"Windows\""}
name = "colorama"
version = "0.4.6"
description = "Cross-platform colored terminal text."
category = "main"
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
files = [
@@ -228,7 +247,6 @@ files = [
name = "decorator"
version = "5.1.1"
description = "Decorators for Humans"
category = "main"
optional = false
python-versions = ">=3.5"
files = [
@@ -240,7 +258,6 @@ files = [
name = "emoji"
version = "2.2.0"
description = "Emoji for Python"
category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
files = [
@@ -254,7 +271,6 @@ dev = ["coverage", "coveralls", "pytest"]
name = "exceptiongroup"
version = "1.1.2"
description = "Backport of PEP 654 (exception groups)"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -269,7 +285,6 @@ test = ["pytest (>=6)"]
name = "executing"
version = "1.2.0"
description = "Get the currently executing AST node of a frame, and other information"
category = "main"
optional = false
python-versions = "*"
files = [
@@ -284,7 +299,6 @@ tests = ["asttokens", "littleutils", "pytest", "rich"]
name = "fastapi"
version = "0.95.1"
description = "FastAPI framework, high performance, easy to learn, fast to code, ready for production"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -306,7 +320,6 @@ test = ["anyio[trio] (>=3.2.1,<4.0.0)", "black (==23.1.0)", "coverage[toml] (>=6
name = "fastapi-pagination"
version = "0.12.4"
description = "FastAPI pagination"
category = "main"
optional = false
python-versions = ">=3.8,<4.0"
files = [
@@ -339,7 +352,6 @@ tortoise = ["tortoise-orm (>=0.16.18,<0.20.0)"]
name = "greenlet"
version = "2.0.2"
description = "Lightweight in-process concurrent programming"
category = "main"
optional = false
python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*"
files = [
@@ -413,7 +425,6 @@ test = ["objgraph", "psutil"]
name = "h11"
version = "0.14.0"
description = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -425,7 +436,6 @@ files = [
name = "idna"
version = "3.4"
description = "Internationalized Domain Names in Applications (IDNA)"
category = "main"
optional = false
python-versions = ">=3.5"
files = [
@@ -437,7 +447,6 @@ files = [
name = "iniconfig"
version = "2.0.0"
description = "brain-dead simple config-ini parsing"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -449,7 +458,6 @@ files = [
name = "ipdb"
version = "0.13.13"
description = "IPython-enabled pdb"
category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
files = [
@@ -466,7 +474,6 @@ tomli = {version = "*", markers = "python_version > \"3.6\" and python_version <
name = "ipython"
version = "8.13.2"
description = "IPython: Productive Interactive Computing"
category = "main"
optional = false
python-versions = ">=3.9"
files = [
@@ -505,7 +512,6 @@ test-extra = ["curio", "matplotlib (!=3.2.0)", "nbformat", "numpy (>=1.21)", "pa
name = "jedi"
version = "0.18.2"
description = "An autocompletion tool for Python that can be used for text editors."
category = "main"
optional = false
python-versions = ">=3.6"
files = [
@@ -525,7 +531,6 @@ testing = ["Django (<3.1)", "attrs", "colorama", "docopt", "pytest (<7.0.0)"]
name = "mako"
version = "1.2.4"
description = "A super-fast templating language that borrows the best ideas from the existing templating languages."
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -545,7 +550,6 @@ testing = ["pytest"]
name = "mariadb"
version = "1.1.7"
description = "Python MariaDB extension"
category = "main"
optional = false
python-versions = ">=3.8"
files = [
@@ -567,7 +571,6 @@ packaging = "*"
name = "markupsafe"
version = "2.1.2"
description = "Safely add untrusted strings to HTML/XML markup."
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -627,7 +630,6 @@ files = [
name = "matplotlib-inline"
version = "0.1.6"
description = "Inline Matplotlib backend for Jupyter"
category = "main"
optional = false
python-versions = ">=3.5"
files = [
@@ -642,7 +644,6 @@ traitlets = "*"
name = "multidict"
version = "6.0.4"
description = "multidict implementation"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -726,7 +727,6 @@ files = [
name = "packaging"
version = "23.1"
description = "Core utilities for Python packages"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -738,7 +738,6 @@ files = [
name = "parso"
version = "0.8.3"
description = "A Python Parser"
category = "main"
optional = false
python-versions = ">=3.6"
files = [
@@ -754,7 +753,6 @@ testing = ["docopt", "pytest (<6.0.0)"]
name = "pexpect"
version = "4.8.0"
description = "Pexpect allows easy control of interactive console applications."
category = "main"
optional = false
python-versions = "*"
files = [
@@ -769,7 +767,6 @@ ptyprocess = ">=0.5"
name = "pickleshare"
version = "0.7.5"
description = "Tiny 'shelve'-like database with concurrency support"
category = "main"
optional = false
python-versions = "*"
files = [
@@ -781,7 +778,6 @@ files = [
name = "pluggy"
version = "1.2.0"
description = "plugin and hook calling mechanisms for python"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -797,7 +793,6 @@ testing = ["pytest", "pytest-benchmark"]
name = "prompt-toolkit"
version = "3.0.38"
description = "Library for building powerful interactive command lines in Python"
category = "main"
optional = false
python-versions = ">=3.7.0"
files = [
@@ -812,7 +807,6 @@ wcwidth = "*"
name = "ptyprocess"
version = "0.7.0"
description = "Run a subprocess in a pseudo terminal"
category = "main"
optional = false
python-versions = "*"
files = [
@@ -824,7 +818,6 @@ files = [
name = "pure-eval"
version = "0.2.2"
description = "Safely evaluate AST nodes without side effects"
category = "main"
optional = false
python-versions = "*"
files = [
@@ -839,7 +832,6 @@ tests = ["pytest"]
name = "pydantic"
version = "1.10.7"
description = "Data validation and settings management using python type hints"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -892,7 +884,6 @@ email = ["email-validator (>=1.0.3)"]
name = "pydash"
version = "7.0.6"
description = "The kitchen sink of Python utility libraries for doing \"stuff\" in a functional way. Based on the Lo-Dash Javascript library."
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -910,7 +901,6 @@ dev = ["Sphinx", "black", "build", "coverage", "docformatter", "flake8", "flake8
name = "pygments"
version = "2.15.1"
description = "Pygments is a syntax highlighting package written in Python."
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -925,7 +915,6 @@ plugins = ["importlib-metadata"]
name = "pytest"
version = "7.4.0"
description = "pytest: simple powerful testing with Python"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -948,7 +937,6 @@ testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "no
name = "pytest-env"
version = "0.8.2"
description = "py.test plugin that allows you to add environment variables."
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -966,7 +954,6 @@ test = ["coverage (>=7.2.7)", "pytest-mock (>=3.10)"]
name = "pytest-mock"
version = "3.11.1"
description = "Thin-wrapper around the mock package for easier use with pytest"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -984,7 +971,6 @@ dev = ["pre-commit", "pytest-asyncio", "tox"]
name = "pytest-vcr"
version = "1.0.2"
description = "Plugin for managing VCR.py cassettes"
category = "main"
optional = false
python-versions = "*"
files = [
@@ -1000,7 +986,6 @@ vcrpy = "*"
name = "python-dateutil"
version = "2.8.2"
description = "Extensions to the standard Python datetime module"
category = "main"
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7"
files = [
@@ -1015,7 +1000,6 @@ six = ">=1.5"
name = "python-dotenv"
version = "1.0.0"
description = "Read key-value pairs from a .env file and set them as environment variables"
category = "main"
optional = false
python-versions = ">=3.8"
files = [
@@ -1030,7 +1014,6 @@ cli = ["click (>=5.0)"]
name = "python-engineio"
version = "4.4.1"
description = "Engine.IO server and client for Python"
category = "main"
optional = false
python-versions = ">=3.6"
files = [
@@ -1046,7 +1029,6 @@ client = ["requests (>=2.21.0)", "websocket-client (>=0.54.0)"]
name = "python-socketio"
version = "5.8.0"
description = "Socket.IO server and client for Python"
category = "main"
optional = false
python-versions = ">=3.6"
files = [
@@ -1066,7 +1048,6 @@ client = ["requests (>=2.21.0)", "websocket-client (>=0.54.0)"]
name = "pyyaml"
version = "6.0"
description = "YAML parser and emitter for Python"
category = "main"
optional = false
python-versions = ">=3.6"
files = [
@@ -1112,11 +1093,28 @@ files = [
{file = "PyYAML-6.0.tar.gz", hash = "sha256:68fb519c14306fec9720a2a5b45bc9f0c8d1b9c72adf45c37baedfcd949c35a2"},
]
[[package]]
name = "redis"
version = "4.6.0"
description = "Python client for Redis database and key-value store"
optional = false
python-versions = ">=3.7"
files = [
{file = "redis-4.6.0-py3-none-any.whl", hash = "sha256:e2b03db868160ee4591de3cb90d40ebb50a90dd302138775937f6a42b7ed183c"},
{file = "redis-4.6.0.tar.gz", hash = "sha256:585dc516b9eb042a619ef0a39c3d7d55fe81bdb4df09a52c9cdde0d07bf1aa7d"},
]
[package.dependencies]
async-timeout = {version = ">=4.0.2", markers = "python_full_version <= \"3.11.2\""}
[package.extras]
hiredis = ["hiredis (>=1.0.0)"]
ocsp = ["cryptography (>=36.0.1)", "pyopenssl (==20.0.1)", "requests (>=2.26.0)"]
[[package]]
name = "requests"
version = "2.31.0"
description = "Python HTTP for Humans."
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -1134,11 +1132,25 @@ urllib3 = ">=1.21.1,<3"
socks = ["PySocks (>=1.5.6,!=1.5.7)"]
use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"]
[[package]]
name = "rq"
version = "1.15.1"
description = "RQ is a simple, lightweight, library for creating background jobs, and processing them."
optional = false
python-versions = ">=3.6"
files = [
{file = "rq-1.15.1-py2.py3-none-any.whl", hash = "sha256:6e243d8d9c4af4686ded4b01b25ea1ff4bac4fc260b02638fbe9c8c17b004bd1"},
{file = "rq-1.15.1.tar.gz", hash = "sha256:1f49f4ac1a084044bb8e95b3f305c0bf17e55618b08c18e0b60c080f12d6f008"},
]
[package.dependencies]
click = ">=5.0.0"
redis = ">=4.0.0"
[[package]]
name = "six"
version = "1.16.0"
description = "Python 2 and 3 compatibility utilities"
category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
files = [
@@ -1150,7 +1162,6 @@ files = [
name = "sniffio"
version = "1.3.0"
description = "Sniff out which async library your code is running under"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -1162,7 +1173,6 @@ files = [
name = "sqlakeyset"
version = "2.0.1684285512"
description = "offset-free paging for sqlalchemy"
category = "main"
optional = false
python-versions = ">=3.7,<4.0"
files = [
@@ -1180,7 +1190,6 @@ typing_extensions = ">=4,<5"
name = "sqlalchemy"
version = "2.0.12"
description = "Database Abstraction Library"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -1228,7 +1237,7 @@ files = [
]
[package.dependencies]
greenlet = {version = "!=0.4.17", markers = "platform_machine == \"aarch64\" or platform_machine == \"ppc64le\" or platform_machine == \"x86_64\" or platform_machine == \"amd64\" or platform_machine == \"AMD64\" or platform_machine == \"win32\" or platform_machine == \"WIN32\""}
greenlet = {version = "!=0.4.17", markers = "platform_machine == \"win32\" or platform_machine == \"WIN32\" or platform_machine == \"AMD64\" or platform_machine == \"amd64\" or platform_machine == \"x86_64\" or platform_machine == \"ppc64le\" or platform_machine == \"aarch64\""}
typing-extensions = ">=4.2.0"
[package.extras]
@@ -1258,7 +1267,6 @@ sqlcipher = ["sqlcipher3-binary"]
name = "stack-data"
version = "0.6.2"
description = "Extract data from python stack frames and tracebacks for informative displays"
category = "main"
optional = false
python-versions = "*"
files = [
@@ -1278,7 +1286,6 @@ tests = ["cython", "littleutils", "pygments", "pytest", "typeguard"]
name = "starlette"
version = "0.26.1"
description = "The little ASGI library that shines."
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -1296,7 +1303,6 @@ full = ["httpx (>=0.22.0)", "itsdangerous", "jinja2", "python-multipart", "pyyam
name = "tomli"
version = "2.0.1"
description = "A lil' TOML parser"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -1308,7 +1314,6 @@ files = [
name = "traitlets"
version = "5.9.0"
description = "Traitlets Python configuration system"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -1324,7 +1329,6 @@ test = ["argcomplete (>=2.0)", "pre-commit", "pytest", "pytest-mock"]
name = "typing-extensions"
version = "4.5.0"
description = "Backported and Experimental Type Hints for Python 3.7+"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -1336,7 +1340,6 @@ files = [
name = "unidecode"
version = "1.3.6"
description = "ASCII transliterations of Unicode text"
category = "main"
optional = false
python-versions = ">=3.5"
files = [
@@ -1348,7 +1351,6 @@ files = [
name = "urllib3"
version = "2.0.2"
description = "HTTP library with thread-safe connection pooling, file post, and more."
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -1366,7 +1368,6 @@ zstd = ["zstandard (>=0.18.0)"]
name = "uvicorn"
version = "0.22.0"
description = "The lightning-fast ASGI server."
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -1385,7 +1386,6 @@ standard = ["colorama (>=0.4)", "httptools (>=0.5.0)", "python-dotenv (>=0.13)",
name = "vcrpy"
version = "5.1.0"
description = "Automatically mock your HTTP interactions to simplify and speed up testing"
category = "main"
optional = false
python-versions = ">=3.8"
files = [
@@ -1402,7 +1402,6 @@ yarl = "*"
name = "wcwidth"
version = "0.2.6"
description = "Measures the displayed width of unicode strings in a terminal"
category = "main"
optional = false
python-versions = "*"
files = [
@@ -1414,7 +1413,6 @@ files = [
name = "websockets"
version = "11.0.3"
description = "An implementation of the WebSocket Protocol (RFC 6455 & 7692)"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -1494,7 +1492,6 @@ files = [
name = "wrapt"
version = "1.15.0"
description = "Module for decorators, wrappers and monkey patching."
category = "main"
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7"
files = [
@@ -1579,7 +1576,6 @@ files = [
name = "yarl"
version = "1.9.2"
description = "Yet another URL library"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -1666,4 +1662,4 @@ multidict = ">=4.0"
[metadata]
lock-version = "2.0"
python-versions = "^3.10"
content-hash = "226d69976d98caf0de533c83cd447c2e1074234f104ecedc33eb3b61d50a58a9"
content-hash = "9f86d5d57b6df96b54973786c7129f7a6bb2182466558463a8336ffe0cc5c0f5"

View File

@@ -27,6 +27,8 @@ pytest-env = "^0.8.2"
pytest-vcr = "^1.0.2"
pytest-mock = "^3.11.1"
mariadb = "1.1.7"
rq = "^1.15.1"
aioredis = "^2.0.1"
[build-system]

BIN
romm.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB