def extract_xml(mkv_file): oddconfig.read("../../../settings.ini") xml_outpot = subprocess.getoutput( oddconfig.get_setting('mkvextract', 'APPLICATIONS') + " chapters " + mkv_file) #TODO if starts with <something>: return, else raise exception return xml_outpot
def create_widgets(self): self.path_frame = tk.Frame(self) oddconfig.read(os.path.dirname(os.path.realpath(__file__)) + "\settings.ini") print(oddconfig.read_files) inn = oddconfig.get_setting("input") self.in_path = create_fileselect(self.path_frame, True, inn) self.in_path.pack(side="top") out = oddconfig.get_setting("output") self.out_path = create_fileselect(self.path_frame, True, out) self.out_path.pack(side="top") self.path_frame.pack() self.display_button = tk.Button(self, text="Find", command=self.list_shows) self.display_button.pack() self.showlist = tk.Frame(self) self.showlist.pack(side="left") MOVE = tk.Button(self, text="Move", command=self.movefiles) MOVE.pack(side="bottom") QUIT = tk.Button(self, text="QUIT", fg="red", command=root.destroy) QUIT.pack(side="bottom")
def create_widgets(self): self.path_frame = tk.Frame(self) oddconfig.read( os.path.dirname(os.path.realpath(__file__)) + "\settings.ini") print(oddconfig.read_files) inn = oddconfig.get_setting("input") self.in_path = create_fileselect(self.path_frame, True, inn) self.in_path.pack(side="top") out = oddconfig.get_setting("output") self.out_path = create_fileselect(self.path_frame, True, out) self.out_path.pack(side="top") self.path_frame.pack() self.display_button = tk.Button(self, text="Find", command=self.list_shows) self.display_button.pack() self.showlist = tk.Frame(self) self.showlist.pack(side="left") MOVE = tk.Button(self, text="Move", command=self.movefiles) MOVE.pack(side="bottom") QUIT = tk.Button(self, text="QUIT", fg="red", command=root.destroy) QUIT.pack(side="bottom")
def get_apikey(keyname): oddconfig.read( os.path.dirname(__file__).rsplit('\\', maxsplit=1)[0].rsplit( '\\', maxsplit=1)[0] + '\settings.ini') return oddconfig.get_setting(keyname, 'API_KEYS')
def replace_chapternames(chapter_xml, chapter_csv): oddconfig.read("../../../settings.ini") pass
def extract_xml(mkv_file): oddconfig.read("../../../settings.ini") xml_outpot = subprocess.getoutput(oddconfig.get_setting('mkvextract', 'APPLICATIONS') + " chapters " + mkv_file) #TODO if starts with <something>: return, else raise exception return xml_outpot
import tempfile import shutil import subprocess import requests from OddTools import oddconfig __author__ = 'Odd' oddconfig.read("../settings.ini") mkvprop_path = oddconfig.get_setting('mkvpropedit', 'APPLICATIONS') def download_file(name, dir, url): response = requests.get(url, stream=True) with open(dir + '/' + name, 'wb') as out_file: shutil.copyfileobj(response.raw, out_file) del response return dir + '/' + name def attach_files(attachments, file): directory = tempfile.mkdtemp('attachment') print(directory) for attachment in attachments: print(subprocess.getoutput(mkvprop_path + ' "' + file + '"' + ' --add-attachment "' + download_file(attachment, directory, attachments[attachment]) + '"')) def add_tags(filename, xml):