From b4e628964e13095e1ce48fd15e98ee9c6cc55c4a Mon Sep 17 00:00:00 2001 From: fanyx Date: Fri, 8 Jul 2022 11:25:57 +0200 Subject: [PATCH] Initial Commit --- .gitignore | 2 + README.md | 1 + build.py | 203 +++++++++++++++++++++++++++++++++++++++++++++ list-of-game.txt | 212 +++++++++++++++++++++++++++++++++++++++++++++++ requirements.txt | 1 + 5 files changed, 419 insertions(+) create mode 100644 .gitignore create mode 120000 README.md create mode 100644 build.py create mode 100644 list-of-game.txt create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1180f85 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.pyc +*.code-snippets \ No newline at end of file diff --git a/README.md b/README.md new file mode 120000 index 0000000..aeae0b7 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +list-of-game.txt \ No newline at end of file diff --git a/build.py b/build.py new file mode 100644 index 0000000..6477d87 --- /dev/null +++ b/build.py @@ -0,0 +1,203 @@ +import yaml +from os.path import dirname + +# BASE = dirname('/home/hendrik/git/list-of-game/src/build.py') +BASE = dirname(__file__) + '/src' +MAX_WIDTH = 64 +MAX_WIDTH_TITLE = 40 +MAX_WIDTH_PLATFORM = 4 +MAX_WIDTH_NAME = 54 +TITLE_PADDING = 7 +DELIMITER = "| :|" + +# split strings longer than length into a list +# strings are split at last index of delim +def split_to_list(str, length, delim=' '): + l = [] + + while len(str) > length: + sep = str.rfind(delim, 0, length) + l.append(str[0:sep]) + str = str[sep+1:] + + l.append(str) + + return l + +# build_header using section title +def build_header(l_title): + header = [] + + len_title = len(l_title[0]) + pad, pad_left = divmod(MAX_WIDTH - (len_title + (TITLE_PADDING * 2)) - 2, 2) + len_border = len_title + ((TITLE_PADDING * 2) - 2) + + # upper part + header.append(' ' * (pad + pad_left + 2) + '_' * len_border + ' ' * (pad + 2)) + header.append('_' * (pad + pad_left) + '//' + ' ' * len_border + '\\\\' + '_' * pad) + # ' ' padded Title + count = 1 + for title in l_title: + c_pad = '_' if count == len(l_title) else ' ' + pad_right = len_title - len(title) + header.append(c_pad * (pad + pad_left) + '|' + ' ' * TITLE_PADDING + title + ' ' * (TITLE_PADDING + pad_right) + '|' + c_pad * pad) + count += 1 + # lower part + header.append(' ' * (pad + pad_left) + '\\\\' + '_' * len_border + '//' + ' ' * pad) + header.append(' ' * MAX_WIDTH) + + return header + +def build_index(yaml, prefix): + l_title = [] + for item in yaml: + l_title += [item['title']] + + l_index = [] + for i, item in enumerate(l_title): + l_index += [' - ' + item.ljust(MAX_WIDTH - 10) + f'[{prefix}{i+1}00] '] + + l_index += [' ' * MAX_WIDTH] + + return l_index + +def build_game(name, platform): + s_platform = platform.ljust(MAX_WIDTH_PLATFORM) + s_name = name.ljust(MAX_WIDTH_NAME) + + return f' {s_platform} | {s_name} ' + +# +# main +# + +def main(): + print('go') + with open(f'{BASE}/todo.yaml', 'r') as file: + todo_yaml = yaml.safe_load(file) + + with open(f'{BASE}/finished.yaml', 'r') as file: + finished_yaml = yaml.safe_load(file) + + # + # Section: TO-DO + # + + todo_result = [] + + todo_result += build_header(['List of Shame']) + + todo_result += build_index(todo_yaml, 'S') + + for section in todo_yaml: + s_title = section['title'] + l_title = [] + + if len(s_title) > MAX_WIDTH_TITLE: + l_title = split_to_list(s_title, MAX_WIDTH_TITLE) + else: + l_title = [s_title] + + # Create section header + todo_result += build_header(l_title) + + # Create table header + todo_result += [' ______ ________________________________________________________', + '|======|========================================================'] + + # Add games one by one + # Prefix : | + for game in section['games']: + s_name = game['name'] + s_platform = game['platform'] + + if len(s_platform) > MAX_WIDTH_PLATFORM: + raise Exception(f"Platform shortcode for {s_name} is longer than 4 characters. Cannot parse...") + + if len(s_name) > MAX_WIDTH_NAME: + l_name = split_to_list(s_name, MAX_WIDTH_NAME) + for i,i_name in enumerate(l_name): + todo_result += ['|' + build_game(i_name, s_platform if i == 0 else '')] + else: + todo_result += ['|' + build_game(s_name, s_platform)] + + # Close table header + todo_result += ['|______|________________________________________________________', + ' ' * MAX_WIDTH] + + # + # Section: Finished + # + + finished_result = [] + + finished_result += build_header(['List of Pride']) + + finished_result += build_index(finished_yaml, 'P') + + for section in finished_yaml: + s_title = section['title'] + l_title = [] + + if len(s_title) > MAX_WIDTH_TITLE: + l_title = split_to_list(s_title, MAX_WIDTH_TITLE) + else: + l_title = [s_title] + + # Create section header + finished_result += build_header(l_title) + + # Create table header + finished_result += ['______ ________________________________________________________ ', + '======|========================================================|'] + + # Add games one by one + # Suffix : | + for game in section['games']: + s_name = game['name'] + s_platform = game['platform'] + + if len(s_platform) > MAX_WIDTH_PLATFORM: + raise Exception(f"Platform shortcode for {s_name} is longer than 4 characters. Cannot parse...") + + if len(s_name) > MAX_WIDTH_NAME: + l_name = split_to_list(s_name, MAX_WIDTH_NAME) + for i,i_name in enumerate(l_name): + finished_result += [build_game(i_name, platform if i == 0 else '') + '|'] + else: + finished_result += [build_game(s_name, s_platform) + '|'] + + # Close table header + finished_result += ['______|________________________________________________________|', + ' ' * MAX_WIDTH] + + # adjust length of both sides + len_difference = len(todo_result) - len(finished_result) + # todo > finished + if len_difference > 0: + finished_result += [' ' * MAX_WIDTH] * len_difference + # todo < finished + elif len_difference < 0: + len_difference *= -1 + todo_result += [' ' * MAX_WIDTH] * len_difference + + if len(todo_result) != len(finished_result): + raise Exception("Results are not of equal size. Something went wrong...") + + result = [] + i = 0 + while len(todo_result) > i: + result += [todo_result[i] + DELIMITER + finished_result[i]] + i += 1 + + with open('list-of-game.txt', 'w') as file: + for i in result: + file.write(f"{i}\n") + + # for i in result: + # print(i) + + return + +if __name__ == "__main__": + main() diff --git a/list-of-game.txt b/list-of-game.txt new file mode 100644 index 0000000..ef5aede --- /dev/null +++ b/list-of-game.txt @@ -0,0 +1,212 @@ + _________________________ | :| _________________________ +__________________// \\_________________| :|__________________// \\_________________ +__________________| List of Shame |_________________| :|__________________| List of Pride |_________________ + \\_________________________// | :| \\_________________________// + | :| + - Currently Playing [S100] | :| - Early Days [P100] + - Upcoming [S200] | :| - First PC [P200] + - Soon(TM) 2022 [S300] | :| - The Multiplayer Phase [P300] + - Unknown Future [S400] | :| - 2020 [P400] + - Haunts my Dreams [S500] | :| - 2021 [P500] + - Not Yet Owned (Wishlist) [S600] | :| - 2022 [P600] + | :| + _____________________________ | :| ______________________ +________________// \\_______________| :|___________________// \\___________________ +________________| Currently Playing |_______________| :|___________________| Early Days |___________________ + \\_____________________________// | :| \\______________________// + | :| + ______ ________________________________________________________| :|______ ________________________________________________________ +|======|========================================================| :|======|========================================================| +| PC | Outer Wilds | :| GBC | Pokemon Silver | +| PC | Inscryption | :| GBC | Jungle Book: Mowgli's Adventure | +| PC | Neon White | :| GBA | Pokemon Sapphire | +| GBA | Pokemon Unbound | :| GBC | Pokemon Trading Card Game | +|______|________________________________________________________| :| GBC | Pokemon Crystal | + | :| PC | Colin McRae Rally 2.0 | + ____________________ | :| PC | Anno 1602 | +____________________// \\____________________| :| GBA | Pokemon Emerald | +____________________| Upcoming |____________________| :| PC | Need for Speed: Underground | + \\____________________// | :| PC | Need for Speed: Underground 2 | + | :| PC | Robin Hood: Legend of Sherwood | + ______ ________________________________________________________| :| PC | Driver | +|======|========================================================| :| PSP | Metal Gear Solid: Peacewalker | +| PC | Gnosia | :| PSX | Metal Gear Solid | +| PC | Final Fantasy VII | :| PC | F1 '02 | +| PS4 | Kingdom Hearts 3 | :| GBA | Kim Possible: Revenge of the Monkey Fist | +| PS4 | Gravity Rush | :| PS2 | Dragon Quest VIII | +| PC | Half-Life 2 | :| NDS | Final Fantasy III | +|______|________________________________________________________| :| GBA | Final Fantasy I & II: Dawn of Souls | + | :| NDS | Final Fantasy IV | + _________________________ | :| GBA | Final Fantasy V Advance | +__________________// \\_________________| :| GBA | Final Fantasy VI Advance | +__________________| Soon(TM) 2022 |_________________| :| PSP | Lego Star Wars | + \\_________________________// | :| PSP | Lego Star Wars II | + | :| PSP | Monster Hunter Freedom Unite | + ______ ________________________________________________________| :| PSP | Dissidia: Final Fantasy | +|======|========================================================| :| PSP | duodecim Dissidia: Final Fantasy | +| PS4 | Kingdom Hearts: Dream Drops Distance HD | :| PS2 | Kingdom Hearts 2 | +| PS4 | Persona 5 Royal | :| GBA | Kingdom Hearts: Chain of Memories | +| PC | Bayonetta | :| PS2 | Kingdom Hearts | +| DS | The World Ends With You | :| PSP | Ratchet and Clank: Size Matters | +| PC | Bravery Network Online | :| PSP | Exit | +| PC | Starfetchers - Episode 1 | :| PC | Need for Speed: Most Wanted (2005) | +| PC | CrossCode | :| GBA | The Legend of Zelda: Minish Cap | +| GBA | Fire Emblem | :| PC | Moorhuhn 3: ...Es Gibt Huhn! | +| GBA | Castlevania - Aria Of Sorrow | :| GBA | Pokemon Pinball: Ruby & Sapphire | +| PC | Wandersong | :| NDS | Mario Kart DS | +| PC | Loop Hero | :| GBA | Pokemon Leaf Green | +| PC | Blasphemous | :| GBA | Pokemon Mystery Dungeon: Red Rescue Team | +|______|________________________________________________________| :| PC | Shrek 2 | + | :| NDS | SimCity Builder | + __________________________ | :| NDS | Nintendogs: Labrador and Friends | +_________________// \\_________________| :| PC | Yeti Sports | +_________________| Unknown Future |_________________| :| PC | Asterix & Obelix XXL | + \\__________________________// | :| GBA | Mario & Luigi: Superstar Saga | + | :| NDS | Mario & Luigi: Bowser's Story | + ______ ________________________________________________________| :| NDS | Bomberman Story DS | +|======|========================================================| :| NDS | Pokemon Mystery Dungeon: Explorers of Sky | +| PS4 | Bloodborne (again) | :| NDS | Pokemon Pearl | +| PC | Spiritfarer: Farewell Edition | :| PSP | Crisis Core: Final Fantasy VII | +| PC | Hades | :| PSP | Cars | +| PC | Final Fantasy VIII | :| NDS | Pokemon Platinum | +| PC | Dungeon Munchies | :| GBA | Sonic Battle | +| PC | A Hat in Time | :| NDS | Hotel Dusk: Room 215 | +| PC | Portal 2 | :| PC | Curse of Monkey Island | +| 3DS | Dragon Quest VIII | :| PC | Edna & Harvey: The Breakout | +| PC | The Sexy Brutale | :| PC | Spy Fox in: Dry Cereal | +| PC | Ori and the Will of the Wisps | :| PC | Spy Fox in: Some Assembly Required | +| PC | Dark Souls: Remastered | :| PC | Spy Fox in: Operation Ozone | +| PC | Wizard of Legend | :| NDS | Kingdom Hearts 358/2 Days | +| PC | Disco Elysium (Director's Cut) | :| NDS | Mario Hoops 3-on-3 | +| PC | Cuphead | :| PC | N++ | +| PC | Stanley Parable: Ultra Deluxe | :| NDS | Naruto: Ninja Council 3 | +| PC | Danganronpa: Trigger Happy Havoc | :| PSP | Sid Meier's Pirates | +| PC | Yuppie Psycho | :| NDS | Pokemon Soul Silver | +| PC | Children of Morta | :| NDS | Pokemon Ranger | +|______|________________________________________________________| :| NDS | Professor Layton and the Curious Village | + | :| NDS | Professor Layton and the Diabolical Box | + ____________________________ | :| PC | Tachyon: The Fringe | +________________// \\________________| :| NDS | The Simpsons | +________________| Haunts my Dreams |________________| :| NDS | Spectrobes | + \\____________________________// | :| PC | Trackmania Original | + | :| GBA | Wario Ware | + ______ ________________________________________________________| :| NDS | Yu-Gi-Oh!: World Championship 2008 | +|======|========================================================| :| PC | Rollercoaster Tycoon 2 | +| PC | Return of the Obra Dinn | :| PC | Crashday | +| PC | Voice of Cards: The Forsaken Maiden | :|______|________________________________________________________| +| PC | Distance | :| +| PC | Forager | :| ____________________ +| PC | The Secret of Monkey Island | :|____________________// \\____________________ +| PC | Monkey Island 2 | :|____________________| First PC |____________________ +| PS3 | Drakengard 3 | :| \\____________________// +| PC | Deus Ex: Game of the Year | :| +| PS2 | Metal Gear Solid 2: Sons of Liberty | :|______ ________________________________________________________ +| SNES | Super Metroid | :|======|========================================================| +| NES | Ninja Gaiden | :| PC | Terraria | +| PS3 | Metal Gear Solid 3: Snake Eater | :| PC | Minecraft | +| PS2 | Devil May Cry 3 | :| PS3 | Little Big Planet | +| PC | It Takes Two | :| PS3 | F1 2015 | +| PC | Potion Craft | :| PC | Portal | +| PC | Grim Fandango Remastered | :| PC | Far Cry 3 | +| PC | Hypnospace Outlaw | :| PC | Call of Duty: Modern Warfare 2 | +| PC | LISA | :| PSP | Kingdom Hearts: Birth by Sleep | +| PC | FEZ | :| PSP | Wipeout Pulse | +| PC | Tales of Arise | :| PC | Worms 3D | +| PC | One Step from Eden | :| PC | League of Legends | +| PC | Death and Taxes | :| PC | Airmech | +| PC | Quantum Protocol | :| PC | Trackmania United Forever | +| PC | Metal Gear Solid V: The Phantom Pain | :| PC | Party Hard | +| PC | Metal Gear Solid IV: Guns of the Patriots | :| PC | Hotline Miami | +| PC | Lovely Planet | :| PC | Papers, Please | +| PC | Darkest Dungeon | :|______|________________________________________________________| +| PC | Kindred Spirits on the Roof | :| +| PC | Owlboy | :| _________________________________ +| PC | Ys IX | :|______________// \\_____________ +| PC | Faster Than Light | :|______________| The Multiplayer Phase |_____________ +| PC | Final Fantasy Type-0 | :| \\_________________________________// +| PC | Final Fantasy IX | :| +| PC | Final Fantasy X | :|______ ________________________________________________________ +| PC | Final Fantasy XII | :|======|========================================================| +| PS3 | Final Fantasy XIII | :| PC | Rocket League | +| PC | Lightning Returns: Final Fantasy XIII | :| PC | Castle Crashers | +| PC | Bastion | :| PC | FEAR 3 | +| PC | Crashlands | :| PC | McPixel | +| NX | Xenoblade Chronicles | :| PC | 12 Is Better Than 6 | +| PC | Octopath Traveler | :| PC | Stardew Valley | +| 3DS | Bravely Default | :| PC | Worms Ultimate Mayhem | +| PC | Pyre | :| PC | Counter-Strike: Global Offensive | +| PC | The Pedestrian | :| PC | The Beginner's Guide | +|______|________________________________________________________| :| PC | Stanley's Parable | + | :| PC | What Remains of Edith Finch | + ____________________________________ | :| PC | Ori and the Blind Forest | +____________// \\____________| :| PC | Realm of the Mad God | +____________| Not Yet Owned (Wishlist) |____________| :| PC | Raft | + \\____________________________________// | :| NX | The Legend of Zelda: Breath of the Wild | + | :| NX | Mario Odyssey | + ______ ________________________________________________________| :| NX | Mario Kart 8: Deluxe | +|======|========================================================| :|______|________________________________________________________| +| PC | Slay the Spire | :| +| PC | Switchcars | :| ________________ +| PC | Into the Breach | :|______________________// \\______________________ +| PC | Death's Door | :|______________________| 2020 |______________________ +| PS1 | Parasite Eve | :| \\________________// +| PC | Sifu | :| +| PC | Hyper Light Drifter | :|______ ________________________________________________________ +| PS4 | Dark Souls 2 | :|======|========================================================| +| PS4 | Dark Souls 3 | :| PC | NieR: Automata | +| PC | Griftlands | :| PC | Celeste | +| PC | Tunic | :| PC | Monster Hunter: World | +| PC | Nine Sols | :| PC | A Short Hike | +| PC | Psychonauts | :| PC | Risk of Rain 2 | +| PC | Psychonauts 2 | :| PC | Subnautica | +| PC | Cave Story+ | :| PC | Among Us | +| PS2 | God Hand | :| PC | Phasmophobia | +| PC | Shovel Knight | :| PC | Helltaker | +| PS3 | Assassin's Creed | :| PC | For The King | +| PC | Astalon: Tears of the Earth | :|______|________________________________________________________| +| PC | Death Trash | :| +| PC | Trails Rising | :| ________________ +| PC | Hellblade: Senua's Sacrifice | :|______________________// \\______________________ +| PC | Factorio | :|______________________| 2021 |______________________ +| PC | VA-11 Hall-A: Cyberpunk Bartender Action | :| \\________________// +| PC | Katana Zero | :| +| PC | Manifold Garden | :|______ ________________________________________________________ +| PC | art of rally | :|======|========================================================| +| PC | Ooblets | :| PS4 | Kingdom Hearts 0.2 Birth by Sleep | +| PC | Don't Escape: 4 Days to Survive | :| PC | NieR: Replicant ver.1.22474487139... | +| PC | Journey | :| PC | Portal Reloaded | +| PC | Baba Is You | :| GBA | Pokemon Gaia v3.2 | +| PC | Ni no Kuni: Wrath of the White Witch | :| PC | Titan Souls | +| PC | Ikenfell | :| PC | Midnight Castle Succubus | +| PC | Control: Ultimate Edition | :| PC | Valheim | +| PC | Carrion | :| PC | Bad North | +| PC | Haven | :| PC | Star Fetchers Prologue | +| PC | Unliving | :| PC | Glyph | +| PC | Persona 4 Golden | :| PC | The Hex | +| PC | Signs of the Sojourner | :| PC | Deepest Sword | +| PC | A Space for the Unbound | :| PC | Prologue For A Vacant Kingdom | +| PC | There is no Game: Wrong Dimension | :| PC | Unsighted | +| PC | Card Shark | :| PC | Voice of Cards: The Isle Dragon Roars | +| PC | Neodash | :| PC | To The Moon | +| PC | Strange Horticulture | :|______|________________________________________________________| +| PC | Crowsworn | :| +|______|________________________________________________________| :| ________________ + | :|______________________// \\______________________ + | :|______________________| 2022 |______________________ + | :| \\________________// + | :| + | :|______ ________________________________________________________ + | :|======|========================================================| + | :| PC | Hollow Knight | + | :| PC | Black Mesa | + | :| PC | Warhammer: Vermintide 2 | + | :| PS4 | 13 Sentinels: Aegis Rim | + | :| PS4 | Bloodborne | + | :| PC | Vampire Survivors | + | :| PC | Elden Ring | + | :| PC | OPUS: Echo of Starsong | + | :| PC | Stacklands | + | :| PC | Paradise Killer | + | :| PC | Webbed | + | :|______|________________________________________________________| + | :| diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..4818cc5 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +pyyaml \ No newline at end of file