def populateFields(self): options = uconfig.read_config() for label in options['Labels']: self.createLabelStorageInput(label, options['Labels'][label]) self.storageDirEdit.setText(options['Global']['storage_dir']) if int(options['Global']['imdb']) == 1: self.useImdbCheckbox.setChecked(True) if int(options['Global']['use_labels']) == 1: self.useTorrentLabelsCheckbox.setChecked(True)
def save(self): options = uconfig.read_config() i = 0 s = len(self.l) while i<s: if self.l[i] is not None and str(self.l[i].text()) is not '': options['Labels'][str(self.l[i].text())] = str(self.e[i].text()) i += 1 options['Global']['storage_dir'] = str(self.storageDirEdit.text()) options['Global']['imdb'] = self.useImdbCheckbox.isChecked() and '1' or '0' options['Global']['use_labels'] = self.useTorrentLabelsCheckbox.isChecked() and '1' or '0' uconfig.write_config(options) hook2utorrent()
folder = series_name_imdb print print 'Unable to find suitable match on IMDB. Falling back to original name: {}'.format(series_name_imdb) print return folder def hook2utorrent(): utd = os.path.join(os.environ['APPDATA'], 'uTorrent', 'settings.dat'); if os.path.exists(utd)==False: text = "Unable to load uTorrent settings.dat, please set 'Run Program' manually.\nRefer to readme.txt to find out how to do that." mb = MessageBox() mb.msg(text) sys.exit() else: u = uTorrent() u.setConfPath(utd) bin_path = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), 'autoextractor.exe') t = '"{}" --name "%N" --path "%D" --label "%L" --singlefile "%F"'.format(bin_path) u.setOption('finish_cmd', t) u.save() if __name__ == "__main__": global levenshtein, too_much_results, too_little_query, options too_much_results = 50 too_little_query = 3 options = read_config() levenshtein = options['Global']['levenshtein'] main(sys.argv[1:])