Skip to content

Instantly share code, notes, and snippets.

@zhiyb
Last active October 11, 2020 22:16
Show Gist options
  • Select an option

  • Save zhiyb/737ffbc2d1b56fac9a4c057a4de69789 to your computer and use it in GitHub Desktop.

Select an option

Save zhiyb/737ffbc2d1b56fac9a4c057a4de69789 to your computer and use it in GitHub Desktop.
Nintendo Switch screenshot management shell(python) script
#!/bin/bash -e
dir="$@"
[ -z "$dir" ] && dir=Album
[ -e "$dir" ]
eval "$(python - <<PYTHON
# -*- coding: UTF-8 -*-
from __future__ import print_function
import sys
dict = {
"52175DF068B9DD74E0A97B629F91F197": "Kirby",
"16851BE00BC6068871FE49D98876D6C5": "Mario Kart",
"11B64E28AD7A49CA9EC8AC007BE858C6": "Minecraft",
"E4B364C957D95017CA1171810D655865": "Pokémon Quest",
"502448D1CC582509ABCA0ECB86D27FCC": "Puyo Puyo Tetris",
"27B43DBE1CF53CADD3897FC3CD79185F": "Puyo Puyo Tetris",
"1628E0CE3F839127054B0EE36E28E52A": "Sonic Mania",
"6E956B433005F0B8F614D3843FC0C0A8": "South Park TFBH",
"8AEDFF741E2D23FBED39474178692DAF": "Super Mario Odyssey",
"099ECEEF904DB62AEE3A76A3137C241B": "Super Mario Party",
"57B4628D2267231D57E0FC1078C0596D": "System",
"1E95E5926F1CB99A87326D927F27B47E": "Controllers",
"CCFA659F4857F96DDA29AFEDB2E166E6": "Account",
"313AE47A1CE9EBA41C65D6BD9020EE35": "Taiko no Tatsujin",
"D27D9A7941148AAB41D9F68B6E983975": "Toad",
"F1C11A22FAEE3B82F21B330E1B786A39": "The Legend of Zelda - Breath of the Wild",
"73CB87545D9CAEADC77830DEB04D098B": "君の瞳にヒットミー",
"74E0781171FE5A9B5EA8880C36FD0881": "ひぐらしのなく頃に奉",
"D4D63B5B034258311F243102C3D327AD": "大図書館の羊飼い -Library Party-",
"C9E8F6F203497AE5A4AB146402A5EBF6": "リプキス",
"03BACCBD7D3824B455214AD128488FD6": "LIMBO",
"D298593377BB998EBC5558B0CBC6DBA4": "The Gardens Between",
"94CAAF6C83EE682D358EB6183EEF7D28": "Pokemon Let's Go",
"659B13F48903294AE2B3FA4F12DA9898": "Xenoblade Chronicles 2",
"8625352D7931559E8BE3042D46DE9738": "Xenoblade Chronicles Definitive Edition",
"33B8CC310F76D76B17C6DB0011A75C8A": "New Super Mario Bros. U Deluxe",
"4EBD015519178CCE78B40BB34B4A97AB": "Yoku's Island Express",
"0E7DF678130F4F0FA2C88AE72B47AFDF": "Super Smash Bros. Ultimate",
"C689313FCA0428D0A02B7CE197724761": "Nintendo Labo Toy-Con 01 - Variety Kit",
"7AEA3B76283DF2B97E581259A12F733D": "Yoshi's Crafted World",
"93C1C73A3BAF9123A15B9B24886B634B": "Octopath Traveler",
"ECBB134D8D7B15BC381E3534E8F1B659": "Little Friends - Dogs & Cats",
"9129043EF2AAD7F1157CF852BACB8F7D": "The Legend of Zelda - Link's Awakening",
"59C556CE9B1E7DB05276CB1071D9E210": "ドラえもんのび太の牧場物語体験版",
"D30E1C2C7666B65122781E72D3DC0467": "Cuphead",
"0C015090E6C5E3F06D97FEDE95458758": "Luigi's Mansion 3",
"2A2B87EF65984805F4D71920ECF2C80E": "Pokémon Mystery Dungeon - Rescue Team DX",
"B13388A53B6AA06369D7CAD7D2795F08": "Project DIVA MEGA39's",
"3A8180A07C6FFAA3408FF8DDE3E2BC4A": "Project DIVA MEGA39's",
"DB1426D1DFD034027CECDE9C2DD914B8": "Homebrew",
"682454342666426A7BBD8B11E5A4DE08": "Little Nightmares",
"02CB906EA538A35643C1E1484C4B947D": "Animal Crossing - New Horizons",
"638E7E1EEC4CD8A239243633C0345A07": "Ring Fit Adventure",
"45998392CB216ABF034EB6F98E399A06": "Super Mario 3D All-Stars",
"F84084125D49DCB722D20211987E0D83": "Pikmin 3 Deluxe",
}
files = [$(find "$dir" -type f | awk '{print "\""$0"\","}')]
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
skipped = False
for f in files:
try:
file = f.split("/")[-1]
id = file.split("-")[1].split(".")[0]
dir = dict[id]
except:
skipped = True
eprint("\033[97m%s\033[31m skipped\033[0m"%(file))
continue
print('mkdir -p "%s"'%(dir))
print('mv "%s" "%s/%s"'%(f, dir, file))
eprint("\033[97m%s\033[32m moved to \033[34m%s\033[0m"%(file, dir))
if not skipped:
print('find "$dir" -empty -delete')
PYTHON
)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment