axewater / sharewarez

SharewareZ transforms any game folder into a dynamic, searchable and shareable library.
145 stars 1 forks source link

Some platforms cause error when creating new library #110

Closed axewater closed 4 weeks ago

axewater commented 4 weeks ago

http://127.0.0.1:5001/library/add

when adding a new library, we can select a platform using the dropdown list. most of the platforms work, but some of them give the following error:

Adding new library Platform choices: [('OTHER', 'Other'), ('PCWIN', 'PC Windows'), ('PCDOS', 'PC DOS'), ('MAC', 'Mac'), ('NES', 'Nintendo Entertainment System (NES)'), ('SNES', 'Super Nintendo Entertainment System (SNES)'), ('NGC', 'Nintendo GameCube'), ('N64', 'Nintendo 64'), ('GB', 'Nintendo GameBoy'), ('GBA', 'Nintendo GameBoy Advance'), ('NDS', 'Nintendo DS'), ('VB', 'Nintendo Virtual Boy'), ('XBOX', 'Xbox'), ('X360', 'Xbox 360'), ('XONE', 'Xbox One'), ('XSX', 'Xbox Series X'), ('PSX', 'Sony Playstation (PSX)'), ('PS2', 'Sony PS2'), ('PS3', 'Sony PS3'), ('PS4', 'Sony PS4'), ('PS5', 'Sony PS5'), ('SEGA_MD', 'Sega Mega Drive/Genesis (MD)'), ('SEGA_MS', 'Sega Master System (MS)'), ('SEGA_CD', 'Sega CD'), ('LYNX', 'Atari Lynx'), ('SEGA_32X', 'Sega 32X'), ('JAGUAR', 'Atari Jaguar'), ('SEGA_GG', 'Sega Game Gear (GG)'), ('SEGA_SATURN', 'Sega Saturn'), ('ATARI_7800', 'Atari 7800'), ('ATARI_2600', 'Atari 2600'), ('PCE', 'PC Engine'), ('PCFX', 'PC-FX'), ('NGP', 'Neo Geo Pocket'), ('WS', 'WonderSwan'), ('COLECO', 'ColecoVision'), ('VICE_X64SC', 'Commodore 64 (VIC-20)'), ('VICE_X128', 'Commodore 128'), ('VICE_XVIC', 'Commodore VIC-20'), ('VICE_XPLUS4', 'Commodore Plus/4'), ('VICE_XPET', 'Commodore PET')]
Error saving library: (psycopg2.errors.InvalidTextRepresentation) invalid input value for enum libraryplatform: "X360" LINE 1: ...6e7b', '11', '/static/newstyle/default_library.jpg', 'X360') ^

[SQL: INSERT INTO libraries (uuid, name, image_url, platform) VALUES (%(uuid)s, %(name)s, %(image_url)s, %(platform)s)] [parameters: {'uuid': '925d26d7-6a9f-4bf8-8182-994e9a1b6e7b', 'name': '11', 'image_url': '/static/newstyle/default_library.jpg', 'platform': 'X360'}]

this is what is stored in the postgresql database in the platforms table

"id" "name" 1 "Atari Lynx" 2 "Atari 7800" 3 "PlayStation" 4 "Nintendo 64" 5 "Wii" 6 "Wii U" 7 "Super Nintendo Entertainment System" 8 "Super Famicom" 9 "Satellaview" 10 "PC (Microsoft Windows)" 11 "Linux" 12 "Mac" 13 "PlayStation 3" 14 "Xbox 360" 15 "PlayStation 4" 16 "Xbox One" 17 "Nintendo Switch" 18 "PlayStation 5" 19 "Xbox Series X|S" 20 "Android" 21 "iOS" 22 "Google Stadia" 23 "Nintendo Entertainment System" 24 "Game Boy Advance" 25 "Nintendo 3DS" 26 "Family Computer Disk System" 27 "Family Computer" 28 "Arcade" 29 "DOS" 30 "Commodore C64/128/MAX" 31 "Amiga" 32 "Amstrad CPC" 33 "ZX Spectrum" 34 "Atari ST/STE" 35 "Sega Mega Drive/Genesis" 36 "Sega Game Gear" 37 "Sega Master System/Mark III" 38 "Game Boy" 39 "FM Towns" 40 "Sharp X68000" 41 "Sega Saturn" 42 "3DO Interactive Multiplayer" 43 "Sega 32X" 44 "Atari Jaguar" 45 "New Nintendo 3DS" 46 "Legacy Mobile Device" 47 "Amiga CD32" 48 "PlayStation Portable" 49 "Web browser" 50 "PlayStation 2" 51 "Xbox" 52 "Nintendo GameCube" 53 "Windows Phone" 54 "Dreamcast" 55 "PlayStation Vita" 56 "Nintendo DS"

examples of platforms that work: 4 "Nintendo 64" 10 "PC (Microsoft Windows)" 35 "Sega Mega Drive/Genesis"

examples of platforms give an error: 15 "PlayStation 4" 16 "Xbox One"

Bovive commented 4 weeks ago

Have you tried with a new DB? Maybe someone old didn't get updated with a change and is causing a type conflict. I just tried adding PS4 and Xbox One and they both worked.

axewater commented 4 weeks ago

ah that might very well be the issue, and explain why I struggled to solve it

axewater commented 4 weeks ago

you were right