def on_receive(self, message): if command(message) is LOCAL_FILES: self.logger.info('new local file list: %s', message['files']) self.local_files = message['files'] if command(message) is REMOTE_FILES: self.logger.info('new remote file list: %s', message['files']) self.update_remote_files(message)
def on_receive(self, message): if command(message) == LOCAL_FILES: files = message['files'] self.logger.info('local file count: %s', len(files)) self.logger.debug('%s', str(files)) self.local_files |= set(files) if command(message) == REMOTE_FILES: self.logger.debug('remote file list: %s', message['files']) self.update_remote_files(message)
def on_receive(self, message): if command(message) == MISSING_FILE: missing_file = file_id_of(message) if missing_file not in self.in_progress: self.logger.info('loading file: [%s] from: [%s]', missing_file, message['ip']) self.start_file_loader(message) if command(message) == LOAD_FAILED_MESSAGE: self.in_progress.remove(file_id_of(message))
def on_receive(self, message): if command(message) == LOCAL_FILES: self.message = broadcast_message(self.fe_port, message['files']) if message is SELF_POKE: self.broadcast() time.sleep(self.interval_seconds) self.poke()
def on_receive(self, message): if command(message) is LOCAL_FILES: self.message = broadcast_message(self.fe_port, message['files']) if message is SELF_POKE: self.broadcast() time.sleep(self.interval_seconds) self.poke()
def execute(PATH): PATH = PATH + '/' videoFiles = [ f for f in os.listdir(PATH) if os.path.isfile(os.path.join(PATH, f)) ] if '.DS_Store' in videoFiles: videoFiles.remove('.DS_Store') msg.show(videoFiles) setWidth = raw_input("Set the value of the overall width: [420] ") setCustomFrames = input('''[1] Default position to 00:00:01 [2] Custom positions [3] Custom positions from profile settings selection: ''') setCustomFrames if setWidth == "": setWidth = 420 subprocess.call(['mkdir', PATH + 'posters']) for item in videoFiles: filename = item[:-4] if setCustomFrames == 1: setFrame = "00:00:01" elif setCustomFrames == 2: setFrame = raw_input(''' Input snapshot position for {} : [00:00:01] '''.format(item)) if setFrame == "": setFrame = "00:00:01" elif setCustomFrames == 3: setFrame = settings['posters'][item] msg.command([ 'ffmpeg', '-ss', setFrame, '-i', PATH + item, '-vframes', '1', '-q:v', '2', # 'scale="{}:-1"'.format(setWidth), '{}posters/{}{}'.format(PATH, filename, '.jpg') ]) helpers.generate_posters(PATH, setFrame, item)