def delete_prog(self,pinf): vs = VideoService() (exit_status,stdout,stderr) = vs.delete_video_from_proginfo( self.hostname, pinf, force_delete = False ) if exit_status == 0: self.file_list.remove(pinf)
def __init__(self,hostname=None,recording_dir=None,metadata_file=None): if hostname is None: hostname = ORPHANS['mythhost'] if recording_dir is None: recording_dir = ORPHANS['recording_dir'] if metadata_file is None: metadata_file = ORPHANS['metadata_file'] self.hostname = hostname self.recording_dir = recording_dir self.metadata_file = metadata_file vs = VideoService() self.video_dir = vs.video_directory() # If metadata_file already exists, read it. If not, # assume this is the first run and create it. if os.path.isfile(self.metadata_file): self.file_list = self.read_metadata_file() else: self.file_list = self.scan_recording_directory() self.save_metadata_file()
def rescue(self,pinf,redo=False): # First, has a video already been made # for this item? If so, don't proceed # unless 'redo' is True: if pinf.video_made: if redo == False: return # Next, copy this item's file from into the appropriate # video directory. vs = VideoService() source_dir = ORPHANS['recording_dir'] # res will be zero if copy went OK... res = vs.copy_file_from_tv_to_video(pinf, source_dir) if res != 0: raise Exception("Unknown error copying {}-{} ({}) to video directory" .format(pinf.title,pinf.subtitle,pinf.filename)) # Now tell MythTV about the file we just inserted... vs.add_video_from_prog_info(pinf) # and set the new video entry's metadata: vs.update_metadata_from_proginfo(pinf) # If all the above was successful, mark this ProgInfo as done: pinf.video_made = True