#!/usr/bin/env python3 # include standard modules import argparse import os import sys import re import json mydir = os.path.dirname(os.path.realpath(__file__)) # Lookup value is value of note for ( string * 1000 ) + value of fret lookuptable = { 57: ["Cr", "x"], 49: ["Cr", "x"], "XX": ["Hh", "x"], 51: ["Ri", "x"], 3048: ["HT", "o"], 3047: ["MT", "o"], 4038: ["Sn", "o"], 3043: ["FT", "o"], 5035: ["Bd", "o"], 44: ["Hf", "x"] } ### DrumBurp notation Wikipedia notation Wikipedia notation ### Cr - Crash Drums Cymbals ### Hh - HiHat |-o-| Strike |-x-| Strike cymbal or hi-hat ### Ri - Ride |-O-| Accent |-X-| Strike loose hi-hat, or hit crash hard ### HT - High Tom |-g-| Ghost note |-o-| Open hi-hat ### MT - Mid Tom |-f-| Flam |-#-| Choke cymbal (grab cymbal with hand after striking it) ### Sn - Snare |-d-| Drag |-s-| Splash cymbal ### FT - Floor Tom |-b-| Soft one-handed roll |-c-| China cymbal ### Bd - Kick |-B-| Accented one-handed roll |-b-| Bell of ride ### Hf - Foot pedal |-@-| Snare rim |-x-| Click hi-hat with foot ### DrumBurp: https://whatang.org/ ### Wikipedia: https://en.wikipedia.org/wiki/Drum_tablature def commandline(): # initiate the parser parser = argparse.ArgumentParser(description="Make ASCII tabs from songsterr tabs.") # option without argument via 'store_true' parser.add_argument("-V", "--version", help="show program version", action="store_true") # option with argument parser.add_argument("--width", "-w", help="set output width in measures") parser.add_argument("--input", "-i", help="set input file") parser.add_argument("--url", "-u", help="set input url") # read arguments from the command line args = parser.parse_args() # handle arguments # check for --version or -V if args.version: print("Version 0.1") # check for --width if args.width: print("set output width to %s" % args.width) if args.url: print("url not handled yet %s" % args.width) if args.input and args.url: print("Give either a url, or an input file, not both.") exit() if not args.input and not args.url: print("Give either a url, or an input file.") exit() return args def get_json(html): result = re.search(r'