Changes

Jump to navigation Jump to search
10,778 bytes removed ,  15:02, 27 September 2019
no edit summary
<pre>import wx,os,subprocess{{TOCright}}
class stuff: def read_file(self,filepath): """reads a file and returns the containing text""" f = open(filepath,"r") config = f.readlines()Introduction== f{{eyecatch|Note|You have to set an API key in your profile before auto-creqing with Avdump GUI.close() return config}}
def create_file(self,filepath,new): """writes content to a not existing file""" f = open(filepath,"w") f.write(new) f.close(){{Avdump-gui}}
class mainFrame(wx.Frame): __simple = ['p','zFor Vista and Windows 7 permission issues on installation:','r','m','c','o'] __options = {'avdump':'avdump*Create a blank .exe','user':'','pass':'','ext':'','misc':'','bsize':'2048','port':'','tout':'30','retries':'6','exp':'exportbat file.txt','log':'log.txt','done':'done.txt'} __configfile='config.ini' def read_config(self): '''read the config file *Insert this text into it and return the content''' if not os.path.exists(self.__configfile)modify it to your situation: self.write_config() for line in glob.read_file(self.__configfile)<br> <tt>"C: if not line\Windows\System32\msiExec.endswith('=')exe" -i "C: temp,val = line.rstrip('\n')Directory\Where\Located\avdump-gui.split('=',1)msi"</tt> else: val = '' for elem in self*Right click and run the .__options: if temp == elem: selfbat file as administrator.__options[temp] = val
def write_config(self,newconfig=''):=Changelog== for elem in self.__options:<pre> newconfig += ('%s=%s\n') %(elem,self v2.__options[elem]) glob42 - 08.create_file(self01.__configfile,newconfig)2019 *available as auto update* * Avdump2 Build 7080 added
def __init__(self, parent, title): wx v2.Frame.__init__(self, parent, 41 -1, u'Avdump GUI', wx05.DefaultPosition, (350, 140), style=wx01.CLOSE_BOX | wx.SYSTEM_MENU | wx.CAPTION | 0 | 0 | wx.MINIMIZE_BOX)2019 *available as auto update* * show error message about too long paths self.panel = wx.Panel(self, -1) * fallback to cp437 in case shell encoding fails which i guess should work?
self v2.filepath = wx.TextCtrl(self.panel, -1, '', (95, 25), size=(190, 24)) self.start = wx.Button(self.panel, -1, 'Start', (90,75), (-1, -1)) self.options = wx.Button(self.panel, -1, 'Options', (185,75), (-1, -1)) self.select = wx.Button(self.panel, -1, '...', (295, 25), (25, 40 -1)) self.scantype = wx03.RadioBox(self.panel,-1,pos=(5,5),size=(-1, 59),style=wx01.RA_VERTICAL,label='scantype',choices = ['Files','Folder'])2019 *available as auto update* self.Bind(wx.EVT_BUTTON, self.selectClick, self.select) * Avdump2 Build 7070 added self.Bind(wx.EVT_BUTTON, self.optionsClick, self.options) self.Bind(wx.EVT_BUTTON, self.startClick, self.start) self.read_config() * show errors in filelist if we encounter one while processing a file instead of endless retrying
self v2.child = OptionsFrame(self, 'App')33 - 09.11.2016 *available as auto update* * new icon * progressbar and status not updating
def selectClick(self, event,path=''): if self.scantype.GetStringSelection() == 'Files': dialog = wx.FileDialog ( None, message = 'Pick a directory.', style= wx.FD_MULTIPLE) if dialog.ShowModal() == wx.ID_OK: temp = dialog.GetPaths() if len(temp)>1: for elem in temp: path += '"' + elem + '" ' else: path = '"' + temp[0].rstrip("\\") + '"' else: dialog = wx.DirDialog ( None, message = 'Pick a directory v2.' ) if dialog32 - 09.ShowModal() == wx11.ID_OK:2016 *available as auto update* path = '"' + dialog.GetPath().rstrip("\\") + '"' * options not being stored on initial start
self v2.filepath31 - 09.Clear() dialog11.Destroy()2016 *available as auto update* self.filepath.write(path) self.__options['scanpath'] = path * fixed drag and drop
def startClick(self, event): self v2.__options['param'] = '' if self.filepath30 - 03.GetValue() != '': self11.read_config()2016 *available as auto update* if self * ported from python 2.__options['misc']7 to 3.lstrip(',') > 0:4 for elem in self.__options['misc'].split * path/filename encoding woes fixed(','?): if elem not in ['retries','']: if elem in self.__simple: self.__options['param'] += ' -' + elem elif elem == 'tout': self.__options['param'] += ' -' + elem + ':' + self.__options[elem] + ':' + self.__options['retries'] else: self.__options['param'] += ' -' + elem + ':' + self.__options[elem] subprocess.call(('"%s" -ac:%s:%s%s %s') %(self.__options['avdump'], self.__options['user'], self.__options['pass'], self.__options['param'], self.__options['scanpath'])) * export option removed and made implicit to be always enabled
def optionsClick(self, event): self v2.20 - 18.child08.Show(True)2015 *available as auto update* * Avdump2 Build 6714 added * dependencies updated
class OptionsFrame(wx v2.Frame): __box = {'ext':False,'log':False,'exp':False,'port':False,'done':False,'bsize':False,'tout':False,'c':False,'m':False,'p':False,'r':False,'z':False,'o':False} __options = {'avdump':'avdump19 - 11.exe','user':'','pass':'','ext':'','misc':'','bsize':'2048','port':'','tout':'30','retries':'6','exp':'export11.txt','log':'log.txt','done':'done.txt'}2012 *available as msi installer & auto update* * Avdump2 Build 6525 added __configfile='config.ini' * recompiled with updated dependencies which may or may not fix some issues or cause new ones
def read_config(self): '''read the config file and return the content''' if not os.path.exists(self.__configfile): self.write_config() for line in glob.read_file(self v2.__configfile): if not line18 - 31.endswith('='): temp,val = line07.rstrip('\n').split('=',1)2012 *available as auto update* else: val = '' for elem in self.__options: if temp == elem: self.__options[temp] = val * Avdump2 Build 5290 added
def write_config(self,newconfig=''): for elem in self v2.17 - 21.__options: newconfig += ('%s=%s\n') %(elem,self09.__options[elem])2011 *available as auto update* glob.create_file(self.__configfile,newconfig) * filename encoding issue fixed
def set_misc v2.15 - 13.09.2011 * Avdump2 Build 5028 added * text fix (self,misc=''Optionen instead of Options. watch out for da evil germanz ja): for elem in self.__box: if self.__box[elem] is True: * can now drop files into the table to process misc += elem + ',' * speed improvement when adding lots of files at once (really only noticeable > 500) self.__options['misc'] = misc * potentially fixing some issue with the last filehash not being shown in the export box
def get_checkboxes(self,misc): if misc is not None: misc = misc v2.rstrip(',')14 - 11.lstrip(',') if misc09.find(',') > 0:2011 for elem in misc.split(','): self.__box[elem] = True else: self.__box[misc] = True * Avdump2 Build 5000 added
def __init__(self, parent, title): wx v2.Frame.__init__(self, parent, 13 -1, 'options', wx.DefaultPosition, (301, 691), style=wx.CLOSE_BOX | wx.SYSTEM_MENU | wx.CAPTION | 0 | 0 | wx.MINIMIZE_BOX) self06.panel = wx09.Panel(self, -1)2011 self.adoptions = wx.StaticBox(self.panel, -1, "advanced options", (5,170), (275, 275)) * Avdump2 Build 4991 added self.groupbox3 = wx.StaticBox(self.panel, -1, "Path * fixes to be compatible to Avdump", (5,0), (275, 55)) self.groupbox4 = wx.StaticBox(self.panel, -1, "UDP API Username/Password", (5,55), (275, 115)) self.groupbox5 = wx.StaticBox(self.panel, -1, "logs", (5,445), (275, 170)) self.filepath = wx.TextCtrl(self.panel, -1, '', (15,20), size=(220, 25)) self.selectavdump = wx.Button(self.panel, -1, '...', (245,20), (25, 25)) self.username = wx.TextCtrl(self.panel, -1, '', (15,90), size=(255, 25)) self.password = wx.TextCtrl(self.panel, -1, '', (15,135), size=(255, 25)) self.delete = wx.CheckBox(self.panel, -1, 'delete files after parsing', (15,190), (240, 17)) self.recursive = wx.CheckBox(self.panel, -1, 'do _not_ recurse into subfolders', (15,205), (240, 17)) self.monitor = wx.CheckBox(self.panel, -1, 'Monitor folder(s)', (15,220), (240, 17)) self.bsize = wx.CheckBox(self.panel, -1, 'overwrite the default setting for buffersize', (15,235), (240, 17)) self.ext = wx.CheckBox(self.panel, -1, 'overwrite the default setting for extentions', (15,250), (240, 17)) self.port = wx.CheckBox(self.panel, -1, 'overwrite the default setting for port', (15,265), (240, 17)) self.tout = wx.CheckBox(self.panel, -1, 'overwrite the default setting for timeouts', (15,280), (240, 17)) self.pause = wx.CheckBox(self.panel, -1, 'Pause when done (hold cmd window)', (15,295), (240, 17)) self.random = wx.CheckBox(self.panel, -1, 'Random file order', (15,310), (240, 17)) self.wait = wx.CheckBox(self.panel, -1, 'wait for response when sending dumps', (15,325), (240, 17)) self.extention = wx.TextCtrl(self.panel, -1, '', (15,360), size=(255, 25)) self.buffersize = wx.TextCtrl(self.panel, -1, '', (15,405), size=(55, 25)) self.portnumber = wx.TextCtrl(self.panel, -1, '', (81,405), size=(55, 25)) self.timeout = wx.TextCtrl(self.panel, -1, '', (149,405), size=(55, 25)) self.retries = wx.TextCtrl(self.panel, -1, '', (215,405), size=(55, 25)) self.exp = wx.CheckBox(self.panel, -1, '', (15,478), (17, 17)) self.exppath = wx.TextCtrl(self.panel, -1, '', (35,475), size=(200, 25)) self.selectexp = wx.Button(self.panel, -1, '...', (245,475), (25, 23)) self.done = wx.CheckBox(self.panel, -1, '', (15,538), (17, 17)) self.donepath = wx.TextCtrl(self.panel, -1, '', (35,535), size=(200, 25)) self.selectdone = wx.Button(self.panel, -1, '...', (245,535), (25, 23)) self.log = wx.CheckBox(self.panel, -1, '', (15,583), (17, 17)) self.logpath = wx.TextCtrl(self.panel, -1, '', (35,580), size=(200, 25)) self.selectlog = wx.Button(self.panel, -1, '...', (245,580), (25, 23)) self.save = wx.Button(self.panel, -1, 'Save', (65,620), (75, 23)) self.cancel = wx.Button(self.panel, -1, 'Cancel', (150,620), (75, 23)) self.Retries = wx.StaticText(self.panel, -1, 'Retries:', (220,387), (44, 17)) self.Timeout = wx.StaticText(self.panel, -1, 'Timeout:', (152,387), (50, 17)) self.Buffersize = wx.StaticText(self.panel, -1, 'Buffersize:', (16,387), (60, 17)) self.Port = wx.StaticText(self.panel, -1, 'Port:', (86,387), (44, 17)) self.donelog = wx.StaticText(self.panel, -1, 'save processed-file-paths to file and exlude existing from proc', (40,505), (200, 25)) self.exported2k = wx.StaticText(self.panel, -1, 'export ed2k-links to file', (40,457), (150, 17)) self.writelog = wx.StaticText(self.panel, -1, 'write output to log', (40,563), (150, 17)) self.apiuser = wx.StaticText(self.panel, -1, 'Username:', (20,73), (150, 17)) self.apipass = wx.StaticText(self.panel, -1, 'Password:', (20,118), (150, 17)) self.extentionlist = wx.StaticText(self.panel, -1, 'comma seperated extension list', (20,343), (170, 17)) self.Bind(wx.EVT_BUTTON, self.selectavdClick, self.selectavdump) self.Bind(wx.EVT_BUTTON, self.selectlogClick, self.selectlog) self.Bind(wx.EVT_BUTTON, self.selectexpClick, self.selectexp) self.Bind(wx.EVT_BUTTON, self.selectdoneClick, self.selectdone) self.Bind(wx.EVT_BUTTON, self.saveClick, self.save) self.Bind(wx.EVT_BUTTON, self.cancelClick, self.cancel) self.Bind(wx.EVT_CLOSE, self.onclose) self.refresh()new Avdump2 CLI
def selectavdClick(self, event): dialog = wx v2.FileDialog ( None, message = 'Pick a directory12 - 05.') if dialog09.ShowModal() == wx.ID_OK:2011 *pulled* self.filepath.Clear() self.filepath.write(dialog.GetPath()) * Avdump2 Build 4964 added
def selectlogClick(self, event): v2.11 - 01.07.2011 dialog = wx.FileDialog * trying to scan files without having provided a username/password -> BOOM ( None, message = 'Pick a directory.'trying to kill the subprocess without it running) * removing already scanned files form the list and readding them will process them again even if dialog.ShowModal() == wx.ID_OK:"done" is set self.logpath.Clear () selffrom frontend at least.logpathavdump itself would ignore them.write(dialog.GetPath()this would leave a couple "new" entries in the list)
def selectexpClick(self, event): dialog = wx v2.10 - 01.FileDialog ( None, message = 'Pick a directory07.')2011 * Avdump2 Build 4334 added * Autoupdater implemented * last scanned dir stored in config if dialog.ShowModal * window size stored in config (unless it's maximized) == wx.ID_OK: self.exppath.Clear() * use stderr to catch errors instead of stdout self.exppath.write(dialog.GetPath()) * lots of rewriting
def selectdoneClick(self, event): dialog = wx v2.02 - 09.FileDialog ( None, message = 'Pick a directory06.')2011 if dialog.ShowModal() == wx.ID_OK: * Avdump2 Build 4320 added self.donepath.Clear() * ditched subprocess module in favour of qprocess self.donepath.write(dialog.GetPath * peek into console output and notice the user when an error happened ()outdated version or wrong password/username)
def saveClick(self,event): v2.01 - 06.06.2011 self.update() * various nasty bugs removed self.Show(False) * windows can be enlarged on demand
def cancelClick(self,event): v2.00 - 03.06.2011 self.refresh() * Avdump2 Build 4260 added self.Show(False) * rewrote the whole lot and simplified it
def onclose(self,event): v1.07 - 06.04.2008 self * Avdump 0.Show(False)34 added * fixed a bug with the bufferfield not allowing 16 buffer while that being the default * made option o default when no profile exists
def refresh(self): self v1.read_config() self06 - 12.get_checkboxes(self02.__options['misc'])2008 self.filepath.Clear() self.filepath.write(self.__options['avdump']) self.username.Clear() self.username.write(self.__options['user']) self.password.Clear() self.password.write(self.__options['pass']) self.extention.Clear() self.extention.write(self.__options['ext']) self.buffersize.Clear() self.buffersize.write(self.__options['bsize']) self.portnumber.Clear() self.portnumber.write(self.__options['port']) self.timeout.Clear() self.timeout.write(self.__options['tout']) self.retries.Clear() self.retries.write(self.__options['retries']) self.exppath.Clear() self.exppath.write(self.__options['exp']) self.logpath.Clear() self.logpath.write(self.__options['log']) self.donepath.Clear() self.donepath.write(self.__options['done']) self.ext.SetValue(self.__box['ext']) self.log.SetValue(self.__box['log']) self.exp.SetValue(self.__box['exp']) self.port.SetValue(self.__box['port']) self.done.SetValue(self.__box['done']) self.bsize.SetValue(self.__box['bsize']) self.tout.SetValue(self.__box['tout']) self.recursive.SetValue(self.__box['c']) self.monitor.SetValue(self.__box['m']) self.pause.SetValue(self.__box['p']) self.random.SetValue(self.__box['r']) self.delete.SetValue(self.__box['z']) self.wait.SetValue(self * Avdump 0.__box['o'])33 added
def update(self): self.__options['avdump'] = self.filepath.GetValue() self.__options['user'] = self.username.GetValue() self.__options['pass'] = self.password.GetValue() self.__options['ext'] = self.extention.GetValue() temp = int(self v1.buffersize.GetValue()) '''make sure it's mod 8 and at least 256kb''' if int(temp) < 256: temp = 256 if not temp % 8: temp = temp 05 - (temp%8) self.__options['bsize'] = unicode(temp) self.__options['port'] = self.portnumber.GetValue() self.__options['tout'] = self.timeout.GetValue() temp = int(self.timeout.GetValue()) '''make sure it's at least 20''' if int(temp) < 20: temp = 20 self.__options['tout'] = unicode(temp) self.__options['retries'] = self.retries.GetValue() self.__options['exp'] = self.exppath.GetValue() self.__options['log'] = self.logpath.GetValue() self.__options['done'] = self.donepath.GetValue() self.__box['ext'] = self.ext.GetValue() self.__box['log'] = self.log.GetValue() self.__box['exp'] = self.exp.GetValue() self.__box['port'] = self.port.GetValue() self.__box['done'] = self.done.GetValue() self.__box['bsize'] = self13.bsize11.GetValue()2007 self.__box['tout'] = self.tout.GetValue() self.__box['c'] = self.recursive.GetValue() self.__box['m'] = self.monitor.GetValue() self.__box['p'] = self.pause.GetValue() self.__box['r'] = self.random.GetValue() self.__box['z'] = self.delete.GetValue() self.__box['o'] = self.wait.GetValue() self.set_misc() self.write_config() * thx to rar for fixing dumping of files with characters in non local codepage
class App(wx v1.App): def OnInit(self): frame = mainFrame(None, 'App')04 - 10.11.2007 frame.Show(True) * fix for not being able to dump files with Japanese characters in the filename self * Avdump 0.SetTopWindow(frame) return True32 added and changes implemented
if __name__ == '__main__ v1.03 - 13.05.2007 * added the console again * fix for log, export and done paths with spaces * added parents for the dialogues so they die with the program and can':t stay open any more glob = stuff * option 9 added (experimental mp3 hashing for ostdb) app = App(True) v1.02 - 13.05.2007 * added error and warning dialogue boxes to prevent a couple problems * added some exception handling for a few fields v1.01 - 12.05.2007 * killed a nasty bug with trailing \ in the scanpath app v1.00 - 12.05.MainLoop()2007 * Initial release
</pre>
 
[[Category:Features]]
[[Category:AniDB Clients]]
[[Category:Avdump]]
[[Category:Development]]

Navigation menu

MediaWiki spam blocked by CleanTalk.