def gopt(args,d:bool=False) : re = getopt(args, 'h?i:d:p:m:r:ynFv:a:o:scb:', ['help', 'ac=', 'dm=', 'ad=', 'yf', 'nf', 'mc=', 'ar', 'nar', 'ax=', 'as=', 'ak=', 'ab', 'nab', 'fa=', 'sv=', 'ma=', 'ms=', 'da=', 'httpproxy=', 'httpsproxy=', 'jt=', 'jts=', 'af', 'naf', 'afp=', 'slt', 'nslt', 'te', 'nte', 'bd', 'nbd', 'cad', 'ncad', 'lrh', 'nlrh', 'ym', 'nm', 'yac', 'nac', 'ydm', 'ndm', 'yad', 'nad', 'yr', 'nr', 'ysv', 'nsv', 'yma', 'nma', 'yda', 'nda', 'ahttpproxy=', 'ahttpsproxy=', 'lan=', 'bp', 'nbp', 'in', 'nin', 'mt', 'nmt', 'vi=', 'uc', 'nuc', 'ass', 'nass', 'dmp', 'ndmp', 'vf=', 'lmd=', 'ynal', 'nnal', 'log', 'nlog', 'yauf', 'nauf', 'ydwa', 'ndwa', 'yol', 'nol', 'ltid']) if d: print(re) rr=re[0] r={} h=False for i in rr: if i[0]=='-h' or i[0]=='-?' or i[0]=='--help': h=True if i[0]=='-i' and not 'i' in r: r['i']=i[1] if i[0]=='-d' and not 'd' in r and i[1].isnumeric() and int(i[1])>0 and int(i[1])<9 : r['d']=int(i[1]) if i[0]=='-p' and not 'p' in r : r['p']=i[1] if i[0]=='-m' and not 'm' in r : if i[1].lower()=='true' : r['m']=True elif i[1].lower()=='false' : r['m']=False if i[0]=='--ym' and not 'm' in r: r['m']=True if i[0]=='--nm' and not 'm' in r: r['m']=False if i[0]=='--ac' and not 'ac' in r: if i[1].lower()=='true' : r['ac']=True elif i[1].lower()=='false' : r['ac']=False if i[0]=='--yac' and not 'ac' in r: r['ac']=True if i[0]=='--nac' and not 'ac' in r: r['ac']=False if i[0]=='--dm' and not 'dm' in r: if i[1].lower()=='true' : r['dm']=True elif i[1].lower()=='false' : r['dm']=False if i[0]=='--ydm' and not 'dm' in r: r['dm']=True if i[0]=='--ndm' and not 'dm' in r: r['dm']=False if i[0]=='--ad' and not 'ad' in r: if i[1].lower()=='true' : r['ad']=True elif i[1].lower()=='false' : r['ad']=False if i[0]=='--yad' and not 'ad' in r: r['ad']=True if i[0]=='--nad' and not 'ad' in r: r['ad']=False if i[0]=='-r' and not 'r' in r: if i[1].lower()=='true' : r['r']=True elif i[1].lower()=='false' : r['r']=False if i[0]=='--yr' and not 'r' in r: r['r']=True if i[0]=='--nr' and not 'r' in r: r['r']=False if i[0]=='-y' and not 'y' in r: r['y']=True if i[0]=='-n' and not 'y' in r: r['y']=False if i[0]=='--yf' and not 'yf' in r: r['yf']=True if i[0]=='--nf' and not 'yf' in r: r['yf']=False if i[0]=='--mc' and not 'mc' in r: if i[1].lower()=='avc' : r['mc']=True elif i[1].lower()=='hev' : r['mc']=False if i[0]=='--ar' and not 'ar' in r: r['ar']=True if i[0]=='--nar' and not 'ar' in r: r['ar']=False if i[0]=='--ax' and not 'ax' in r: if i[1].isnumeric() : i2=int(i[1]) if i2<17 and i2>0 : r['ax']=i2 if i[0]=='--as' and not 'as' in r: if i[1].isnumeric() : i2=int(i[1]) if i2>0 : r['as']=i2 if i[0]=='--ak' and not 'ak' in r: if i[1].isnumeric() : i2=int(i[1]) if i2>0 and i2<1025 : r['ak']=i2 if i[0]=='--ab' and not 'ab' in r: r['ab']=True if i[0]=='--nab' and not 'ab' in r: r['ab']=False if i[0]=='--fa' and not 'fa' in r: if i[1].lower()=='none' or i[1].lower()=='prealloc' or i[1].lower()=='trunc' or i[1].lower()=='falloc': r['fa']=i[1].lower() if i[0]=='--sv' and not 'sv' in r: if i[1].lower()=='true' : r['sv']=True elif i[1].lower()=='false' : r['sv']=False if i[0]=='--ysv' and not 'sv' in r: r['sv']=True if i[0]=='--nsv' and not 'sv' in r: r['sv']=False if i[0]=='--ma' and not 'ma' in r: if i[1].lower()=='true' : r['ma']=True elif i[1].lower()=='false' : r['ma']=False if i[0]=='--yma' and not 'ma' in r: r['ma']=True if i[0]=='--nma' and not 'ma' in r: r['ma']=False if i[0]=='--ms' and not 'ms' in r: t=search("^[0-9]+[MK]?$",i[1]) if t!=None : r['ms']=i[1] if i[0]=='--da' and not 'da' in r: if i[1].lower()=='true' : r['da']=True elif i[1].lower()=='false' : r['da']=False if i[0]=='--yda' and not 'da' in r: r['da']=True if i[0]=='--nda' and not 'da' in r: r['da']=False if i[0]=='--httpproxy' and not 'httpproxy' in r: r['httpproxy']=i[1] if i[0]=='--httpsproxy' and not 'httpsproxy' in r: r['httpsproxy']=i[1] if i[0]=="--jt" and not 'jt' in r: if i[1].lower()=='a' or i[1].lower()=='b' or i[1].isnumeric(): r['jt']=i[1].lower() if i[0]=='--jts' and not 'jts' in r: if checktime(i[1]) : r['jts']=i[1] if i[0]=='-F' and not 'F' in r: r['F']=True if i[0]=='-v' and not 'v' in r: if i[1].isnumeric() : if int(i[1])>0 : r['v']=i[1] if i[0]=='-a' and not 'a' in r: if i[1].isnumeric(): if int(i[1])>0: r['a']=i[1] if i[0]=='-o' and not 'o' in r: r['o']=filterd(i[1]) if i[0]=='--af' and not 'af' in r: r['af']=False if i[0]=='--naf' and not 'af' in r: r['af']=True if i[0]=='--afp' and not 'afp' in r: r['afp']=i[1] if i[0]=='-s' and not 's' in r: r['s']=True if i[0]=='--slt' and not 'slt' in r: r['slt']=True if i[0]=='--nslt' and not 'slt' in r: r['slt']=False if i[0]=='--te' and not 'te' in r: r['te']=True if i[0]=='--nte' and not 'te' in r: r['te']=False if i[0]=='--bd' and not 'bd' in r: r['bd']=True if i[0]=='--nbd' and not 'bd' in r: r['bd']=False if i[0]=='--cad' and not 'cad' in r: r['cad']=True if i[0]=='--ncad' and not 'cad' in r: r['cad']=False if i[0]=='--lrh' and not 'lrh' in r: r['lrh']=True if i[0]=='--nlrh' and not 'lrh' in r: r['lrh']=False if i[0]=='--ahttpproxy' and not 'ahttpproxy' in r: r['ahttpproxy']=i[1] if i[0]=='--ahttpsproxy' and not 'ahttpsproxy' in r: r['ahttpsproxy']=i[1] if i[0]=='--lan' and not 'lan' in r and (i[1]=='null' or i[1] in lan) : r['lan']=i[1] if i[0]=='--bp' and not 'bp' in r: r['bp']=True if i[0]=='--nbp' and not 'bp' in r: r['bp']=False if i[0]=='--in' and not 'in' in r: r['in']=True if i[0]=='--nin' and not 'in' in r: r['in']=False if i[0]=='--mt' and not 'mt' in r: r['mt']=True if i[0]=='--nmt' and not 'mt' in r: r['mt']=False if i[0]=='--vi' and not 'vi' in r: if i[1].isnumeric(): r['vi'] = int(i[1]) if i[0] == '--uc' and not 'uc' in r: r['uc'] = True if i[0] == '--nuc' and not 'uc' in r: r['uc'] = False if i[0] == '--ass' and not 'ass' in r: r['ass'] = True if i[0] == '--nass' and not 'ass' in r: r['ass'] = False if i[0] == '--dmp' and not 'dmp' in r: r['dmp'] = True if i[0] == '--ndmp' and not 'dmp' in r: r['dmp'] = False if i[0] == '--vf' and not 'vf' in r and i[1] in ['mkv', 'mp4']: r['vf'] = i[1] if i[0] == '--lmd' and not 'lmd' in r and i[1].isnumeric(): if int(i[1]) >= 0: r['lmd'] = int(i[1]) if i[0] == '--ynal' and not 'nal' in r: r['nal'] = True if i[0] == '--nnal' and not 'nal' in r: r['nal'] = False if i[0] == '--log' and not 'log' in r: r['log'] = True if i[0] == '--nlog' and not 'log' in r: r['log'] = False if i[0] == '--yauf' and not 'auf' in r: r['auf'] = True if i[0] == '--nauf' and not 'auf' in r: r['auf'] = False if i[0] == '--ydwa' and not 'dwa' in r: r['dwa'] = True if i[0] == '--ndwa' and not 'dwa' in r: r['dwa'] = False if i[0] == '--yol' and not 'ol' in r: r['ol'] = True if i[0] == '--nol' and not 'ol' in r: r['ol'] = False if i[0] == '--ltid': r['ltid'] = True if i[0] == '-b': ree = urlsplit(i[1]) if ree.scheme == "bili": pat = f"{ree.netloc}{ree.path}" if ree.path == "/" and i[1].find("://") > -1: pat = ree.netloc argv = ['-i', unquote_plus(pat)] getp = parse_qs(ree.query, True) for key in getp.keys(): if key == 'b': continue val = getp[key] if len(key) == 1: key = f"-{key}" elif len(key) > 1: key = f"--{key}" else: continue if len(val) == 1 and val[0] == "": argv.append(key) else: for v in val: argv.append(key) argv.append(v) if d: print(argv) try: return gopt(argv) except GetoptError: t = i[1][5:] if t.startswith('//'): t = t[2:] argv = ['-i', t] if d: print(argv) return gopt(argv) if h: global la la=getdict('command',getlan(se,r)) ph() exit() for i in re[1] : if i.lower()=="show": r['SHOW'] = True return r
from JSONParser import loadset,saveset,getset from re import search from PrintInfo import pr from file import filterd from lang import lan,getlan,getdict import sys from command import gopt from JSONParser import loadset la=None se=loadset() if se==-1 or se==-2 : se={} ip={} if len(sys.argv)>1 : ip=gopt(sys.argv[1:]) la=getdict('setsettings',getlan(se,ip)) l1=['x','',''] l2=['','x',''] l3=['','','x'] def print2(s:str,l:list) : t=search('%s',s) u=len(l) i=0 while t : s=s.replace('%s',str(l[i]),1) t=search('%s',s) i=i+1 if i==u : i=0 print(s) def gk(se:dict,key:str) :