all repos — myprecious @ bf1121dbaf0e48befb0831a845cd069e9e546519

A lightweight web service to backup precious game saves.

add games to database
Marco Andronaco andronacomarco@gmail.com
Sat, 19 Aug 2023 19:18:59 +0200
commit

bf1121dbaf0e48befb0831a845cd069e9e546519

parent

d7583eb4604a185c188647b4cc192555e1579119

M migrations/init.sqlmigrations/init.sql

@@ -12,4 +12,22 @@ password text not null,

salt text not null, email text, requested datetime DEFAULT CURRENT_TIMESTAMP -) +); + +create table if not exists platforms ( + platform_id INTEGER PRIMARY KEY, + name text unique not null +); + +create table if not exists games ( + game_id INTEGER PRIMARY KEY, + title text not null +); + +create table if not exists saves ( + user_id integer not null, + game_id integer not null, + platform_id integer not null, + filename text not null, + primary key (user_id, game_id, platform_id) +);
M myprecious/db.pymyprecious/db.py

@@ -1,5 +1,5 @@

-import os, uuid, sqlite3 +import os, sqlite3 from base64 import b64encode from contextlib import suppress from argon2 import PasswordHasher

@@ -84,3 +84,11 @@ with suppress(FileExistsError):

os.makedirs(c.BASE_DIRECTORY) run_sql(c.MIGRATIONS_INIT_PATH) add_user(c.DEFAULT_ADMIN_USER, c.DEFAULT_ADMIN_PW, c.DEFAULT_ADMIN_EMAIL) + +def add_save(game_id, game_title, platform_id, platform_name, user_id, filename): + db_query_one("insert or ignore into platforms (platform_id, name) values (?,?);", [platform_id, platform_name]) + db_query_one("insert or ignore into games (game_id, title) values (?,?);", [game_id, game_title]) + res = db_query_one("select filename from saves where user_id = (?) and game_id = (?) and platform_id = (?);", [user_id, game_id, platform_id]) + db_query_one("delete from saves where user_id = (?) and game_id = (?) and platform_id = (?);", [user_id, game_id, platform_id]) + db_query_one("insert or ignore into saves (user_id, game_id, platform_id, filename) values (?,?,?,?);", [user_id, game_id, platform_id, filename]) + return res[0] if res is not None else None
M myprecious/files.pymyprecious/files.py

@@ -2,6 +2,10 @@ import os

from contextlib import suppress from werkzeug.utils import secure_filename import myprecious.constants as c +from myprecious.db import add_save + +def get_save_folder(platform_id, game_id, user_id): + return os.path.join(c.BASE_DIRECTORY, c.CONTENT_DIRECTORY, str(platform_id), str(game_id), str(user_id)) def get_title_platform(game_id, platform_id): # TODO: use IGDB api to validate game_id, platform_id and return title and platform name

@@ -14,6 +18,9 @@ def handle_upload(request, user_id):

f = request.files['file'] if f.filename is None: return "Bad file upload." + filename = secure_filename(f.filename) + if filename == "": + return "Bad filename." try: game_id = int(request.form['game_id']) platform_id = int(request.form['platform_id'])

@@ -25,14 +32,12 @@ title, platform = get_title_platform(game_id, platform_id)

except Exception: return "Bad or manipulated game data." - # TODO: save game in DB - # db.add_platform(platform_id, name) - # db.add_game(game_id, platform_id, title) - # db.add_save(user_id, game_id, platform_id, f.filename) - - save_folder = os.path.join(c.BASE_DIRECTORY, c.CONTENT_DIRECTORY, str(user_id), str(game_id), str(platform_id)) + old_filename = add_save(game_id, title, platform_id, platform, user_id, filename) + save_folder = get_save_folder(platform_id, game_id, user_id) with suppress(FileExistsError): os.makedirs(save_folder) - save_file = os.path.join(save_folder, secure_filename(f.filename)) + if old_filename is not None: + os.remove(os.path.join(save_folder, old_filename)) + save_file = os.path.join(save_folder, filename) f.save(save_file) return None
M myprecious/games_api_test.pymyprecious/games_api_test.py

@@ -1,4 +1,4 @@

