''' open('.\\settings.ini', 'w').write(dsettings.encode('utf-8')) if not os.path.exists(".\\settings.ini"): defaultsettings(iquality, ilang1, ilang2, iforcesub, iforceusa, ilocalizecookies, ionlymainsub) if not os.path.exists(".\\cookies"): if raw_input(u'Do you have an account [Y/N]?').lower() == 'y': username = raw_input(u'Username: '******'Password(don\'t worry the password are typing but hidden:') login.login(username, password) else: login.login('', '') else: userstatus = login.getuserstatus() print 'User Name='+userstatus[1] print 'Membership Type='+userstatus[0] #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#(Argument Parser)#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# parser = argparse.ArgumentParser() parser.add_argument("-u","--url", type=str,help="Crunchyroll Anime Link. if you get an error, try using double quotation marks (\")") parser.add_argument("-sn","--season-number", metavar='#', type=int, nargs = 1, help="Crunchyroll Anime Season Number,it's optional option you can ignore") parser.add_argument("-en","--episode-number", metavar='#', type=int, nargs = 1, help="Crunchyroll Anime Episode Number,it's optional option you can ignore") parser.add_argument("-l","--login", metavar=('Username','Password'), nargs = 2, help="Crunchyroll login: -l User password. if your password has a blank, use double quotation marks (\"). Example: \"This is a password.\"") parser.add_argument("-g","--guest", action='store_true', help="Crunchyroll login as guest") parser.add_argument("-s","--subs-only", action='store_true', help="Download Crunchyroll Anime Subtitle only. if you get an error, try using double quotation marks (\")") parser.add_argument("-q","--queue", type=str, nargs = '?', metavar='Queue Directory', const='.\\queue.txt', help="Run List of Crunchyroll Anime Link in queue file") parser.add_argument("-d","--debug", action='store_true', help="Run crunchy-xml-decoder in Debug Mode") parser.add_argument("-ds","--default-settings", action='store_true', help="Restore default settings") arg = parser.parse_args()
def settings_(): while True: #slang1, slang2, sforcesub, sforceusa, slocalizecookies, vquality, vonlymainsub, vconnection_n_,vproxy_ = config() config_ = config() slang1 = config_['language'] slang2 = config_['language2'] sforcesub = config_['forcesubtitle'] sforceusa = config_['forceusa'] slocalizecookies = config_['localizecookies'] vquality = config_['video_quality'] vonlymainsub = config_['onlymainsub'] vconnection_n_ = config_['connection_n_'] vproxy_ = config_['proxy'] vdubfilter = config_['dubfilter'] slang1 = {u'Español (Espana)' : 'Espanol_Espana', u'Français (France)' : 'Francais', u'Português (Brasil)' : 'Portugues', u'English' : 'English', u'Español' : 'Espanol', u'Türkçe' : 'Turkce', u'Italiano' : 'Italiano', u'العربية' : 'Arabic', u'Deutsch' : 'Deutsch', u'Русский' : 'Russian'}[slang1] slang2 = {u'Español (Espana)' : 'Espanol_Espana', u'Français (France)' : 'Francais', u'Português (Brasil)' : 'Portugues', u'English' : 'English', u'Español' : 'Espanol', u'Türkçe' : 'Turkce', u'Italiano' : 'Italiano', u'العربية' : 'Arabic', u'Deutsch' : 'Deutsch', u'Русский' : 'Russian'}[slang2] if slang1 == 'Espanol_Espana': slang1_ = 'Espanol (Espana)' else: slang1_ = slang1 if slang2 == 'Espanol_Espana': slang2_ = 'Espanol (Espana)' else: slang2_ = slang2 seleccion = 0 try: print(idle_cmd_txt_fix('''Options: 0.- Exit 1.- Video Quality = \x1b[32m'''+vquality+'''\x1b[0m 2.- Primary Language = \x1b[32m'''+slang1_+'''\x1b[0m 3.- Secondary Language = \x1b[32m'''+slang2_+'''\x1b[0m 4.- Hard Subtitle = '''+('\x1b[32m'+str(sforcesub)+'\x1b[0m' if sforcesub else '\x1b[31m'+str(sforcesub)+'\x1b[0m')+''' #The Video will have 1 hard subtitle 5.- USA Proxy = '''+('\x1b[32m'+str(sforceusa)+'\x1b[0m' if sforceusa else '\x1b[31m'+str(sforceusa)+'\x1b[0m')+''' #use a US session ID 6.- Localize cookies = '''+('\x1b[32m'+str(slocalizecookies)+'\x1b[0m' if slocalizecookies else '\x1b[31m'+str(slocalizecookies)+'\x1b[0m')+''' #Localize the cookies (Experiment) 7.- Only One Subtitle = '''+('\x1b[32m'+str(vonlymainsub)+'\x1b[0m' if vonlymainsub else '\x1b[31m'+str(vonlymainsub)+'\x1b[0m')+''' #Only download Primary Language 8.- Dub Filter = '''+('\x1b[32m'+str(vdubfilter)+'\x1b[0m' if vdubfilter else '\x1b[31m'+str(vdubfilter)+'\x1b[0m')+''' #Ignor dub links when autocatch 9.- Change the Number of The Download Connection = \x1b[32m'''+str(vconnection_n_)+'''\x1b[0m 10.- use proxy(it disable if left blank) = \x1b[32m'''+vproxy_+''' \x1b[0m #ex:US 11.- Restore Default Settings > ''')) seleccion = int(input('> ')) except: print(idle_cmd_txt_fix("\x1b[31m"+"ERROR: Invalid option."+"\x1b[0m")) continue if seleccion == 1 : vquality = videoquality_() defaultsettings(vquality, slang1, slang2, sforcesub, sforceusa, slocalizecookies, vonlymainsub, vconnection_n_, vproxy_, vdubfilter) continue elif seleccion == 2 : slang1 = Languages_('slang1') defaultsettings(vquality, slang1, slang2, sforcesub, sforceusa, slocalizecookies, vonlymainsub, vconnection_n_, vproxy_, vdubfilter) continue elif seleccion == 3 : slang2 = Languages_('slang2') defaultsettings(vquality, slang1, slang2, sforcesub, sforceusa, slocalizecookies, vonlymainsub, vconnection_n_, vproxy_, vdubfilter) continue elif seleccion == 4 : if sforcesub: sforcesub = False else: sforcesub = True defaultsettings(vquality, slang1, slang2, sforcesub, sforceusa, slocalizecookies, vonlymainsub, vconnection_n_, vproxy_, vdubfilter) continue elif seleccion == 5 : if sforceusa: sforceusa = False else: sforceusa = True defaultsettings(vquality, slang1, slang2, sforcesub, sforceusa, slocalizecookies, vonlymainsub, vconnection_n_, vproxy_, vdubfilter) continue elif seleccion == 6 : if slocalizecookies: slocalizecookies = False else: slocalizecookies = True defaultsettings(vquality, slang1, slang2, sforcesub, sforceusa, slocalizecookies, vonlymainsub, vconnection_n_, vproxy_, vdubfilter) continue elif seleccion == 7 : if vonlymainsub: vonlymainsub = False else: vonlymainsub = True defaultsettings(vquality, slang1, slang2, sforcesub, sforceusa, slocalizecookies, vonlymainsub, vconnection_n_, vproxy_, vdubfilter) continue elif seleccion == 8 : if vdubfilter: vdubfilter = False else: vdubfilter = True defaultsettings(vquality, slang1, slang2, sforcesub, sforceusa, slocalizecookies, vonlymainsub, vconnection_n_, vproxy_, vdubfilter) continue elif seleccion == 9 : vconnection_n_ = input(u'Please Input The Download Connection Nymber: ') defaultsettings(vquality, slang1, slang2, sforcesub, sforceusa, slocalizecookies, vonlymainsub, vconnection_n_, vproxy_, vdubfilter) continue elif seleccion == 10 : vproxy_ = input(u'Please Input The Proxy: ') defaultsettings(vquality, slang1, slang2, sforcesub, sforceusa, slocalizecookies, vonlymainsub, vconnection_n_, vproxy_, vdubfilter) getuserstatus(True) continue elif seleccion == 11 : defaultsettings(iquality, ilang1, ilang2, iforcesub, iforceusa, ilocalizecookies, ionlymainsub, iconnection_n_, iproxy_, idubfilter) continue elif seleccion == 0 : break else: print(idle_cmd_txt_fix("\x1b[31m"+"ERROR: Invalid option."+"\x1b[0m")) continue
if not os.path.exists(".\\settings.ini"): defaultsettings(iquality, ilang1, ilang2, iforcesub, iforceusa, ilocalizecookies, ionlymainsub) if not os.path.exists(".\\cookies"): if raw_input(u'Do you have an account [Y/N]?').lower() == 'y': username = raw_input(u'Username: '******'Password(don\'t worry the password are typing but hidden:') login.login(username, password) else: login.login('', '') else: userstatus = login.getuserstatus() print 'User Name=' + userstatus[1] print 'Membership Type=' + userstatus[0] #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#(Argument Parser)#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# parser = argparse.ArgumentParser() parser.add_argument( "-u", "--url", type=str, help= "Crunchyroll Anime Link. if you get an error, try using double quotation marks (\")" ) parser.add_argument( "-sn", "--season-number",
defaultsettings(iquality, ilang1, ilang2, iforcesub, iforceusa, ilocalizecookies, ionlymainsub, iconnection_n_, iproxy_, idubfilter) def idle_cmd_txt_fix(print_text): if 'idlelib.run' in sys.modules: print_text = re.sub('\\x1b.*?\[\d*\w','',print_text) return print_text if not os.path.lexists(os.path.join('.','cookies')): if input(u'Do you have an account [Y/N]?').lower() == 'y': username = input(u'Username: '******'Password(don\'t worry the password are typing but hidden:') login(username, password) else: login('', '') #''' userstatus = getuserstatus() else: pass userstatus = getuserstatus() print(idle_cmd_txt_fix('User Name = ' + '\x1b[32m' + userstatus[1] + '\x1b[0m')) print(idle_cmd_txt_fix('Membership Type = ' + '\x1b[32m' +userstatus[0] + '\x1b[0m')) #''' #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#(Argument Parser)#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#(FUNCTION)#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# def queueu(queuepath): if not os.path.lexists(queuepath): open(queuepath, 'w').write(u'#the any line that has hash before the link will be skiped\n') subprocess.call('notepad.exe '+queuepath) lines = open(queuepath).readlines()