def downloadsub(root_window: tkinter.Tk) -> None: for current_path in get_selected_movie_paths(): if not is_filetype_supported(current_path): tkinter.messagebox.showerror("Kipawa Sub Downloader", "This is not a supported movie file") else: try: if subdb_subtitles_exist(current_path): try: subdb.download_subtitles(current_path) tkinter.messagebox.showinfo("Kipawa Sub Downloader", "Subtitles downloaded successfully!") except SubtitlesNotAvailableException: tkinter.messagebox.showinfo("Kipawa Sub Downloader", "Sorry ! Better subtitles not found") elif opensubtitles_subs_exist(current_path): try: opensub.downloadsub(current_path) tkinter.messagebox.showinfo("Kipawa Sub Downloader", "Subtitles downloaded succesdfully!") except SubtitlesNotAvailableException: tkinter.messagebox.showinfo("Kipawa Sub Downloader", "Sorry ! Better subtitles not found") else: try: download_default_subtitles(current_path) tkinter.messagebox.showinfo("Kipawa Sub Downloader", "Subtitles downloaded succesdfully!") except SubtitlesNotAvailableException: tkinter.messagebox.showinfo("Kipawa Sub Downloader", "Sorry, no subtitles were found") except DownloadException as e: tkinter.messagebox.showinfo("Kipawa Sub Downloader", "Error downloading subtitles: " + str(e)) except ValueError as e: tkinter.messagebox.showinfo("Kipawa Sub Downloader", "There is a problem with this file: " + str(e)) root_window.quit()
def download_default_subtitles(path_to_the_movie: str) -> None: try: subdb.download_subtitles(path_to_the_movie) except (DownloadException, SubtitlesNotAvailableException): opensub.downloadsub(path_to_the_movie)