From c466ee8af9b6d2b2e0bd75219d54155cb917beb6 Mon Sep 17 00:00:00 2001 From: Parzival Date: Sat, 28 Sep 2024 23:22:01 +0200 Subject: [PATCH 1/4] (Fix) ftp exit --- common/external_services/ftpx/client.py | 1 + 1 file changed, 1 insertion(+) diff --git a/common/external_services/ftpx/client.py b/common/external_services/ftpx/client.py index 31d5989..c86cf41 100644 --- a/common/external_services/ftpx/client.py +++ b/common/external_services/ftpx/client.py @@ -289,6 +289,7 @@ def input_manager(self, action: str): return self.page_up() elif action.upper() == "D": self.download() + return 0 elif action.upper() == "S": self.search() elif action.upper() == "Q": From 997b5f4df16d561cd0aa761ba59611176a2560f8 Mon Sep 17 00:00:00 2001 From: Parzival Date: Sun, 29 Sep 2024 00:12:43 +0200 Subject: [PATCH 2/4] Add a test for the titles --- tests/games.py | 982 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/video.py | 340 +++++++++++++++++ 2 files changed, 1322 insertions(+) create mode 100644 tests/games.py create mode 100644 tests/video.py diff --git a/tests/games.py b/tests/games.py new file mode 100644 index 0000000..c91e089 --- /dev/null +++ b/tests/games.py @@ -0,0 +1,982 @@ +import os +import random +import re + +game_titles = [ + "The Legend of Zelda: Breath of the Wild", + "Super Mario Odyssey", + "Red Dead Redemption 2", + "The Witcher 3: Wild Hunt", + "Dark Souls III", + "God of War", + "Horizon Zero Dawn", + "Sekiro: Shadows Die Twice", + "Final Fantasy VII Remake", + "Cyberpunk 2077", + "Among Us", + "Minecraft", + "Fortnite", + "Apex Legends", + "Overwatch", + "Call of Duty: Warzone", + "Valorant", + "Genshin Impact", + "Assassin's Creed Valhalla", + "Ghost of Tsushima", + "Death Stranding", + "Monster Hunter: World", + "Resident Evil 2", + "Doom Eternal", + "Stardew Valley", + "Hades", + "Celeste", + "Hollow Knight", + "Ori and the Will of the Wisps", + "Return of the Obra Dinn", + "The Last of Us Part II", + "Control", + "Ghostrunner", + "Disco Elysium", + "Spiritfarer", + "NieR: Automata", + "Cuphead", + "Bioshock Infinite", + "Darkest Dungeon", + "The Outer Worlds", + "Fallout 76", + "Borderlands 3", + "Gears 5", + "Forza Horizon 4", + "Gran Turismo Sport", + "FIFA 21", + "NBA 2K21", + "Madden NFL 21", + "The Sims 4", + "Animal Crossing: New Horizons", + "Splatoon 2", + "Mario Kart 8 Deluxe", + "Street Fighter V", + "Tekken 7", + "Mortal Kombat 11", + "Final Fantasy XIV", + "World of Warcraft", + "Destiny 2", + "Rainbow Six Siege", + "Battlefield V", + "Fall Guys: Ultimate Knockout", + "Ghost Recon Breakpoint", + "The Division 2", + "State of Decay 2", + "Monster Hunter Rise", + "Dying Light", + "Far Cry 5", + "Just Cause 4", + "Watch Dogs: Legion", + "CyberConnect2's FFXV", + "The Evil Within 2", + "Outlast 2", + "Amnesia: Rebirth", + "Dead by Daylight", + "Resident Evil Village", + "Until Dawn", + "The Walking Dead: The Final Season", + "Life is Strange 2", + "Detroit: Become Human", + "Tales from the Borderlands", + "Firewatch", + "Oxenfree", + "The Stanley Parable", + "What Remains of Edith Finch", + "The Witness", + "Journey", + "Gris", + "Subnautica", + "Outer Wilds", + "Slay the Spire", + "Factorio", + "Cities: Skylines", + "Planet Coaster", + "Satisfactory", + "Kerbal Space Program", + "No Man's Sky", + "Starbound", + "Terraria", + "RimWorld", + "Oxygen Not Included", + "Hollow Knight", + "Dead Cells", + "Hades", + "Binding of Isaac: Rebirth", + "Enter the Gungeon", + "Risk of Rain 2", + "Darkwood", + "Soma", + "Layers of Fear", + "Little Nightmares", + "Inside", + "Limbo", + "Fez", + "Celeste", + "Katana ZERO", + "A Short Hike", + "Journey to the Savage Planet", + "Ghost of Tsushima", + "Assassin's Creed Odyssey", + "Resident Evil 3 Remake", + "Shadow of the Tomb Raider", + "Marvel's Spider-Man", + "Spider-Man: Miles Morales", + "Batman: Arkham Knight", + "The Last Guardian", + "Journey", + "The Legend of Zelda: Ocarina of Time", + "Metroid Dread", + "Hollow Knight: Silksong", + "Fire Emblem: Three Houses", + "Persona 5 Royal", + "Final Fantasy XV", + "Dragon Quest XI", + "Xenoblade Chronicles 2", + "Nioh 2", + "Sekiro: Shadows Die Twice", + "Dark Souls II", + "Bloodborne", + "The Surge 2", + "Demon's Souls", + "Control: Ultimate Edition", + "Mass Effect Legendary Edition", + "Bioshock: The Collection", + "Dying Light 2", + "Star Wars Jedi: Fallen Order", + "The Callisto Protocol", + "Elden Ring", + "Returnal", + "Ghostwire: Tokyo", + "Deathloop", + "Kena: Bridge of Spirits", + "Forza Horizon 5", + "Gran Turismo 7", + "Hogwarts Legacy", + "Bayonetta 3", + "Hellblade II: Senua's Saga", + "Fable IV", + "The Elder Scrolls VI", + "Starfield", + "Hollow Knight: Silksong", + "Final Fantasy XVI", + "God of War: Ragnarök", + "Tales of Arise", + "Monster Hunter Stories 2", + "The Legend of Zelda: Skyward Sword HD", + "Metroid Prime 4", + "Splatoon 3", + "Mario + Rabbids Sparks of Hope", + "Mario Strikers: Battle League", + "Xenoblade Chronicles 3", + "Bayonetta Origins: Cereza and the Lost Demon", + "FIFA 22", + "NBA 2K22", + "Madden NFL 22", + "WWE 2K Battlegrounds", + "Need for Speed: Hot Pursuit Remastered", + "Gran Turismo Sport", + "F1 2021", + "Tony Hawk's Pro Skater 1+2", + "Watch Dogs: Legion", + "Cyberpunk 2077", + "Fallout 76", + "The Outer Worlds", + "Doom Eternal", + "Wolfenstein: Youngblood", + "Resident Evil 3", + "Resident Evil 2", + "The Evil Within", + "Dead Space", + "Fear & Hunger", + "Outlast", + "Soma", + "Amnesia: The Dark Descent", + "Layers of Fear", + "Little Nightmares II", + "Ghost of Tsushima: Director's Cut", + "CyberConnect2's Naruto RPG", + "Dragon Ball Z: Kakarot", + "One Piece: Pirate Warriors 4", + "My Hero One's Justice 2", + "Guilty Gear -Strive-", + "Street Fighter VI", + "Tekken 8", + "SoulCalibur VI", + "Mortal Kombat 11", + "Injustice 2", + "BlazBlue: Central Fiction", + "Granblue Fantasy: Versus", + "Melty Blood: Type Lumina", + "Dengeki Bunko: Fighting Climax", + "Naruto Shippuden: Ultimate Ninja Storm 4", + "Persona 4 Arena Ultimax", + "Kingdom Hearts III", + "Final Fantasy VII Remake Intergrade", + "Tales of Berseria", + "Tales of Vesperia: Definitive Edition", + "Fire Emblem: Fates", + "Fire Emblem: Awakening", + "The Legend of Heroes: Trails of Cold Steel IV", + "Xenoblade Chronicles Definitive Edition", + "Nier Replicant ver.1.22474487139...", + "The Legend of Heroes: Trails in the Sky", + "Ys IX: Monstrum Nox", + "Monster Hunter: Rise", + "Persona 5 Strikers", + "Code Vein", + "Dark Souls Remastered", + "Nioh", + "Sekiro: Shadows Die Twice", + "Ghost of Tsushima", + "Bloodborne", + "The Surge", + "Demon's Souls Remake", + "Dragon's Dogma: Dark Arisen", + "Elden Ring", + "Hollow Knight", + "Spiritfarer", + "Celeste", + "Ori and the Blind Forest", + "Unravel", + "Gris", + "Journey", + "Firewatch", + "Oxenfree", + "What Remains of Edith Finch", + "The Stanley Parable", + "Inside", + "Limbo", + "Braid", + "Fez", + "A Short Hike", + "Little Nightmares", + "Darkest Dungeon", + "Slay the Spire", + "Factorio", + "RimWorld", + "Oxygen Not Included", + "Terraria", + "Stardew Valley", + "No Man's Sky", + "Subnautica", + "Kerbal Space Program", + "Cities: Skylines", + "Planet Coaster", + "Satisfactory", + "Hollow Knight: Silksong", + "Cuphead", + "Dead Cells", + "Enter the Gungeon", + "Risk of Rain 2", + "Hades", + "The Binding of Isaac: Rebirth", + "Spelunky 2", + "Moon Hunters", + "Moonlighter", + "Hollow Knight", + "Celeste", + "Little Nightmares II", + "Hellblade: Senua's Sacrifice", + "Ori and the Will of the Wisps", + "Spiritfarer", + "The Last Guardian", + "Ghost of Tsushima", + "Shadow of the Colossus", + "The Legend of Zelda: Wind Waker HD", + "Final Fantasy X/X-2 HD Remaster", + "Chrono Trigger", + "Persona 5", + "The Witcher 3: Wild Hunt", + "Dark Souls III", + "Bloodborne", + "The Elder Scrolls V: Skyrim", + "Mass Effect 2", + "Dragon Age: Inquisition", + "Darkest Dungeon", + "Celeste", + "Hades", + "Undertale", + "Stardew Valley", + "Hollow Knight", + "Journey", + "Firewatch", + "Oxenfree", + "The Stanley Parable", + "What Remains of Edith Finch", + "The Outer Worlds", + "Cyberpunk 2077", + "Doom Eternal", + "Red Dead Redemption 2", + "God of War", + "Final Fantasy VII Remake", + "Assassin's Creed Valhalla", + "Watch Dogs: Legion", + "Spider-Man: Miles Morales", + "Resident Evil Village", + "Deathloop", + "Returnal", + "Ghostwire: Tokyo", + "Kena: Bridge of Spirits", + "Elden Ring", + "Forza Horizon 5", + "Gran Turismo 7", + "Halo Infinite", + "Starfield", + "Fable IV", + "Hogwarts Legacy", + "Metroid Dread", + "Bayonetta 3", + "The Legend of Zelda: Breath of the Wild 2", + "Final Fantasy XVI", + "Dragon Quest XII", + "Monster Hunter Rise", + "Tales of Arise", + "Fire Emblem: Three Houses", + "Persona 6", + "Final Fantasy XIV: Endwalker", + "World of Warcraft: Shadowlands", + "The Elder Scrolls VI", + "Cyberpunk 2078", + "Dying Light 2", + "Outlast 3", + "Dead Space Remake", + "Silent Hill: Ascension", + "Alan Wake 2", + "Resident Evil 4 Remake", + "The Callisto Protocol", + "S.T.A.L.K.E.R. 2", + "System Shock Remake", + "Dead Island 2", + "Hogwarts Legacy", + "Marvel's Wolverine", + "Star Wars: Eclipse", + "Final Fantasy VII Rebirth", + "Ghost of Tsushima: Director's Cut", + "Tales of Luminaria", + "Xenoblade Chronicles 3", + "Monster Hunter Stories 2", + "Gran Turismo 7", + "Forza Horizon 5", + "F1 2021", + "NBA 2K22", + "Madden NFL 22", + "WWE 2K Battlegrounds", + "Need for Speed: Hot Pursuit Remastered", + "Tony Hawk's Pro Skater 1+2", + "Far Cry 6", + "Watch Dogs: Legion", + "Cyberpunk 2077", + "Fallout 76", + "Dying Light", + "Resident Evil 7", + "Outlast", + "Amnesia: The Dark Descent", + "Little Nightmares", + "Layers of Fear", + "The Evil Within", + "Fear & Hunger", + "Ghost of Tsushima", + "The Last of Us Part II", + "Horizon Zero Dawn", + "Sekiro: Shadows Die Twice", + "Bloodborne", + "The Witcher 3: Wild Hunt", + "Final Fantasy XV", + "Nioh 2", + "Dragon Quest XI", + "Persona 5", + "Dark Souls III", + "The Elder Scrolls V: Skyrim", + "Mass Effect Legendary Edition", + "Bioshock: The Collection", + "Persona 4 Golden", + "Final Fantasy X/X-2 HD Remaster", + "Chrono Trigger", + "Tales of Berseria", + "Fire Emblem: Fates", + "Xenoblade Chronicles", + "Nier: Automata", + "Divinity: Original Sin II", + "Hades", + "Stardew Valley", + "Terraria", + "No Man's Sky", + "Factorio", + "Cities: Skylines", + "Planet Coaster", + "RimWorld", + "Oxygen Not Included", + "Satisfactory", + "Kerbal Space Program", + "Ghost of Tsushima", + "Death Stranding", + "Cyberpunk 2077", + "The Outer Worlds", + "Doom Eternal", + "Hollow Knight", + "Celeste", + "Undertale", + "Disco Elysium", + "What Remains of Edith Finch", + "Firewatch", + "Oxenfree", + "Journey", + "A Short Hike", + "Little Nightmares", + "Gris", + "Journey to the Savage Planet", + "Spiritfarer", + "The Last Guardian", + "The Legend of Zelda: Skyward Sword HD", + "The Legend of Zelda: Ocarina of Time", + "Final Fantasy VII Remake", + "God of War: Ragnarök", + "Metroid Dread", + "Bayonetta 3", + "Final Fantasy XVI", + "Hogwarts Legacy", + "Dragon Quest XII", + "Xenoblade Chronicles 3", + "Tales of Arise", + "Monster Hunter Rise", + "Dying Light 2", + "Cyberpunk 2078", + "Outlast 3", + "Alan Wake 2", + "S.T.A.L.K.E.R. 2", + "System Shock Remake", + "Dead Space Remake", + "Silent Hill: Ascension", + "Marvel's Wolverine", + "Star Wars: Eclipse", + "Ghostwire: Tokyo", + "Deathloop", + "Kena: Bridge of Spirits", + "Hollow Knight: Silksong", + "Final Fantasy XIV: Endwalker", + "World of Warcraft: Shadowlands", + "The Elder Scrolls VI", + "Gran Turismo 7", + "Forza Horizon 5", + "F1 2021", + "Tony Hawk's Pro Skater 1+2", + "Need for Speed: Hot Pursuit Remastered", + "NBA 2K22", + "Madden NFL 22", + "WWE 2K Battlegrounds", + "Far Cry 6", + "Watch Dogs: Legion", + "Cyberpunk 2077", + "The Last of Us Part II", + "The Witcher 3: Wild Hunt", + "Final Fantasy XV", + "Nioh 2", + "Dragon Quest XI", + "Persona 5", + "Dark Souls III", + "The Elder Scrolls V: Skyrim", + "Mass Effect Legendary Edition", + "Bioshock: The Collection", + "Persona 4 Golden", + "Final Fantasy X/X-2 HD Remaster", + "Chrono Trigger", + "Tales of Berseria", + "Fire Emblem: Fates", + "Xenoblade Chronicles", + "Nier: Automata", + "Divinity: Original Sin II", + "Hades", + "Stardew Valley", + "Terraria", + "No Man's Sky", + "Factorio", + "Cities: Skylines", + "Planet Coaster", + "RimWorld", + "Oxygen Not Included", + "Satisfactory", + "Kerbal Space Program", +] + +genres = ["Azione", "Avventura", "RPG", "Simulazione", "Sport", "Strategia", "Puzzle"] +developers = ["Developer A", "Developer B", "Developer C", "Developer D", "Developer E"] +publishers = ["Publisher A", "Publisher B", "Publisher C", "Publisher D", "Publisher E"] +modes = ["Singolo giocatore", "Multiplayer", "Co-op"] + +crew_patterns = [ + "VENOM", + "nogrp", + "LiGHTFORCE", + "SUXXORS", + "HR", + "NiiNTENDO", + "GANT", + "BREWS", + "REPACK-Kaos", + "GOG", + "TENOKE", + "rG", + "I Know", + "Razor1911", + "RUNE", + "FitGirl Repack", + "DODI Repack", + "ElAmigos", + "RazorDOX", + "RAZOR", + "SKIDROW", + "DINOByTES", + "TiNYiSO", + "FCKDRM", + "FLT", + "Unleashed", + "PS4", + "PS5", + "I_KnoW", + "CPY", + "RELOADED", + "HATRED", + "GHOST", + "HIVE", + "VACE", + "DARKSIDERS", + "P2P", + "Fallen", + "NIGHTMARE", + "PROPHET", + "C0d3s", + "SQUiRE", + "YASU", + "0xDEADBEEF", + "OUTLAWS", + "MACHINE", + "S0B", + "Psycho", + "GAMERS", + "D3V", + "DREAM", + "NEO", + "TRiViUM", + "XFORCE", + "2h4u", + "COLLATERAL", + "TRC", + "n0m", + "FATE", + "AGGREGATE", + "LIG", + "GAMERZ", + "SPAWN", + "CZW", + "QUACKER", + "Toxic", + "D4", + "RESPECT", + "XTEAM", + "Xtreme", + "X-DiE", + "D3AD", + "SQUAD", + "GAMER", + "D2R", + "EQUINOX", + "TEAM RIPPERS", + "SICK", + "PLATINUM", + "VALHALLA", + "ZTEAM", + "SKYNET", + "JOKER", + "PRODIGY", + "NINJA", + "VOLT", + "AZURE", + "BLAZE", + "KILLER", + "TITAN", + "SCARECROW", + "FIRE", + "DEMON", + "RAPID", + "ALPHA", + "SILVER", + "SANDMAN", + "FANTASY", + "HORIZON", + "INFERNO", + "RAVEN", + "VIGILANTE", + "VORTEX", + "FUSION", + "NEBULA", + "SHADOW", + "WARRIOR", + "SPECTER", + "HUNTER", + "MYSTIC", + "ZODIAC", + "REBEL", + "NOVA", + "BLIZZARD", + "PHOENIX", + "COSMOS", + "DREAMTEAM", + "GRIFFON", + "HAWK", + "THUNDER", + "SILVERHAWK", + "MAGNUM", + "SILENCER", + "STRIKER", + "VELOCITY", + "STORM", + "OUTCAST", + "SPARROW", + "SPIRIT", + "NIGHTFALL", + "DUSK", + "NOVA", + "HEAVEN", + "RAVENCLAW", + "SCARLET", + "JAGUAR", + "VELOCITY", + "POLARIS", + "ECHO", + "GLADIATOR", + "SPECTRUM", + "WIZARD", + "FUSION", + "NEXUS", + "WARRIOR", + "LEGEND", + "DREAMWALKER", + "DRAGON", + "SILVERBLADE", + "DARKFALL", + "WINDWALKER", + "DARKNESS", + "FURY", + "LIGHTNING", + "PANTHER", + "THOR", + "NEMESIS", + "DARKWIND", + "ICE", + "BANDIT", + "TIGER", + "CRIMSON", + "SILVERFOX", + "HORIZON", + "CROSSBONES", + "VAMPIRE", + "VINDICATOR", + "LIGHTBRINGER", + "STORMBRINGER", + "FIREWALKER", + "GHOSTWALKER", + "GLORY", + "FAITH", + "SABER", + "BLITZ", + "PRIME", + "SPECTRUM", + "SHADOWFANG", + "FROST", + "RUNE", + "MOONSHADOW", + "FALCON", + "NIGHTHAWK", + "REAPER", + "SPIDER", + "PHANTOM", + "VALIANT", + "STRIDER", + "KRAKEN", + "RAGE", + "MYST", + "GHOSTFACE", + "CROSSHAIR", + "GLORYHOUND", + "SILVERBIRD", + "DRAGONFLY", + "DUSTWALKER", + "LIONHEART", + "TWILIGHT", + "KINGSFOLK", + "TURBO", + "OVERRIDE", + "REBEL", + "MOONLIGHT", + "PREDATOR", + "FORCE", + "JOKER", + "VENGEANCE", + "BLADE", + "MIRAGE", + "HORIZON", + "MYSTIC", + "RIDER", + "MAVERICK", + "PHOENIX", + "CHAOS", + "SPECTRE", + "WRAITH", + "SHRIEK", + "FIREBIRD", + "MONARCH", + "VALKYRIE", + "BLACKHAWK", + "STEALTH", + "FIRESTORM", + "ICICLE", + "BLADEFURY", + "NIGHTSTALKER", + "DREAD", + "MOONFALL", + "DRACULA", + "FALCON", + "GOLIATH", + "NITRO", + "SCARAB", + "BANSHEE", + "NIGHTRIDER", + "JAGUAR", +] + +platform_patterns = [ + "LIN", + "LINUX", + "N64", + "WII", + "PC", + "PS1", + "PS2", + "PS3", + "XBX", + "X360", + "DOS", + "MAC", + "C64", + "AMIGA", + "NES", + "SNES", + "NDS", + "NGC", + "GBC", + "DC", + "GBA", + "CPC", + "ZX", + "MSX", + "MD", + "32X", + "SAT", + "GB", + "AND", + "GG", + "XBLA", + "3DS", + "PSP", + "IOS", + "WIIU", + "NGAGE", + "TZ", + "PSN", + "VITA", + "VC", + "PS4", + "XBO", + "3DO", + "FDS", + "ARC", + "MSX2", + "MOB", + "WIIW", + "WS", + "SFC", + "A2600", + "A7800", + "AL", + "AJ", + "AS", + "SMS", + "A8", + "A5200", + "INT", + "CV", + "BBC", + "VEC", + "VIC", + "OUYA", + "BB", + "WP", + "II", + "X1", + "SCD", + "NGM", + "NGA", + "WEB", + "SG", + "DM30", + "TG16", + "VB", + "ODY", + "MV", + "PET", + "BA", + "STEAM", + "C16", + "CPLUS", + "P1", + "P10", + "P8", + "GT40", + "FAMICOM", + "ANA", + "NIM", + "EDSAC", + "P7", + "HP2100", + "HP3000", + "SIGMA7", + "CALL", + "P11", + "CDC70", + "PLATO", + "IMLAC", + "MC", + "ONLIVE", + "CD32", + "IIGS", + "ACORN", + "CDI", + "FMTOWNS", + "NGP", + "NGPC", + "X68000", + "NUON", + "WSC", + "SWC", + "PC8801", + "TRS80", + "FCF", + "PCSX", + "TI99", + "NSW", + "NPS", + "AFTV", + "V7000", + "ELECTRON", + "NG64", + "NGCD", + "N3DS", + "VC4000", + "APVS", + "AY8500", + "AY8610", + "PC50X", + "AY8760", + "AY8710", + "AY8603", + "AY8605", + "AY8606", + "AY8607", + "PC98", + "TGCD", + "TRS80C", + "FM7", + "DRAGON", + "PCW", + "EINSTEIN", + "MO5", + "PC6000", + "CDTV", + "DSI", + "ESHOP", + "MR", + "OCULUS", + "STEAMVR", + "DAYDREAM", + "PSVR", + "PKMN", + "XONE", +] + +suffixes = [ + "", + " - Complete Edition", + " - Game of the Year Edition", + " - Deluxe Edition", + " - DLC", + " - Expansion Pack", + " - Definitive Edition", + " - Remastered", + " - Ultimate Edition", + " - Collector's Edition", +] + + +def clean_folder_name(name): + return re.sub(r'[<>:"/\\|?*]', "", name).replace(" ", ".") + + +def format_crew_name(name): + return name.replace(" ", "_") + + +root_folder = os.path.join(os.path.expanduser("~"), "Downloads", "gametest") + +for title in game_titles: + suffix = random.choice(suffixes) + game_title_with_suffix = title + suffix + + crew_name = random.choice(crew_patterns) + platform_name = random.choice(platform_patterns) + + game_info = { + "title": game_title_with_suffix, + "genre": "Action", + "year": "2022", + "developer": "Developer Name", + "publisher": "Publisher Name", + "mode": "Single Player", + "platform": platform_name, + "crew": crew_name, + } + + folder_name = ( + clean_folder_name(game_info["title"]) + + "." + + clean_folder_name(game_info["platform"]) + + "." + + format_crew_name( + game_info["crew"] + ) + ) + folder_path = os.path.join(root_folder, folder_name) + os.makedirs(folder_path, exist_ok=True) + + file_content = ( + f"Titolo: {game_info['title']}\n" + f"Genere: {game_info['genre']}\n" + f"Anno: {game_info['year']}\n" + f"Sviluppatore: {game_info['developer']}\n" + f"Editore: {game_info['publisher']}\n" + f"Modalità: {game_info['mode']}\n" + f"Piattaforma: {game_info['platform']}\n" + f"Crew: {game_info['crew']}\n" + ) + + file_path = os.path.join( + folder_path, f"{clean_folder_name(game_info['title'])}.txt" + ) + with open(file_path, "w") as f: + f.write(file_content) + +print("Finish") diff --git a/tests/video.py b/tests/video.py new file mode 100644 index 0000000..8be2956 --- /dev/null +++ b/tests/video.py @@ -0,0 +1,340 @@ +import os +import random + +crews = [ + "MeM.GP", + "NTb", + "CAKES", + "METCON", + "CtrlHD", + "PLiSSKEN", + "KOGi", + "RARBG", + "TGx", + "EVO", + "QOQ", + "PALEALE", +] +languages = ["ITA", "ENG", "FRE", "SPA", "GER", "POR"] +resolutions = ["720p", "1080p", "2160p", "480p"] +formats = ["WEB-DL", "BluRay", "WEBRip", "HDTV", "DVDRip"] +sources = [ + "DSNP", + "NF", + "AMZN", + "HMAX", + "iTunes", + "HULU", + "DVD", + "P2P", + "RARBG", + "PirateBay", + "1337x", +] + +titles = [ + "The_Great_Escape", + "Breaking_Bad", + "Inception", + "Friends", + "The_Dark_Knight", + "Game_of_Thrones", + "Interstellar", + "The_Lord_of_the_Rings", + "The_Godfather", + "The_Walking_Dead", + "The_Big_Bang_Theory", + "Fight_Club", + "Pulp_Fiction", + "Forrest_Gump", + "The_Matrix", + "The_Shining", + "The_Office", + "Shawshank_Redemption", + "Star_Wars", + "The_Mandalorian", + "Stranger_Things", + "The_Witcher", + "The_Boys", + "Black_Mirror", + "The_Crown", + "Peaky_Blinders", + "Narcos", + "The_Sopranos", + "True_Detective", + "Mindhunter", + "Better_Call_Saul", + "The_Expanse", + "Mad_Men", + "Vikings", + "The_Handmaid's_Tale", + "Chernobyl", + "Fargo", + "Westworld", + "The_Flash", + "Arrow", + "Daredevil", + "Jessica_Jones", + "Luke_Cage", + "Iron_Fist", + "The_Defenders", + "The_Punisher", + "Rick_and_Morty", + "BoJack_Horseman", + "South_Park", + "Family_Guy", + "The_Simpsons", + "Futurama", + "Brooklyn_Nine-Nine", + "How_I_Met_Your_Mother", + "Parks_and_Recreation", + "House_of_Cards", + "Orange_Is_the_New_Black", + "Ozark", + "Lucifer", + "Supernatural", + "Grey's_Anatomy", + "The_Wire", + "Lost", + "Prison_Break", + "Heroes", + "Breaking_Bad_El_Camino", + "Elita", + "Casa_de_Papel", + "Titanic", + "Joker", + "Parasite", + "The_Irishman", + "Ford_v_Ferrari", + "Jojo_Rabbit", + "1917", + "Knives_Out", + "Marriage_Story", + "Once_Upon_a_Time_in_Hollywood", + "Ad_Astra", + "Rocketman", + "Jumanji", + "Toy_Story_4", + "Spider-Man_Far_From_Home", + "Frozen_II", + "The_Lion_King", + "Aladdin", + "Avengers_Endgame", + "Captain_Marvel", + "Shazam", + "Aquaman", + "Wonder_Woman", + "Justice_League", + "The_Batman", + "Suicide_Squad", + "Deadpool", + "Logan", + "X-Men_Dark_Phoenix", + "Fantastic_Beasts", + "Harry_Potter", + "Twilight", + "The_Hunger_Games", + "Divergent", + "Maze_Runner", + "The_Maze_Runner_2", + "Mission_Impossible", + "James_Bond_No_Time_to_Die", + "Skyfall", + "Casino_Royale", + "Spectre", + "Die_Another_Day", + "Fast_and_Furious_9", + "Hobbs_and_Shaw", + "John_Wick", + "The_Bourne_Identity", + "Taken", + "The_Equalizer", + "Mad_Max_Fury_Road", + "The_Road_Warrior", + "Terminator_2", + "Alien", + "Aliens", + "Predator", + "Predator_2", + "The_Mummy", + "Indiana_Jones", + "Jurassic_Park", + "Jurassic_World", + "King_Kong", + "Godzilla", + "Pacific_Rim", + "Transformers", + "The_Dark_Knight_Rises", + "Batman_Begins", + "Spider-Man", + "The_Amazing_Spider-Man", + "The_Incredible_Hulk", + "Thor", + "Iron_Man", + "The_Avengers", + "Guardians_of_the_Galaxy", + "Doctor_Strange", + "Black_Panther", + "Ant-Man", + "Captain_America_Civil_War", + "Captain_America_The_Winter_Soldier", + "Hannibal", + "The_Silence_of_the_Lambs", + "Seven", + "Zodiac", + "Gone_Girl", + "Fight_Club", + "The_Game", + "Memento", + "The_Prestige", + "Dunkirk", + "Tenet", + "The_Imitation_Game", + "The_Theory_of_Everything", + "A_Beautiful_Mind", + "The_Social_Network", + "The_Wolf_of_Wall_Street", + "Catch_Me_If_You_Can", + "The_Terminal", + "Cast_Away", + "Saving_Private_Ryan", + "Apollo_13", + "The_Green_Mile", + "Shawshank_Redemption", + "Million_Dollar_Baby", + "Gran_Torino", + "Unforgiven", + "Django_Unchained", + "Inglourious_Basterds", + "Pulp_Fiction", + "Kill_Bill", + "Reservoir_Dogs", + "The_Hateful_Eight", + "No_Country_for_Old_Men", + "Fargo", + "There_Will_Be_Blood", + "Gangs_of_New_York", + "The_Departed", + "Goodfellas", + "Casino", + "Taxi_Driver", + "Raging_Bull", + "The_Irishman", + "Scarface", + "The_Untouchables", + "Heat", + "The_Town", + "Gone_Baby_Gone", + "Mystic_River", + "The_Departed", + "American_Sniper", + "Gran_Torino", + "Flags_of_Our_Fathers", + "Letters_from_Iwo_Jima", + "Dunkirk", + "Saving_Private_Ryan", + "Black_Hawk_Down", + "The_Hurt_Locker", + "Zero_Dark_Thirty", + "13_Hours", + "Lone_Survivor", + "Act_of_Valor", + "The_Pianist", + "Schindler's_List", + "Life_is_Beautiful", + "The_Boy_in_the_Striped_Pajamas", + "The_Imitation_Game", + "The_Theory_of_Everything", + "The_King's_Speech", + "Darkest_Hour", + "Lincoln", + "The_Post", + "Spotlight", + "Moonlight", + "La_La_Land", + "Whiplash", + "Birdman", + "The_Revenant", + "Gravity", + "Interstellar", + "The_Martian", + "Blade_Runner_2049", + "Arrival", + "Edge_of_Tomorrow", + "Oblivion", + "Elysium", + "District_9", + "Chappie", + "Avatar", + "Aliens", + "Prometheus", + "Alien_Covenant", + "The_Matrix", + "Matrix_Reloaded", + "Matrix_Revolutions", + "Dune", + "Star_Wars_A_New_Hope", + "The_Empire_Strikes_Back", + "Return_of_the_Jedi", + "The_Force_Awakens", + "The_Last_Jedi", + "Rise_of_Skywalker", + "Rogue_One", + "Solo", + "The_Mandalorian", + "The_Book_of_Boba_Fett", + "Obi_Wan_Kenobi", + "Ahsoka", + "Andor", +] + + +def generate_season_episode(): + season = f"S{random.randint(1, 10):02}" # Stagioni da 1 a 10 + episode = f"E{random.randint(1, 24):02}" # Episodi da 1 a 24 + return f"{season}{episode}" + + +def generate_folder_name(title): + crew_sample_size = min( + len(crews), random.randint(1, 3) + ) + selected_crews = random.sample(crews, crew_sample_size) + + language_sample_size = min( + len(languages), random.randint(1, 2) + ) + selected_languages = random.sample(languages, language_sample_size) + + resolution = random.choice(resolutions) + video_format = random.choice(formats) + source = random.choice(sources) + + if "Title_" in title: + season_episode = generate_season_episode() + folder_name = f"{title}.{season_episode}.{'.'.join(selected_languages)}.{resolution}.{source}.{video_format}.{'.'.join(selected_crews)}" + else: + folder_name = f"{title}.{'.'.join(selected_languages)}.{resolution}.{source}.{video_format}.{'.'.join(selected_crews)}" + + return folder_name + + +base_path = os.path.join(os.path.expanduser("~"), "Downloads", "videotest") + + +def create_folders_with_files(titles): + if not os.path.exists(base_path): + os.makedirs(base_path) + + for title in titles: + folder_name = generate_folder_name(title) + folder_path = os.path.join(base_path, folder_name) + + os.makedirs(folder_path, exist_ok=True) + + fake_file_path = os.path.join(folder_path, f"{folder_name}.mkv") + with open(fake_file_path, "w") as fake_file: + fake_file.write("This is a dummy MKV file.") + + +create_folders_with_files(titles) From 612ca286011bb56da9b6597d616e875dd161dbe0 Mon Sep 17 00:00:00 2001 From: Parzival Date: Sun, 29 Sep 2024 00:13:04 +0200 Subject: [PATCH 3/4] Format code --- common/config.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/common/config.py b/common/config.py index cf3d87f..178e90e 100644 --- a/common/config.py +++ b/common/config.py @@ -13,14 +13,17 @@ def create_default_env_file(path): default_content = """ +################################################## CONFIG ################################################### # TRACKER ITT_URL=https://itatorrents.xyz ITT_APIKEY= +# TMDB;IMGBB;FREE_IMAGE TMDB_APIKEY= IMGBB_KEY= FREE_IMAGE_KEY= +# QBITTORRENT CLIENT QBIT_USER= QBIT_PASS= QBIT_URL=http://localhost @@ -48,14 +51,11 @@ def create_default_env_file(path): # Discard videos whose size deviates by more than the specified percentage (size_th) from the video in tracker SIZE_TH=100 -############################################################################################################## - - - - +############################################################################################################## ################ OPTIONAL ############# +######################################### # PW PW_API_KEY= PW_URL=http://localhost:9696/api/v1 From 8eb944f7e27ba4726769fd79bacbbbfd7a011db4 Mon Sep 17 00:00:00 2001 From: Parzival Date: Sun, 29 Sep 2024 00:14:56 +0200 Subject: [PATCH 4/4] Apply crew regex only to the last substring --- unit3dup/contents.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/unit3dup/contents.py b/unit3dup/contents.py index 07e45a2..7604410 100644 --- a/unit3dup/contents.py +++ b/unit3dup/contents.py @@ -15,10 +15,6 @@ from common.mediainfo import MediaFile from common.utility import title -# Get the platform substr -tag_pattern = r"\b(" + "|".join(platform_patterns) + r")\b" - - @dataclass class Contents: """Create a new object with the attributes of Contents""" @@ -186,7 +182,10 @@ def __post_init__(self): self.filename_sanitized = self.filename # Remove each prefix from the string + # """ + Many suffixes are part of the title + for suffix in suffixes: self.filename_sanitized = re.sub( rf"\b{suffix}\b", "", self.filename_sanitized @@ -204,9 +203,9 @@ def __post_init__(self): ).strip() self.filename_sanitized = re.sub(r"\s+", " ", self.filename_sanitized) - # Get the crew name + # Get the crew name only if the substr is at end of the string crew_regex = ( - r"\b(" + "|".join(re.escape(pattern) for pattern in crew_patterns) + r")\b" + r"\b(" + "|".join(re.escape(pattern) for pattern in crew_patterns) + r")\b$" ) self.crew_list = re.findall(crew_regex, self.filename_sanitized, re.IGNORECASE)