def on_play_files(self, *args): downloaddir = config.sections["transfers"]["downloaddir"] for transfer in self.selected_transfers: playfile = None if transfer.file is not None and os.path.exists( transfer.file.name): playfile = transfer.file.name else: # If this file doesn't exist anymore, it may have finished downloading and have been renamed # try looking in the download directory and match the original filename. basename = str.split(transfer.filename, '\\')[-1] if transfer.path: # Custom download path specified path = os.sep.join([transfer.path, basename]) else: path = os.sep.join([downloaddir, basename]) if os.path.exists(path): playfile = path if playfile: command = config.sections["players"]["default"] open_file_path(playfile, command)
def on_open_directory(self, widget): downloaddir = self.frame.np.config.sections["transfers"]["downloaddir"] incompletedir = self.frame.np.config.sections["transfers"]["incompletedir"] if incompletedir == "": incompletedir = downloaddir transfer = next(iter(self.selected_transfers)) complete_path = os.path.join(downloaddir, transfer.path) if transfer.path == "": if transfer.status == "Finished": final_path = downloaddir else: final_path = incompletedir elif os.path.exists(complete_path): # and tranfer.status is "Finished" final_path = complete_path else: final_path = incompletedir # Finally, try to open the directory we got... command = self.frame.np.config.sections["ui"]["filemanager"] open_file_path(final_path, command)
def _on_play_files(self, widget, prefix=""): for fn in self.selected_transfers: playfile = fn.realfilename if os.path.exists(playfile): command = self.frame.np.config.sections["players"]["default"] open_file_path(playfile, command)
def on_file_manager(self, widget): if self.selected_folder is None: return path = self.frame.np.shares.virtual2real(self.selected_folder) command = self.frame.np.config.sections["ui"]["filemanager"] open_file_path(path, command)
def on_play_files(self, *args): for transfer in self.selected_transfers: basename = str.split(transfer.filename, '\\')[-1] playfile = os.path.join(transfer.path, basename) if os.path.exists(playfile): command = config.sections["players"]["default"] open_file_path(playfile, command)
def _on_play_files(self, widget, prefix=""): path = self.frame.np.shares.virtual2real(self.selected_folder) for fn in self.selected_files: playfile = os.sep.join([path, fn]) if os.path.exists(playfile): command = self.frame.np.config.sections["players"]["default"] open_file_path(playfile, command)
def on_open_directory(self, *args): transfer = next(iter(self.selected_transfers), None) if not transfer or not os.path.exists(transfer.path): return # Finally, try to open the directory we got... command = config.sections["ui"]["filemanager"] open_file_path(transfer.path, command)
def on_open_directory(self, widget): downloaddir = self.frame.np.config.sections["transfers"]["downloaddir"] incompletedir = self.frame.np.config.sections["transfers"][ "incompletedir"] if incompletedir == "": incompletedir = downloaddir transfer = next(iter(self.selected_transfers)) if os.path.exists(transfer.path): final_path = transfer.path else: final_path = incompletedir # Finally, try to open the directory we got... command = self.frame.np.config.sections["ui"]["filemanager"] open_file_path(final_path, command)
def _on_play_files(self, widget, prefix=""): downloaddir = self.frame.np.config.sections["transfers"]["downloaddir"] for fn in self.selected_transfers: playfile = None if fn.file is not None and os.path.exists(fn.file.name): playfile = fn.file.name else: # If this file doesn't exist anymore, it may have finished downloading and have been renamed # try looking in the download directory and match the original filename. basename = str.split(fn.filename, '\\')[-1] path = os.sep.join([downloaddir, basename]) if os.path.exists(path): playfile = path if playfile: command = self.frame.np.config.sections["players"]["default"] open_file_path(playfile, command)
def on_open_directory(self, *args): downloaddir = config.sections["transfers"]["downloaddir"] incompletedir = config.sections["transfers"][ "incompletedir"] or downloaddir transfer = next(iter(self.selected_transfers), None) if not transfer: return if transfer.status == "Finished": if os.path.exists(transfer.path): final_path = transfer.path else: final_path = downloaddir else: final_path = incompletedir # Finally, try to open the directory we got... command = config.sections["ui"]["filemanager"] open_file_path(final_path, command)