feat: localize tags and genres; improve search, duration and sorting
CI / test (push) Successful in 27s

This commit is contained in:
strsv committed 2026-11-09 08:13:00 +03:00
1 parent ea3074e0a9
commit be4fbf6864
31 files changed
+1126 -145

No files matched your search

+7 -1
View File
@@ -36,7 +36,10 @@ SKIP_FILES = {"steam.db", "steam.db-wal", "steam.db-shm", "steam_library.csv",
START_BAT = """@echo off
setlocal
cd /d "%~dp0app"
"..\\python\\python.exe" web\\server.py --open
rem Stop the previous server (PID file, then port) and start a new one.
rem Pass a port to override the default: start_web.bat 9000
"..\\python\\python.exe" tools\\restart_server.py %*
if errorlevel 1 pause
"""
@@ -64,6 +67,9 @@ PORTABLE_README = """SteamBase portable
1. Run update.bat once: imports the library, loads descriptions and covers.
2. Run start_web.bat: opens http://127.0.0.1:8765/.
Run it again at any time to stop the previous server and restart it.
You can pass a port: start_web.bat 9000
If the requested port is still busy, the next free port is used.
The database is app\\steam.db; cache is app\\cache; settings are app\\data.
HLTB and WebP previews are not included in the portable build by default;
+69 -6
View File
@@ -8,7 +8,33 @@ from datetime import datetime, timezone
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DEFAULT_DB = os.path.join(BASE_DIR, "steam.db")
SCHEMA_PATH = os.path.join(BASE_DIR, "tools", "schema.sql")
SCHEMA_VERSION = 10
SCHEMA_VERSION = 12
GENRE_NAMES_RU = {
"Action": "Экшены",
"Adventure": "Приключенческие игры",
"Strategy": "Стратегии",
"RPG": "Ролевые игры",
"Indie": "Инди",
"Simulation": "Симуляторы",
"Casual": "Казуальные игры",
"Free To Play": "Бесплатные",
"Massively Multiplayer": "Многопользовательские игры",
"Racing": "Гонки",
"Sports": "Спорт",
"Early Access": "Ранний доступ",
"Accounting": "Бухгалтерия",
"Animation & Modeling": "Анимация и моделирование",
"Audio Production": "Работа со звуком",
"Design & Illustration": "Дизайн и иллюстрация",
"Education": "Образование",
"Photo Editing": "Обработка фото",
"Software Training": "Обучение работе с ПО",
"Utilities": "Утилиты",
"Video Production": "Создание видео",
"Web Publishing": "Веб-разработка",
"Game Development": "Разработка игр",
}
MOOD_PRESETS = {
"adventure-rpg-party": {
@@ -329,11 +355,16 @@ def _plain_text(*parts):
def _search_tags(con, appid):
row = con.execute(
"""SELECT GROUP_CONCAT(tn.name, ' ') AS names
tag_row = con.execute(
"""SELECT GROUP_CONCAT(tn.name || ' ' || COALESCE(tn.name_ru, ''), ' ') AS names
FROM game_tags gt JOIN tag_names tn ON tn.tag_id = gt.tag_id
WHERE gt.appid = ?""", (appid,)).fetchone()
return (row[0] if row and row[0] else "") if row else ""
genre_row = con.execute(
"""SELECT GROUP_CONCAT(gg.genre || ' ' || COALESCE(gn.name_ru, ''), ' ') AS names
FROM game_genres gg LEFT JOIN genre_names gn ON gn.name = gg.genre
WHERE gg.appid = ?""", (appid,)).fetchone()
return " ".join(part for part in (
tag_row[0] if tag_row else "", genre_row[0] if genre_row else "") if part)
def refresh_search_index(con):
@@ -347,16 +378,22 @@ def refresh_search_index(con):
WHERE LOWER(g.type) = 'game'
""").fetchall()
tags = {r[0]: r[1] for r in con.execute("""
SELECT gt.appid, GROUP_CONCAT(tn.name, ' ')
SELECT gt.appid, GROUP_CONCAT(tn.name || ' ' || COALESCE(tn.name_ru, ''), ' ')
FROM game_tags gt JOIN tag_names tn ON tn.tag_id = gt.tag_id
GROUP BY gt.appid
""")}
genres = {r[0]: r[1] for r in con.execute("""
SELECT gg.appid, GROUP_CONCAT(gg.genre || ' ' || COALESCE(gn.name_ru, ''), ' ')
FROM game_genres gg LEFT JOIN genre_names gn ON gn.name = gg.genre
GROUP BY gg.appid
""")}
con.execute("DELETE FROM game_fts")
con.executemany(
"INSERT INTO game_fts(rowid, appid, name, description, tags) VALUES (?, ?, ?, ?, ?)",
[(r["appid"], r["appid"], r["name"],
_plain_text(r["short_description"], r["about"], r["short_ru"], r["about_ru"]),
tags.get(r["appid"], "")) for r in rows],
" ".join(part for part in (tags.get(r["appid"], ""),
genres.get(r["appid"], "")) if part)) for r in rows],
)
con.commit()
@@ -600,6 +637,22 @@ def _migration_10(con):
"ON game_ownership(owned)")
def _migration_11(con):
"""Store localized (Russian) tag names next to the canonical English ones."""
_ensure_column(con, "tag_names", "name_ru", "TEXT")
def _migration_12(con):
"""Add localized genre names."""
con.execute("""
CREATE TABLE IF NOT EXISTS genre_names (
name TEXT PRIMARY KEY,
name_ru TEXT
)
""")
seed_genre_names(con)
MIGRATIONS = {
1: _migration_1,
2: _migration_2,
@@ -611,9 +664,18 @@ MIGRATIONS = {
8: _migration_8,
9: _migration_9,
10: _migration_10,
11: _migration_11,
12: _migration_12,
}
def seed_genre_names(con):
con.executemany(
"""INSERT INTO genre_names (name, name_ru) VALUES (?, ?)
ON CONFLICT(name) DO UPDATE SET name_ru = excluded.name_ru""",
GENRE_NAMES_RU.items())
def init(con):
"""Create or upgrade the database schema.
@@ -629,6 +691,7 @@ def init(con):
con.executescript(f.read())
for target in range(version + 1, SCHEMA_VERSION + 1):
MIGRATIONS[target](con)
seed_genre_names(con)
con.execute("INSERT OR REPLACE INTO schema_meta (key, value) VALUES ('schema_version', ?)",
(str(SCHEMA_VERSION),))
con.commit()
+181 -11
View File
@@ -10,6 +10,7 @@ import argparse
import json
import os
import sys
import time
import urllib.request
from datetime import datetime, timezone
@@ -24,7 +25,9 @@ sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import db
import steam_source
TAG_URL = "https://store.steampowered.com/tagdata/populartags/english"
TAG_URL = "https://store.steampowered.com/tagdata/populartags/{language}"
APP_URL = "https://store.steampowered.com/app/{appid}/?l={language}"
TAG_MODAL_MARKER = "InitAppTagModal"
def iso_from_unix(ts):
@@ -33,13 +36,144 @@ def iso_from_unix(ts):
return datetime.fromtimestamp(int(ts), tz=timezone.utc).strftime("%Y-%m-%d")
def fetch_tag_names():
req = urllib.request.Request(TAG_URL, headers={"User-Agent": "Mozilla/5.0"})
def fetch_tag_names(language="english"):
url = TAG_URL.format(language=language)
req = urllib.request.Request(url, headers={"User-Agent": "Mozilla/5.0"})
with urllib.request.urlopen(req, timeout=30) as resp:
data = json.load(resp)
return {int(t["tagid"]): t["name"] for t in data}
def parse_app_tag_modal(html):
"""Return {tag_id: name} from the InitAppTagModal(...) call on a Store page.
The popular-tags endpoint exposes 429 browsable tags. A game page still lists
every tag it uses in the ``InitAppTagModal`` JSON, so this fills gaps for
tag ids outside the popular list.
"""
index = html.find(TAG_MODAL_MARKER)
if index == -1:
return {}
start = html.find("[", index)
if start == -1:
return {}
try:
payload, _ = json.JSONDecoder().raw_decode(html[start:])
except ValueError:
return {}
if not isinstance(payload, list):
return {}
names = {}
for item in payload:
if not isinstance(item, dict):
continue
try:
tag_id = int(item.get("tagid"))
except (TypeError, ValueError):
continue
name = item.get("name")
if tag_id and isinstance(name, str) and name.strip():
names[tag_id] = name.strip()
return names
def fetch_app_tag_names(appid, language="english", timeout=20):
url = APP_URL.format(appid=appid, language=language)
req = urllib.request.Request(url, headers={"User-Agent": "Mozilla/5.0"})
with urllib.request.urlopen(req, timeout=timeout) as resp:
return parse_app_tag_modal(resp.read().decode("utf-8", "replace"))
def missing_tag_ids(con):
rows = con.execute(
"""SELECT DISTINCT gt.tag_id FROM game_tags gt
LEFT JOIN tag_names tn ON tn.tag_id = gt.tag_id
WHERE tn.tag_id IS NULL OR tn.name IS NULL""")
return {r["tag_id"] for r in rows}
def untranslated_tag_ids(con):
rows = con.execute(
"""SELECT tn.tag_id FROM tag_names tn
WHERE (tn.name_ru IS NULL OR tn.name_ru = '')
AND EXISTS (SELECT 1 FROM game_tags gt WHERE gt.tag_id = tn.tag_id)""")
return {r["tag_id"] for r in rows}
def resolve_missing_tag_names(con, max_pages=50, delay=0.4, log=print):
"""Name and translate tag ids outside the popular list using Store pages."""
missing_names = missing_tag_ids(con)
missing_ru = untranslated_tag_ids(con)
if not (missing_names or missing_ru):
return 0, 0
wanted_ids = missing_names | missing_ru
holders = {}
placeholders = ",".join("?" for _ in wanted_ids)
for row in con.execute(
f"SELECT appid, tag_id FROM game_tags WHERE tag_id IN ({placeholders}) ORDER BY appid",
sorted(wanted_ids)):
holders.setdefault(row["tag_id"], []).append(row["appid"])
pages = {}
for tag_id, appids in holders.items():
for appid in appids[:3]:
pages.setdefault(appid, set()).add(tag_id)
ordered = sorted(pages, key=lambda appid: (-len(pages[appid]), appid))[:max_pages]
resolved_names = resolved_ru = 0
for appid in ordered:
wanted = pages[appid] & (missing_names | missing_ru)
if not wanted:
continue
names_en = {}
names_ru = {}
if wanted & missing_names:
try:
names_en = fetch_app_tag_names(appid, "english")
except Exception as exc:
log(f" tag names from app {appid} skipped: {exc}")
time.sleep(delay)
try:
names_ru = fetch_app_tag_names(appid, "russian")
except Exception as exc:
log(f" tag translations from app {appid} skipped: {exc}")
time.sleep(delay)
rows = []
for tag_id in wanted:
name = names_en.get(tag_id)
if name:
rows.append((tag_id, name, names_ru.get(tag_id)))
if rows:
con.executemany(
"""INSERT INTO tag_names (tag_id, name, name_ru) VALUES (?, ?, ?)
ON CONFLICT(tag_id) DO UPDATE SET
name = COALESCE(excluded.name, tag_names.name),
name_ru = COALESCE(excluded.name_ru, tag_names.name_ru)""",
rows)
con.commit()
ru_only = [(names_ru[tag_id], tag_id) for tag_id in wanted
if tag_id not in missing_names and names_ru.get(tag_id)]
if ru_only:
con.executemany("UPDATE tag_names SET name_ru = ? WHERE tag_id = ?", ru_only)
con.commit()
if rows or ru_only:
log(f" tags from app {appid}: {len(rows)} names, {len(ru_only)} translations")
before_names, before_ru = len(missing_names), len(missing_ru)
missing_names = missing_tag_ids(con)
missing_ru = untranslated_tag_ids(con)
resolved_names += before_names - len(missing_names)
resolved_ru += before_ru - len(missing_ru)
if not (missing_names or missing_ru):
break
return resolved_names, resolved_ru
def main():
ap = argparse.ArgumentParser(description="Import the local Steam library into SQLite")
ap.add_argument("--steam-root")
@@ -49,6 +183,10 @@ def main():
ap.add_argument("--incremental", action="store_true",
help="only add new apps; update install/playtime for existing")
ap.add_argument("--no-network", action="store_true", help="never download tag names")
ap.add_argument("--max-tag-pages", type=int, default=50,
help="max Store pages fetched to resolve tag names (default: 50)")
ap.add_argument("--tag-delay", type=float, default=0.4,
help="delay between Store requests in seconds (default: 0.4)")
ap.add_argument("--refresh-parents", action="store_true",
help="update games.parent_appid from appinfo and exit")
args = ap.parse_args()
@@ -98,13 +236,23 @@ def main():
return
existing_tags = {r["tag_id"]: r["name"] for r in con.execute("SELECT tag_id, name FROM tag_names")}
existing_ru = {r["tag_id"] for r in con.execute(
"SELECT tag_id FROM tag_names WHERE name_ru IS NOT NULL AND name_ru <> ''")}
new_tags = {}
if not args.no_network and (args.refresh_tags or len(existing_tags) < 50):
try:
new_tags = fetch_tag_names()
print(f"Tag names downloaded: {len(new_tags)}")
except Exception as exc:
print(f"Tag download skipped: {exc}", file=sys.stderr)
new_tags_ru = {}
if not args.no_network:
if args.refresh_tags or len(existing_tags) < 50:
try:
new_tags = fetch_tag_names()
print(f"Tag names downloaded: {len(new_tags)}")
except Exception as exc:
print(f"Tag download skipped: {exc}", file=sys.stderr)
if args.refresh_tags or len(existing_tags) < 50 or len(existing_ru) < len(existing_tags):
try:
new_tags_ru = fetch_tag_names("russian")
print(f"Tag translations downloaded: {len(new_tags_ru)}")
except Exception as exc:
print(f"Tag translation download skipped: {exc}", file=sys.stderr)
now = datetime.now(timezone.utc).isoformat(timespec="seconds")
@@ -153,8 +301,14 @@ def main():
report_every = max(1, total_apps // 20)
with con:
if new_tags:
con.executemany("INSERT OR REPLACE INTO tag_names (tag_id, name) VALUES (?, ?)",
new_tags.items())
con.executemany(
"""INSERT INTO tag_names (tag_id, name) VALUES (?, ?)
ON CONFLICT(tag_id) DO UPDATE SET name = excluded.name""",
new_tags.items())
if new_tags_ru:
con.executemany(
"UPDATE tag_names SET name_ru = ? WHERE tag_id = ?",
[(name, tag_id) for tag_id, name in new_tags_ru.items()])
for index, appid in enumerate(lib_ids, 1):
pt = playtime.get(appid)
@@ -210,16 +364,32 @@ def main():
con.execute("INSERT OR REPLACE INTO schema_meta (key, value) VALUES ('steam_root', ?)", (root,))
con.execute("INSERT OR REPLACE INTO schema_meta (key, value) VALUES ('steamid', ?)", (steamid,))
unnamed = missing_tag_ids(con)
untranslated = untranslated_tag_ids(con)
if (unnamed or untranslated) and not args.no_network:
print(f"Tags without names/translations: {len(unnamed)}/{len(untranslated)}; "
f"resolving from Store pages...")
added_names, added_ru = resolve_missing_tag_names(
con, max_pages=args.max_tag_pages, delay=args.tag_delay)
unnamed = missing_tag_ids(con)
untranslated = untranslated_tag_ids(con)
print(f"Tag names resolved: +{added_names}, translations: +{added_ru} "
f"(unnamed now: {len(unnamed)}, untranslated now: {len(untranslated)})")
db.refresh_search_index(con)
db.refresh_duration_estimates(con)
db.backfill_release_dates(con)
counts = {r["type"]: r["n"] for r in con.execute(
"SELECT COALESCE(LOWER(type), 'unknown') AS type, COUNT(*) AS n FROM games GROUP BY 1")}
named = con.execute("SELECT COUNT(*) FROM tag_names").fetchone()[0]
translated = con.execute(
"SELECT COUNT(*) FROM tag_names WHERE name_ru IS NOT NULL AND name_ru <> ''").fetchone()[0]
con.close()
print(f"Processed: {new_count + updated_count} apps (new: {new_count}, existing: {updated_count}) -> {args.db}")
print(f"By type: {counts}")
print(f"Tags: {named} named ({translated} ru), {len(unnamed)} unnamed")
if __name__ == "__main__":
+32 -10
View File
@@ -254,14 +254,29 @@ def recommend(con, mood, allowed_statuses=None, unplayed_only=False,
raise ValueError(f"unknown taste profile: {taste_profile}")
context_appids = taste_profile_appids(con, taste_profile) if taste_profile else None
tag_names = {r["tag_id"]: r["name"] for r in con.execute("SELECT tag_id, name FROM tag_names")}
tag_names = {}
tag_labels = {}
for r in con.execute("SELECT tag_id, name, name_ru FROM tag_names"):
tag_names[r["tag_id"]] = r["name"]
tag_labels[r["name"]] = r["name_ru"] or r["name"]
genre_labels = {r["name"]: r["name_ru"] or r["name"]
for r in con.execute("SELECT name, name_ru FROM genre_names")}
name_to_ids = {}
for tid, name in tag_names.items():
name_to_ids.setdefault(name, []).append(tid)
def display_mood(source):
result = dict(source)
result["tags"] = {tag_labels.get(name, name): weight
for name, weight in (source.get("tags") or {}).items()}
result["genres"] = [genre_labels.get(name, name)
for name in (source.get("genres") or [])]
return result
rows = con.execute("""
SELECT g.appid, g.name, g.metacritic, g.review_pct, g.release_date,
g.estimated_hours,
g.hltb_main, g.hltb_extra, g.hltb_complete,
COALESCE(p.minutes, 0) AS minutes, p.last_played,
COALESCE(i.installed, 0) AS installed,
COALESCE(pe.status, 'backlog') AS status, pe.rating, pe.favorite, pe.notes
@@ -294,7 +309,7 @@ def recommend(con, mood, allowed_statuses=None, unplayed_only=False,
ids = [r["appid"] for r in rows]
if not ids:
return mood, []
return display_mood(mood), []
placeholders = ",".join("?" * len(ids))
game_tags = {i: set() for i in ids}
@@ -398,25 +413,29 @@ def recommend(con, mood, allowed_statuses=None, unplayed_only=False,
if recency_reason:
reasons.append(recency_reason)
if matched:
reasons.append("Теги: " + ", ".join(matched[:3]))
reasons.append("Теги: " + ", ".join(tag_labels.get(n, n) for n in matched[:3]))
if r["minutes"] == 0:
reasons.append("Ещё не запускали")
elif r["installed"]:
reasons.append("Установлена")
if hit_genres:
reasons.append("Жанры: " + ", ".join(sorted(hit_genres)))
reasons.append("Жанры: " + ", ".join(
sorted(genre_labels.get(g, g) for g in hit_genres)))
if r["review_pct"] is not None and r["review_pct"] >= 85:
reasons.append(f"Отзывы {r['review_pct']}%")
results.append({
"appid": r["appid"],
"name": r["name"],
"score": round(score, 1),
"matched": matched[:6],
"genres": sorted(hit_genres) or sorted(game_genres.get(r["appid"], []))[:3],
"matched": [tag_labels.get(n, n) for n in matched[:6]],
"genres": [genre_labels.get(g, g) for g in
(sorted(hit_genres) or sorted(game_genres.get(r["appid"], []))[:3])],
"review": r["review_pct"],
"metacritic": r["metacritic"],
"hours": round(r["minutes"] / 60, 1),
"duration": r["estimated_hours"],
"duration": r["hltb_main"] or r["estimated_hours"],
"hltb": {"main": r["hltb_main"], "extra": r["hltb_extra"],
"complete": r["hltb_complete"]} if r["hltb_main"] else None,
"installed": bool(r["installed"]),
"status": r["status"],
"rating": r["rating"],
@@ -426,7 +445,7 @@ def recommend(con, mood, allowed_statuses=None, unplayed_only=False,
"feedback": feedback.get(r["appid"]),
"reasons": reasons[:3],
})
return mood, diversify(results, result_tags, limit)
return display_mood(mood), diversify(results, result_tags, limit)
def similar_games(con, appid, limit=6):
@@ -461,6 +480,8 @@ def similar_games(con, appid, limit=6):
genre_map = {i: set() for i in ids}
for r in con.execute(f"SELECT appid, genre FROM game_genres WHERE appid IN ({ph})", ids):
genre_map[r["appid"]].add(r["genre"])
genre_labels = {r["name"]: r["name_ru"] or r["name"]
for r in con.execute("SELECT name, name_ru FROM genre_names")}
target_tags = tag_map.get(appid, set())
if not target_tags:
@@ -513,7 +534,7 @@ def similar_games(con, appid, limit=6):
"metacritic": r["metacritic"],
"release": r["release_date"],
"year": year,
"genres": sorted(genres)[:3],
"genres": [genre_labels.get(g, g) for g in sorted(genres)[:3]],
"matched": [],
"hours": round((r["minutes"] or 0) / 60, 1),
"installed": bool(r["installed"]),
@@ -530,7 +551,8 @@ def similar_games(con, appid, limit=6):
if wanted:
ph2 = ",".join("?" * len(wanted))
names = {r["tag_id"]: r["name"] for r in con.execute(
f"SELECT tag_id, name FROM tag_names WHERE tag_id IN ({ph2})", list(wanted))}
f"SELECT tag_id, COALESCE(name_ru, name) AS name FROM tag_names "
f"WHERE tag_id IN ({ph2})", list(wanted))}
for g in top:
common = target_tags & tag_map.get(g["appid"], set())
g["matched"] = [names[t] for t in common if t in names][:5]
+125
View File
@@ -0,0 +1,125 @@
"""Stop the running SteamBase server and start it again.
Usage:
python tools/restart_server.py
python tools/restart_server.py --port 9000
"""
import os
import socket
import subprocess
import sys
import time
for stream in (sys.stdout, sys.stderr):
try:
stream.reconfigure(encoding="utf-8")
except Exception:
pass
APP_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
PID_FILE = os.path.join(APP_DIR, "data", "server.pid")
SERVER = os.path.join(APP_DIR, "web", "server.py")
def pid_from_file():
try:
with open(PID_FILE, encoding="ascii") as handle:
return int(handle.read().strip())
except (OSError, ValueError):
return None
def kill_pid(pid):
if not pid or pid <= 0:
return
script = (
f"$proc = Get-CimInstance Win32_Process -Filter 'ProcessId={pid}' "
"-ErrorAction SilentlyContinue; "
"if ($proc -and $proc.CommandLine -like '*server.py*') { "
"Stop-Process -Id $proc.ProcessId -Force -ErrorAction SilentlyContinue }"
)
try:
subprocess.run(
["powershell", "-NoProfile", "-ExecutionPolicy", "Bypass", "-Command", script],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=15)
except Exception:
pass
def port_busy(port, host="127.0.0.1"):
sock = socket.socket()
sock.settimeout(0.2)
try:
sock.connect((host, port))
return True
except OSError:
return False
finally:
sock.close()
def kill_port(port):
script = (
f"Get-NetTCPConnection -LocalPort {port} -State Listen -ErrorAction SilentlyContinue "
"| Select-Object -ExpandProperty OwningProcess -Unique "
"| ForEach-Object { "
"$proc = Get-CimInstance Win32_Process -Filter \"ProcessId=$_\" "
"-ErrorAction SilentlyContinue; "
"if ($proc -and $proc.CommandLine -like '*server.py*') { "
"Stop-Process -Id $_ -Force -ErrorAction SilentlyContinue } }"
)
try:
subprocess.run(
["powershell", "-NoProfile", "-ExecutionPolicy", "Bypass", "-Command", script],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=20)
except Exception:
pass
def free_port(start):
port = start
while port_busy(port) and port < start + 50:
port += 1
return port
def main():
args = [arg for arg in sys.argv[1:] if arg != "--no-open"]
no_open = "--no-open" in sys.argv[1:]
port = 8765
if "--port" in args:
try:
port = int(args[args.index("--port") + 1])
except (IndexError, ValueError):
raise SystemExit("invalid --port")
elif args:
try:
port = int(args[0])
except ValueError:
raise SystemExit(f"unknown argument: {args[0]}")
pid = pid_from_file()
if pid:
kill_pid(pid)
try:
os.remove(PID_FILE)
except OSError:
pass
kill_port(port)
for _ in range(25):
if not port_busy(port):
break
time.sleep(0.2)
final_port = free_port(port)
if final_port != port:
print(f"Port {port} is busy; starting on {final_port}.")
cmd = [sys.executable, SERVER, "--port", str(final_port)]
if not no_open:
cmd.append("--open")
return subprocess.call(cmd, cwd=APP_DIR)
if __name__ == "__main__":
raise SystemExit(main())
+8 -2
View File
@@ -40,8 +40,14 @@ CREATE TABLE IF NOT EXISTS game_genres (
CREATE INDEX IF NOT EXISTS idx_game_genres_genre ON game_genres(genre);
CREATE TABLE IF NOT EXISTS tag_names (
tag_id INTEGER PRIMARY KEY,
name TEXT NOT NULL
tag_id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
name_ru TEXT
);
CREATE TABLE IF NOT EXISTS genre_names (
name TEXT PRIMARY KEY,
name_ru TEXT
);
CREATE TABLE IF NOT EXISTS game_tags (
+10
View File
@@ -29,6 +29,16 @@ GENRES = {
28: "Simulation",
29: "Massively Multiplayer",
37: "Free To Play",
51: "Animation & Modeling",
52: "Audio Production",
53: "Design & Illustration",
54: "Education",
55: "Photo Editing",
56: "Software Training",
57: "Utilities",
58: "Video Production",
59: "Web Publishing",
60: "Game Development",
70: "Early Access",
71: "Animation & Modeling",
72: "Design & Illustration",