3DSFlow/Banners/create.py

From ihaveahax's Site
< 3DSFlow‎ | Banners
Revision as of 00:34, 21 January 2021 by Ihaveahax (talk | contribs) (Created page with "The table of banners was created with this script, then the outliers were fixed by hand. <syntaxhighlight lang="python"> import glob from os.path import basename def url(f):...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

The table of banners was created with this script, then the outliers were fixed by hand.

import glob
from os.path import basename

def url(f):
    return f'[https://ianburgwin.net/3dsflow/{f.replace(" ", "%20")} {basename(f)}]'

def get(reg):
    print(f'== {reg} ==')
    for btype, headertext in zip(('eshop', 'vc', 'retail'), ('eShop', 'Virtual Console', 'Retail')):
        stuff = sorted(glob.iglob(f'banners/{reg}/{btype}/*.png'))
        if stuff:
            print(f'=== {headertext} ===')
            print('{| class="wikitable"')
            print('!Title ID!!URL!!Notes')
            for f in stuff:
                filename = basename(f)
                try:
                    tid = format(int(filename[:16]), '016X')
                except ValueError:
                    tid = 'unknown'
                print('|-')
                print(f'|{tid}||{url(f)}||')
            print('|}')

print('== Homebrew ==')
print('=== General ===')
for f in sorted(glob.iglob('banners/Homebrew/general/*.png')):
    print(f'*{url(f)}')
print('=== Emulators ===')
for f in sorted(glob.iglob('banners/Homebrew/emulators/*.png')):
    print(f'*{url(f)}')

print('== Custom ==')
for f in sorted(glob.iglob('banners/Custom/*.png')):
    print(f'*{url(f)}')

print('== Templates ==')
for f in sorted(glob.iglob('banners/Templates/*.png')):
    print(f'*{url(f)}')

get('USA')
get('EUR')
get('GER')
get('AUS')
get('JPN')