search_response = [{'id': 1820, 'age_ratings': [5570, 36756, 47229], 'aggregated_rating': 86.14285714285714, 'aggregated_rating_count': 9, 'alternative_names': [3115, 3116, 3117, 15088, 15089, 15091, 15092, 27452, 32793, 32794, 32795, 45223, 45224, 45225, 45226, 45227], 'artworks': [2805, 2806, 2807, 2808, 2809, 2810, 2811, 2812, 2813], 'category': 0, 'collection': 7988, 'cover': {'id': 89769, 'alpha_channel': False, 'animated': False, 'game': 1820, 'height': 1700, 'image_id': 'co1x9l', 'url': '//images.igdb.com/igdb/image/upload/t_thumb/co1x9l.jpg', 'width': 1277, 'checksum': 'fa53d84d-598c-a792-ed39-eb23991c5224'}, 'created_at': 1352643045, 'external_games': [29012, 73246, 137384, 217252, 246640], 'first_release_date': 1247270400, 'follows': 13, 'franchises': [3285], 'game_modes': [1, 2], 'genres': [12], 'involved_companies': [20341, 20342, 20343], 'keywords': [78, 226, 415, 521, 558, 623, 793, 1181, 1186, 1208, 1320, 1440, 1459, 1632, 1699, 1710, 1737, 1756, 2071, 2167, 2199, 2242, 2280, 2452, 2472, 2668, 3227, 3486, 3831, 3918, 4272, 4282, 4284, 4285, 4341, 4353, 4359, 4388, 4392, 4397, 4468, 4484, 4541, 4613, 4699, 4709, 4761, 4787, 4823, 4852, 4854, 4902, 5114, 5124, 5143, 5404, 5687, 5887, 6062, 6117, 6391, 6541, 7166, 7416, 7423, 9256, 9637, 9750, 9927, 11122, 12357, 12462, 13036], 'name': 'Dragon Quest IX: Sentinels of the Starry Skies', 'platforms': [{'id': 20, 'abbreviation': 'NDS', 'alternative_name': 'NDS', 'category': 5, 'created_at': 1297941701, 'generation': 7, 'name': 'Nintendo DS', 'platform_logo': 245, 'platform_family': 5, 'slug': 'nds', 'updated_at': 1633117133, 'url': 'https://www.igdb.com/platforms/nds', 'versions': [52, 190, 191, 192], 'checksum': '01ea20e3-3e12-2211-5f66-f4b631cbe59c'}], 'player_perspectives': [1, 2], 'rating': 84.49405253431382, 'rating_count': 34, 'release_dates': [24003, 24004, 24005, 24006], 'screenshots': [27171, 157284, 157285, 157286, 157287, 157288, 157289, 157290, 157291, 157292, 157293, 157294], 'similar_games': [421, 1879, 1942, 3349, 6452, 6990, 7276, 9927, 11292, 14986], 'slug': 'dragon-quest-ix-sentinels-of-the-starry-skies', 'summary': 'In Dragon Quest IX: Sentinels of the Starry Skies, players begin their adventure as a city guardian who is sent to retrieve a sacred trees fruits, which have the power to grant wishes. Players travel the world, conquer fearsome monsters and unravel an epic storyline. During their journey, players will encounter mighty opponents in fast-paced battles, and also interact with a colorful cast of characters.', 'tags': [17, 33, 268435468, 536870990, 536871138, 536871327, 536871433, 536871470, 536871535, 536871705, 536872093, 536872098, 536872120, 536872232, 536872352, 536872371, 536872544, 536872611, 536872622, 536872649, 536872668, 536872983, 536873079, 536873111, 536873154, 536873192, 536873364, 536873384, 536873580, 536874139, 536874398, 536874743, 536874830, 536875184, 536875194, 536875196, 536875197, 536875253, 536875265, 536875271, 536875300, 536875304, 536875309, 536875380, 536875396, 536875453, 536875525, 536875611, 536875621, 536875673, 536875699, 536875735, 536875764, 536875766, 536875814, 536876026, 536876036, 536876055, 536876316, 536876599, 536876799, 536876974, 536877029, 536877303, 536877453, 536878078, 536878328, 536878335, 536880168, 536880549, 536880662, 536880839, 536882034, 536883269, 536883374, 536883948], 'themes': [17, 33], 'total_rating': 85.31845483858548, 'total_rating_count': 43, 'updated_at': 1686299015, 'url': 'https://www.igdb.com/games/dragon-quest-ix-sentinels-of-the-starry-skies', 'websites': [126554, 126555, 126556, 333858], 'checksum': '2b249ea8-f766-ec85-87a7-9fe52aab3748', 'game_localizations': [3379]}, {'id': 1817, 'age_ratings': [5572, 34435, 47230], 'aggregated_rating': 83.0, 'aggregated_rating_count': 4, 'alternative_names': [32789, 58459, 58460, 58461, 58462, 58463, 58464, 58465, 58466, 58467, 58468, 58469, 58470, 58471], 'artworks': [2780, 2781, 2782, 2783, 2784, 2785, 2786], 'category': 8, 'collection': 7988, 'cover': {'id': 89766, 'alpha_channel': False, 'animated': False, 'game': 1817, 'height': 932, 'image_id': 'co1x9i', 'url': '//images.igdb.com/igdb/image/upload/t_thumb/co1x9i.jpg', 'width': 700, 'checksum': 'd527cdbc-a6a3-9cfd-327b-1e1cfe419af6'}, 'created_at': 1352642891, 'external_games': [29013, 139373, 217258, 247196, 513860, 1932804, 2517564], 'first_release_date': 1264636800, 'follows': 8, 'franchises': [3285], 'game_modes': [1], 'genres': [12, 14], 'involved_companies': [20345, 20347, 20348], 'keywords': [72, 78, 147, 151, 226, 236, 311, 415, 472, 521, 558, 623, 960, 1186, 1193, 1208, 1289, 1440, 1699, 1737, 2071, 2111, 2170, 2199, 2242, 2472, 3182, 3486, 3831, 4239, 4249, 4273, 4284, 4285, 4353, 4388, 4468, 4541, 4560, 4613, 4709, 4843, 4852, 4878, 4902, 4984, 5329, 5591, 5599, 5905, 5938, 5963, 6062, 6117, 6325, 6391, 6541, 6620, 6642, 6868, 7112, 7166, 7423, 7529, 7593, 8308, 9246, 9373, 9557, 9637, 9750, 9843, 10587, 11113, 13036], 'name': 'Dragon Quest VI: Realms of Revelation', 'parent_game': 145497, 'platforms': [{'id': 20, 'abbreviation': 'NDS', 'alternative_name': 'NDS', 'category': 5, 'created_at': 1297941701, 'generation': 7, 'name': 'Nintendo DS', 'platform_logo': 245, 'platform_family': 5, 'slug': 'nds', 'updated_at': 1633117133, 'url': 'https://www.igdb.com/platforms/nds', 'versions': [52, 190, 191, 192], 'checksum': '01ea20e3-3e12-2211-5f66-f4b631cbe59c'}, {'id': 34, 'abbreviation': 'Android', 'alternative_name': 'Infocusa3', 'category': 4, 'created_at': 1302566400, 'name': 'Android', 'platform_logo': 376, 'slug': 'android', 'updated_at': 1556150400, 'url': 'https://www.igdb.com/platforms/android', 'versions': [7, 8, 9, 10, 11, 12, 236, 237, 238, 239, 320], 'websites': [7], 'checksum': 'fe27cf28-ec61-df1a-e378-ae233b2eea73'}, {'id': 39, 'abbreviation': 'iOS', 'category': 4, 'created_at': 1317686400, 'name': 'iOS', 'platform_logo': 248, 'slug': 'ios', 'updated_at': 1391644800, 'url': 'https://www.igdb.com/platforms/ios', 'versions': [43], 'checksum': 'fefe4a2b-7c90-0e89-e811-902ea1cf2b58'}], 'player_perspectives': [1, 3], 'rating': 75.65850202401438, 'rating_count': 18, 'release_dates': [24008, 24009, 24010, 24011, 237189, 237190, 237191, 237192, 372440], 'screenshots': [137467, 430315, 430316, 430317, 430318, 430319, 430320, 430321, 430322], 'similar_games': [421, 425, 426, 428, 1026, 1280, 1804, 1942, 6990, 9927], 'slug': 'dragon-quest-vi-realms-of-revelation', 'summary': 'Dragon Quest VI did not receive an enhanced remake on a console until the Nintendo DS. The Dragon Quest VI enhanced remake for the Nintendo DS was announced in late 2007 by Square Enix and was developed by ArtePiazza. A handful of changes were made to the game, some remaining controversial among fans.', 'tags': [17, 22, 268435468, 268435470, 536870984, 536870990, 536871059, 536871063, 536871138, 536871148, 536871223, 536871327, 536871384, 536871433, 536871470, 536871535, 536871872, 536872098, 536872105, 536872120, 536872201, 536872352, 536872611, 536872649, 536872983, 536873023, 536873082, 536873111, 536873154, 536873384, 536874094, 536874398, 536874743, 536875151, 536875161, 536875185, 536875196, 536875197, 536875265, 536875300, 536875380, 536875453, 536875472, 536875525, 536875621, 536875755, 536875764, 536875790, 536875814, 536875896, 536876241, 536876503, 536876511, 536876817, 536876850, 536876875, 536876974, 536877029, 536877237, 536877303, 536877453, 536877532, 536877554, 536877780, 536878024, 536878078, 536878335, 536878441, 536878505, 536879220, 536880158, 536880285, 536880469, 536880549, 536880662, 536880755, 536881499, 536882025, 536883948], 'themes': [17, 22], 'total_rating': 79.32925101200719, 'total_rating_count': 22, 'updated_at': 1686297561, 'url': 'https://www.igdb.com/games/dragon-quest-vi-realms-of-revelation', 'websites': [63273, 63274, 126551, 126552, 126553, 334391], 'checksum': '5cb0e015-68ba-a7f4-ce0e-bbbda56ded47', 'game_localizations': [3377, 22095]}, {'id': 145528, 'age_ratings': [34453, 34454, 75240], 'alternative_names': [58554, 58555, 58556, 58557, 58558, 58559, 58560, 58561, 58562, 58564, 58565, 58566, 58567, 58568, 92291], 'artworks': [73669], 'category': 10, 'collection': 7988, 'cover': {'id': 136512, 'alpha_channel': False, 'animated': False, 'game': 145528, 'height': 1213, 'image_id': 'co2xc0', 'url': '//images.igdb.com/igdb/image/upload/t_thumb/co2xc0.jpg', 'width': 910, 'checksum': 'a89eb927-b73e-7762-3039-04f66c35dc29'}, 'created_at': 1617800412, 'external_games': [2000939, 2595657], 'first_release_date': 1440633600, 'franchises': [3285], 'game_modes': [1], 'genres': [12, 15, 31], 'involved_companies': [123706, 131147, 175891], 'keywords': [1065, 3730, 4074, 17072], 'name': 'Dragon Quest VIII: Journey of the Cursed King', 'parent_game': 1819, 'platforms': [{'id': 37, 'abbreviation': '3DS', 'alternative_name': '3DS', 'category': 5, 'created_at': 1317600000, 'generation': 8, 'name': 'Nintendo 3DS', 'platform_logo': 240, 'platform_family': 5, 'slug': '3ds', 'updated_at': 1473984000, 'url': 'https://www.igdb.com/platforms/3ds', 'versions': [50], 'websites': [9], 'checksum': 'acee0d28-d3b8-b891-fc1c-768782c775a4'}], 'player_perspectives': [2], 'rating': 95.82051083628002, 'rating_count': 7, 'release_dates': [237494, 237495, 249228, 366997], 'screenshots': [430490, 430491], 'similar_games': [25311, 27092, 55199, 81249, 96217, 101608, 103168, 103303, 106987, 113360], 'slug': 'dragon-quest-viii-journey-of-the-cursed-king--1', 'storyline': 'The court jester Dhoulmagus of the kingdom of Trodain stole a powerful magical scepter sealed beneath the royal castle. Using the power of the scepter, Dhoulmagus destroyed the castle, placed a curse upon the kingdom and its people, and turned King Trode into a troll and the princess into a horse. A sole surviving castle guard journeys with the king, the princess, a reformed bandit named Yangus and a few other companions in search of the evil jester and a way to break the curse.', 'summary': 'This is a portable version of the classic RPG, with added content and other 3DS enhancements.', 'tags': [1, 17, 268435468, 268435471, 268435487, 536871977, 536874642, 536874986, 536887984], 'themes': [1, 17], 'total_rating': 95.82051083628002, 'total_rating_count': 7, 'updated_at': 1688024166, 'url': 'https://www.igdb.com/games/dragon-quest-viii-journey-of-the-cursed-king--1', 'videos': [47625, 47626], 'websites': [291502, 453922], 'checksum': 'b49bfdeb-4cdf-9807-6ddc-507a6c548fae', 'language_supports': [493784, 493785, 493786, 493787, 493788], 'game_localizations': [14293, 22598]}, {'id': 1819, 'age_ratings': [34455, 34456, 75241], 'aggregated_rating': 86.58333333333333, 'aggregated_rating_count': 13, 'alternative_names': [32180, 32786, 58534, 58535, 58536, 58537, 58538, 58542, 58543, 86124, 86125, 86126], 'artworks': [2787, 2788, 2789, 2790, 2791, 2792, 2793], 'category': 0, 'collection': 7988, 'cover': {'id': 89783, 'alpha_channel': False, 'animated': False, 'game': 1819, 'height': 1120, 'image_id': 'co1x9z', 'url': '//images.igdb.com/igdb/image/upload/t_thumb/co1x9z.jpg', 'width': 840, 'checksum': '79300cf1-0a3f-76e4-8a91-f0772ab33294'}, 'created_at': 1352642999, 'external_games': [28365, 153752, 217260, 232021, 296543, 1929694, 1933427, 1933554, 1937623], 'first_release_date': 1101513600, 'follows': 33, 'franchises': [3285], 'game_modes': [1], 'genres': [12, 15, 31], 'involved_companies': [45936, 175892], 'keywords': [78, 226, 236, 274, 415, 558, 623, 698, 729, 846, 992, 1186, 1208, 1289, 1313, 1440, 1523, 1737, 1756, 1881, 2071, 2111, 2199, 2242, 2452, 2472, 2668, 3002, 3486, 3831, 4266, 4284, 4287, 4353, 4388, 4392, 4468, 4541, 4545, 4613, 4709, 4787, 4823, 4850, 4852, 4856, 4881, 4902, 4962, 4965, 4984, 4990, 5018, 5105, 5307, 5316, 5329, 5453, 5564, 5661, 5703, 5963, 6048, 6062, 6064, 6117, 6385, 6391, 6461, 6541, 6620, 6642, 6859, 7048, 7080, 7166, 7313, 7315, 7348, 7396, 7416, 7423, 7620, 8149, 8308, 8866, 9182, 9404, 9529, 9637, 9661, 9781, 9843, 10516, 10804, 13109], 'name': 'Dragon Quest VIII: Journey of the Cursed King', 'platforms': [{'id': 8, 'abbreviation': 'PS2', 'alternative_name': 'PS2', 'category': 1, 'created_at': 1297555200, 'generation': 6, 'name': 'PlayStation 2', 'platform_logo': 254, 'platform_family': 1, 'slug': 'ps2', 'updated_at': 1414972800, 'url': 'https://www.igdb.com/platforms/ps2', 'versions': [58, 114], 'checksum': 'be3e025c-d4ed-b795-443c-a8cb55fbfe17'}], 'player_perspectives': [2], 'rating': 87.01044126758103, 'rating_count': 90, 'release_dates': [68155, 68156, 68157, 68158], 'screenshots': [430457, 430458, 430459, 430460, 430461, 430462, 430463, 430464], 'similar_games': [116, 421, 425, 426, 832, 1219, 3349, 6990, 9927, 11292], 'slug': 'dragon-quest-viii-journey-of-the-cursed-king', 'storyline': 'The court jester Dhoulmagus of the kingdom of Trodain stole a powerful magical scepter sealed beneath the royal castle. Using the power of the scepter, Dhoulmagus destroyed the castle, placed a curse upon the kingdom and its people, and turned King Trode into a troll and the princess into a horse. A sole surviving castle guard journeys with the king, the princess, a reformed bandit named Yangus and a few other companions in search of the evil jester and a way to break the curse.', 'summary': 'Dragon Quest VIII: Journey of the Cursed King is the eighth installment in the Dragon Quest series, developed by Level-5 and published by Square Enix for the PlayStation 2 video game console. It was also later released for the Nintendo 3DS in 2015.\n\nIt is a traditional Japanese-style role-playing game with random enemy encounters, simple turn-based combat mechanics, and management of a party consisting of four characters, each belonging to a clearly defined class. Unlike its predecessors in the series and most Japanese RPGs in general, the game features a continuous world with fairly vast landscapes and integrated towns and dungeons, as opposed to world map traveling and locations represented by icons. The game features full camera rotation and optional first-person view.\n\nLike in the previous Dragon Quest games, many objects can be interacted with; for example, barrels can be physically lifted, carried, and broken, to reveal items hidden within.', 'tags': [1, 17, 268435468, 268435471, 268435487, 536870990, 536871138, 536871148, 536871186, 536871327, 536871470, 536871535, 536871610, 536871641, 536871758, 536871904, 536872098, 536872120, 536872201, 536872225, 536872352, 536872435, 536872649, 536872668, 536872793, 536872983, 536873023, 536873111, 536873154, 536873364, 536873384, 536873580, 536873914, 536874398, 536874743, 536875178, 536875196, 536875199, 536875265, 536875300, 536875304, 536875380, 536875453, 536875457, 536875525, 536875621, 536875699, 536875735, 536875762, 536875764, 536875768, 536875793, 536875814, 536875874, 536875877, 536875896, 536875902, 536875930, 536876017, 536876219, 536876228, 536876241, 536876365, 536876476, 536876573, 536876615, 536876875, 536876960, 536876974, 536876976, 536877029, 536877297, 536877303, 536877373, 536877453, 536877532, 536877554, 536877771, 536877960, 536877992, 536878078, 536878225, 536878227, 536878260, 536878308, 536878328, 536878335, 536878532, 536879061, 536879220, 536879778, 536880094, 536880316, 536880441, 536880549, 536880573, 536880693, 536880755, 536881428, 536881716, 536884021], 'themes': [1, 17], 'total_rating': 86.79688730045717, 'total_rating_count': 103, 'updated_at': 1686331681, 'url': 'https://www.igdb.com/games/dragon-quest-viii-journey-of-the-cursed-king', 'videos': [1609], 'websites': [20693, 145096, 145097, 291503, 291504, 342070], 'checksum': '5c9dbc2f-aa80-de24-1477-2211d8f5e1e6', 'expanded_games': [145528], 'ports': [205649], 'game_localizations': [3378, 22096]}, {'id': 145497, 'age_ratings': [75234, 75235, 75236], 'alternative_names': [58472, 58473, 58475, 58476, 58654, 92289, 92290, 115519], 'category': 0, 'collection': 7988, 'cover': {'id': 136422, 'alpha_channel': False, 'animated': False, 'game': 145497, 'height': 1862, 'image_id': 'co2x9i', 'url': '//images.igdb.com/igdb/image/upload/t_thumb/co2x9i.jpg', 'width': 1397, 'checksum': 'e40de722-bf6d-06ba-9b90-ec032d78c0e2'}, 'created_at': 1617723957, 'external_games': [2000909, 2000910], 'first_release_date': 818467200, 'franchises': [3285], 'game_modes': [1], 'genres': [12, 31], 'involved_companies': [177755, 186747], 'keywords': [154, 226, 368, 562, 611, 621, 623, 793, 1065, 1119, 1151, 1381, 1737, 2113, 2347, 3034, 3730, 3792, 4074, 4489, 6541, 7461, 7688, 12517, 15725, 17601, 19837, 23849, 24118, 24875, 25265, 26906, 29745, 33990, 34318, 34609, 34908, 34918], 'name': 'Dragon Quest VI: Maboroshi no Daichi', 'platforms': [{'id': 58, 'abbreviation': 'SFAM', 'alternative_name': 'SFC', 'category': 1, 'created_at': 1351209600, 'generation': 4, 'name': 'Super Famicom', 'platform_logo': 271, 'platform_family': 5, 'slug': 'sfam', 'updated_at': 1399766400, 'url': 'https://www.igdb.com/platforms/sfam', 'versions': [67, 98], 'checksum': '98c18388-67d3-e46a-77bc-49287d3da1e9'}], 'player_perspectives': [1, 3], 'release_dates': [237194], 'screenshots': [430326, 430327, 430329, 820262, 820263, 820264, 820265, 820266, 820267, 820268, 838555, 838556, 873817, 873818, 873819, 873820, 873821, 873822, 873823, 873824], 'similar_games': [10388, 16584, 18182, 22792, 23733, 96217, 105049, 115653, 119277, 205595], 'slug': 'dragon-quest-vi-maboroshi-no-daichi', 'storyline': "Dragon Quest VI opens as the Hero and his party of a mysterious woman and a bulky man approach Murdaw, the demon king's castle. After the woman uses an ocarina to summon a dragon, the party enters the castle and comes face to face with Murdaw. Overpowering the trio, the demon king appears to destroy each member of the party, but suddenly, the Hero wakes up in the mountain town Weaver's Peak. Tania, a young woman from Weaver's Peak, insists that he was having a bad dream and introduces herself as his sister.", 'summary': 'Dragon Quest VI is the sixth installment in the Dragon Quest series. It is the penultimate title for the Nintendo Super Famicom as well as the last game in the Zenithia trilogy, and the first game in the series to be developed by Heartbeat, rather than Chunsoft.\n\nLike every other Dragon Quest game, the setting in Dragon Quest VI is very medieval, complete with castles, knights, and magic. The main world is divided into the Lower World and the Upper World, each with a separate but similar map. To get from one world to the other, the party uses special warps (such as in wells) or by ascending/descending colossal stairs on the world map.', 'tags': [17, 22, 268435468, 268435487, 536871066, 536871138, 536871280, 536871474, 536871523, 536871533, 536871535, 536871705, 536871977, 536872031, 536872063, 536872293, 536872649, 536873025, 536873259, 536873946, 536874642, 536874704, 536874986, 536875401, 536877453, 536878373, 536878600, 536883429, 536886637, 536888513, 536890749, 536894761, 536895030, 536895787, 536896177, 536897818, 536900657, 536904902, 536905230, 536905521, 536905820, 536905830], 'themes': [17, 22], 'updated_at': 1686297561, 'url': 'https://www.igdb.com/games/dragon-quest-vi-maboroshi-no-daichi', 'websites': [176660, 176661, 310107, 453896], 'checksum': '89760f11-dca8-a1fc-4867-53de420c2164', 'remakes': [1817], 'language_supports': [685870], 'game_localizations': [1436]}, {'id': 11667, 'age_ratings': [28108, 28109, 104989, 104990, 104991, 104994], 'aggregated_rating': 84.0, 'aggregated_rating_count': 12, 'alternative_names': [32796, 33519, 56576, 56577, 56578, 56580, 56581, 56582, 56583, 56584, 56585, 86077], 'artworks': [5275], 'category': 0, 'collection': 7988, 'cover': {'id': 89761, 'alpha_channel': False, 'animated': False, 'game': 11667, 'height': 1960, 'image_id': 'co1x9d', 'url': '//images.igdb.com/igdb/image/upload/t_thumb/co1x9d.jpg', 'width': 1470, 'checksum': '1dbb37da-7fa7-0e52-44d7-83ff259aeca6'}, 'created_at': 1439548312, 'external_games': [79568, 100595, 189381, 217266, 217267, 398268, 1592699, 1603132, 1865804, 1928693, 1934148, 1935455, 1935614, 1935966, 1937267, 1962127, 2087256, 2581526, 2584785], 'first_release_date': 1501286400, 'follows': 52, 'franchises': [3285], 'game_engines': [6], 'game_modes': [1], 'genres': [12], 'hypes': 7, 'involved_companies': [167163, 167164, 197513], 'keywords': [521, 2390, 2399], 'name': 'Dragon Quest XI: Echoes of an Elusive Age', 'platforms': [{'id': 6, 'abbreviation': 'PC', 'alternative_name': 'mswin', 'category': 4, 'created_at': 1297555200, 'name': 'PC (Microsoft Windows)', 'platform_logo': 203, 'slug': 'win', 'updated_at': 1470009600, 'url': 'https://www.igdb.com/platforms/win', 'versions': [1, 13, 14, 15, 124], 'websites': [2], 'checksum': '5aae54d0-390e-a4ec-a9ee-4ad4cc346992'}, {'id': 48, 'abbreviation': 'PS4', 'alternative_name': 'PS4', 'category': 1, 'created_at': 1326499200, 'generation': 8, 'name': 'PlayStation 4', 'platform_logo': 231, 'platform_family': 1, 'slug': 'ps4--1', 'summary': 'The PlayStation 4 system opens the door to an incredible journey through immersive new gaming worlds and a deeply connected gaming community. PS4 puts gamers first with an astounding launch line-up and over 180 games in development. Play amazing top-tier blockbusters and innovative indie hits on PS4. Developer inspired, gamer focused.', 'updated_at': 1433116800, 'url': 'https://www.igdb.com/platforms/ps4--1', 'versions': [17, 178, 179], 'websites': [11], 'checksum': '1dfa9b83-5f1d-56ce-01a1-06fcdfbb5bc0'}], 'player_perspectives': [2], 'rating': 85.52222195395609, 'rating_count': 95, 'release_dates': [107487, 150349, 150350, 351668], 'screenshots': [33563, 33564, 33565, 244285, 244286, 244287], 'similar_games': [19164, 25921, 28101, 37382, 49414, 81249, 99118, 103303, 115308, 115653], 'slug': 'dragon-quest-xi-echoes-of-an-elusive-age', 'storyline': 'A young man who lives in the calm village of Ishi. The protagonist, who began a coming-of-age ceremony when he turned 16, learns an astonishing truth. He is the reincarnation of the “hero” that once saved the world, someone who carries the burden of a major mission…\n\nIn order to confirm his fate with his own eyes, the protagonist leaves his hometown and steps forward to the vast world.', 'summary': "Dragon Quest XI continues the gameplay of previous games in the series, in which players explore worlds and fight against various monsters, including the ability to explore high areas. Before entering battle, players can also toggle between the 3D and 2D graphical styles. The game features the series' traditional turn-based battle system.", 'tags': [17, 38, 268435468, 536871433, 536873302, 536873311], 'themes': [17, 38], 'total_rating': 84.76111097697805, 'total_rating_count': 107, 'updated_at': 1688937807, 'url': 'https://www.igdb.com/games/dragon-quest-xi-echoes-of-an-elusive-age', 'videos': [5251, 11344, 13133], 'websites': [20447, 20448, 80236, 86827, 86828, 86829, 214036, 214037, 214038, 214039, 323962], 'checksum': '65f433f5-0597-43da-8ce9-ea8412482f35', 'expanded_games': [110069], 'ports': [115277], 'language_supports': [64438, 64439, 64440, 64441, 64442, 64444, 64446, 64448, 64450, 64451, 64452], 'game_localizations': [4990]}, {'id': 89204, 'age_ratings': [73642], 'alternative_names': [53815, 53816, 53817, 53819, 98980, 107035], 'category': 3, 'collection': 7988, 'cover': {'id': 222990, 'alpha_channel': False, 'animated': False, 'game': 89204, 'height': 800, 'image_id': 'co4s26', 'url': '//images.igdb.com/igdb/image/upload/t_thumb/co4s26.jpg', 'width': 600, 'checksum': 'fe6b0141-07da-47f7-1f8e-868cb6c3fe32'}, 'created_at': 1519489210, 'first_release_date': 756172800, 'follows': 1, 'franchises': [3285], 'game_modes': [1], 'genres': [12, 31], 'involved_companies': [161370, 175745], 'keywords': [1381, 3730, 4074, 7688, 26906, 29745, 33839], 'name': 'Dragon Quest I.II', 'platforms': [{'id': 58, 'abbreviation': 'SFAM', 'alternative_name': 'SFC', 'category': 1, 'created_at': 1351209600, 'generation': 4, 'name': 'Super Famicom', 'platform_logo': 271, 'platform_family': 5, 'slug': 'sfam', 'updated_at': 1399766400, 'url': 'https://www.igdb.com/platforms/sfam', 'versions': [67, 98], 'checksum': '98c18388-67d3-e46a-77bc-49287d3da1e9'}], 'player_perspectives': [3], 'rating': 56.0, 'rating_count': 5, 'release_dates': [332922], 'screenshots': [192455, 192456, 192457], 'similar_games': [22792, 27092, 36198, 55199, 81249, 96217, 103303, 106987, 113360, 115653], 'slug': 'dragon-quest-iii', 'summary': 'Dragon Quest I.II is an enhanced remake of the first two Dragon Quest games.\n\nIt has few modifications to gameplay, but the interface and graphics have been enhanced to be on a par with the 1992 Dragon Quest V, and the games have been rebalanced to make them slightly easier.', 'tags': [17, 268435468, 268435487, 536872293, 536874642, 536874986, 536878600, 536897818, 536900657, 536904751], 'themes': [17], 'total_rating': 56.0, 'total_rating_count': 5, 'updated_at': 1683859917, 'url': 'https://www.igdb.com/games/dragon-quest-iii', 'websites': [165437, 256560], 'checksum': 'bde89a3a-71ac-fec7-b042-3c88c570a0f2', 'ports': [134416], 'language_supports': [640244], 'game_localizations': [2190]}, {'id': 23913, 'age_ratings': [9695, 33636, 75239], 'aggregated_rating': 80.5, 'aggregated_rating_count': 15, 'alternative_names': [51715, 51717, 58445, 58446, 58447, 58448, 58449, 58450, 58451, 58452, 58453], 'artworks': [73670], 'category': 8, 'collection': 7988, 'cover': {'id': 89765, 'alpha_channel': False, 'animated': False, 'game': 23913, 'height': 1550, 'image_id': 'co1x9h', 'url': '//images.igdb.com/igdb/image/upload/t_thumb/co1x9h.jpg', 'width': 1163, 'checksum': '44cfc763-6f4a-73a4-899c-501f8521530c'}, 'created_at': 1473774526, 'external_games': [28306, 50664, 217259, 1875305, 1929872, 1933422, 1933578, 1937989, 2595358], 'first_release_date': 1360195200, 'follows': 5, 'franchises': [3285], 'game_modes': [1], 'genres': [12, 31], 'involved_companies': [40046, 40047, 40048, 40049], 'keywords': [1065, 3730, 17072, 33839], 'name': 'Dragon Quest VII: Fragments of the Forgotten Past', 'parent_game': 1818, 'platforms': [{'id': 37, 'abbreviation': '3DS', 'alternative_name': '3DS', 'category': 5, 'created_at': 1317600000, 'generation': 8, 'name': 'Nintendo 3DS', 'platform_logo': 240, 'platform_family': 5, 'slug': '3ds', 'updated_at': 1473984000, 'url': 'https://www.igdb.com/platforms/3ds', 'versions': [50], 'websites': [9], 'checksum': 'acee0d28-d3b8-b891-fc1c-768782c775a4'}], 'player_perspectives': [3], 'rating': 79.87947874251974, 'rating_count': 10, 'release_dates': [57720, 57723, 366995, 366996], 'screenshots': [31555, 31559, 157343, 157344, 157345, 157346, 157347, 157348, 157349, 157350, 157351], 'similar_games': [27092, 55199, 81249, 96217, 101608, 103168, 103303, 106987, 113360, 115653], 'slug': 'dragon-quest-vii-fragments-of-the-forgotten-past', 'storyline': "Dragon Quest VII tells the story of a young hero, the son of a prominent fisherman in the village of Pilchard Bay on Estard Island, the only landmass in the world, and his friends in a fantastical, medieval-like world. They set out on adventures through the world's past and learn about its history. Upon discovering different lands in the past and solving the troubles, they reappear in the game's present-day map.\n\nThe party begins their adventure when the hero and Kiefer discover a mysterious fragment of a map that the former's father brings home from a fishing trip. Further investigations lead the hero to discover that the world he lives on, which seems to consist of only his small island, used to contain many continents that have somehow been sealed away. By placing other stone fragments found throughout the journey on pedestals in Estard's ruins, the Hero and his friends are sent to different lands in the past which the party eventually realizes. Once they solve the problems in the area's past, the landmasses appear in the present.\n\nAfter the world is restored, Orgodemir, the Demonlord, disguises himself as the Almighty and seals several of the islands away once again; this time Estard is sealed as well. The party sets out to revive the elemental spirits: Wind; Fire; Earth; and Water. Orgodemir is then revealed as the Demonlord to the world whereupon he claims to have done so to trick humanity. Orgodemir then raises the Cathedral of Blight; and with the aid of the Skystone, the party confronts him in a final battle.", 'summary': 'Travel to the past to save the present in this classic Dragon Quest adventure that has been completely remade from the ground up for Nintendo 3DS. The world has been rebuilt, the characters have new 3D models and the story has been completely re-localized. Even customize your party with over 30 classes and rank up in turn-based battles to learn new spells and abilities.', 'tags': [17, 268435468, 268435487, 536871977, 536874642, 536887984, 536904751], 'themes': [17], 'total_rating': 80.18973937125986, 'total_rating_count': 25, 'updated_at': 1686101182, 'url': 'https://www.igdb.com/games/dragon-quest-vii-fragments-of-the-forgotten-past', 'videos': [10102, 10103], 'websites': [9756, 9757, 9758, 104207, 361821], 'checksum': 'a4030930-4587-26c4-ce18-7c2ff8b3b5e1', 'language_supports': [494160, 494161, 494162, 494163, 494164], 'game_localizations': [6126]}, {'id': 144540, 'age_ratings': [75828], 'alternative_names': [58430, 58431, 58432, 58434, 58435, 58436, 92795, 92796, 92837, 92838, 92839, 94246], 'category': 8, 'collection': 7988, 'cover': {'id': 136405, 'alpha_channel': False, 'animated': False, 'game': 144540, 'height': 800, 'image_id': 'co2x91', 'url': '//images.igdb.com/igdb/image/upload/t_thumb/co2x91.jpg', 'width': 600, 'checksum': '7680ccb2-08d4-2911-1adf-28ff5e5e55f6'}, 'created_at': 1615571647, 'external_games': [1999308], 'first_release_date': 1080172800, 'franchises': [3285], 'game_modes': [1], 'genres': [12, 31], 'involved_companies': [177750, 177751, 177752], 'keywords': [1065, 3730, 4074], 'name': 'Dragon Quest V: Tenkuu no Hanayome', 'parent_game': 205595, 'platforms': [{'id': 8, 'abbreviation': 'PS2', 'alternative_name': 'PS2', 'category': 1, 'created_at': 1297555200, 'generation': 6, 'name': 'PlayStation 2', 'platform_logo': 254, 'platform_family': 1, 'slug': 'ps2', 'updated_at': 1414972800, 'url': 'https://www.igdb.com/platforms/ps2', 'versions': [58, 114], 'checksum': 'be3e025c-d4ed-b795-443c-a8cb55fbfe17'}], 'player_perspectives': [3], 'release_dates': [233487], 'screenshots': [430279, 430280, 430281, 430282, 430283, 430284, 430285], 'similar_games': [27092, 55199, 81249, 96217, 101608, 103168, 103303, 106987, 113360, 115653], 'slug': 'dragon-quest-v-tenkuu-no-hanayome--1', 'summary': "A PlayStation 2 remake of Dragon Quest V was released in Japan, and included a preview video of the prototype version of Dragon Quest VII. The remake was developed by ArtePiazza and Matrix Software, the former of which would go on to supervise remakes of nearly each title in the series for the Nintendo DS and 3DS.\n\nIt features 3D graphics that are similar in style to Dragon Quest VII, but it utilizes the extra PlayStation 2 graphical capabilities for more detailed polygonal models and textures and the soundtrack was performed by the NHK Symphony. The remake actually uses an earlier version of the DQVIII engine developed by Level-5, making the only instance of a hardware's remake title launching before the next main entry. In addition to truly bringing the series into the third dimension after the limited scope of the seventh game, the PS2 remake of Dragon Quest V also adjusted the scenario and balance of the game.", 'tags': [17, 268435468, 268435487, 536871977, 536874642, 536874986], 'themes': [17], 'updated_at': 1685970354, 'url': 'https://www.igdb.com/games/dragon-quest-v-tenkuu-no-hanayome--1', 'websites': [292220, 292221], 'checksum': '25a23f1d-d5a5-f81e-1f03-1905a5c70a09', 'game_localizations': [14145]}] def search_game(query): - return search_response+ return search_response
M myprecious/templates/base.htmlmyprecious/templates/base.html

@@ -36,7 +36,7 @@ <nav>

{% block footer %} <span>questions: </span> <a href="/about">what is this?</a> - <a href="https://birabittoh.github.io/" target="_blank">who made this?</a> + <a href="https://birabittoh.is-a.dev/" target="_blank">who made this?</a> {% endblock %} </nav> </main>
M myprecious/templates/index.htmlmyprecious/templates/index.html

@@ -2,4 +2,17 @@ {% extends "base.html" %}

{% block title %}myprecious{% endblock %} {% block content %} <p>A simple game saves archive.</p> + +<table> + {% for game in games %} + <tr onClick="" data-info="{{ game.info }}"> + <td> + <img src="{{ game.cover }}" style="height: 100px;"> + </td> + <td> + <i>{{ game.title }}</i> on <i>{{ game.platform }}</i> + </td> + </tr> + {% endfor %} +</table> {% endblock %}
M myprecious/views.pymyprecious/views.py

@@ -21,6 +21,8 @@ return get_logged_user(user_id)

@app.route('/') def route_index(): + if current_user.is_authenticated: + return render("index.html", games=[]) return render("index.html") @app.route('/login', methods=['GET', 'POST'])
M requirements.txtrequirements.txt

@@ -383,9 +383,6 @@ --hash=sha256:b75ddc264f0ba5615db7ba217daeb99701ad295353c45f9e95963337ceeeffb2

urllib3==2.0.4 ; python_version >= "3.11" and python_version < "4.0" \ --hash=sha256:8d22f86aae8ef5e410d4f539fde9ce6b2113a001bb4d189e0aed70642d602b11 \ --hash=sha256:de7df1803967d2c2a98e4b11bb7d6bd9210474c46e8a0401514e3a42a75ebde4 -waitress==2.1.2 ; python_version >= "3.11" and python_version < "4.0" \ - --hash=sha256:7500c9625927c8ec60f54377d590f67b30c8e70ef4b8894214ac6e4cad233d2a \ - --hash=sha256:780a4082c5fbc0fde6a2fcfe5e26e6efc1e8f425730863c04085769781f51eba werkzeug==2.3.7 ; python_version >= "3.11" and python_version < "4.0" \ --hash=sha256:2b8c0e447b4b9dbcc85dd97b6eeb4dcbaf6c8b6c3be0bd654e25553e0a2157d8 \ --hash=sha256:effc12dba7f3bd72e605ce49807bbe692bd729c3bb122a3b91747a6ae77df528