From 5ffb173513132d5a5f3b30be91a053ed809528fb Mon Sep 17 00:00:00 2001 From: Martinez Date: Tue, 9 Jun 2015 20:58:30 +0200 Subject: [PATCH] fix interpreter path update to current over --- aux.py | 2 +- doc/coniuga.py | 2 +- doc/ellib.py | 2 +- over-video.py | 90 ++++++++++++++++++++++++-------------------------- version.py | 6 +++- 5 files changed, 51 insertions(+), 51 deletions(-) diff --git a/aux.py b/aux.py index f259a7c..f74f062 100644 --- a/aux.py +++ b/aux.py @@ -1,4 +1,4 @@ -#! /bin/env python3 +#! /usr/bin/env python3 # encoding: utf-8 import os diff --git a/doc/coniuga.py b/doc/coniuga.py index da511cf..661808a 100755 --- a/doc/coniuga.py +++ b/doc/coniuga.py @@ -1,4 +1,4 @@ -#! /bin/env python +#! /usr/bin/env python2 # encoding: utf-8 # # Res Tranceliī diff --git a/doc/ellib.py b/doc/ellib.py index d86baa9..1caf59c 100755 --- a/doc/ellib.py +++ b/doc/ellib.py @@ -1,4 +1,4 @@ -#! /bin/env python +#! /usr/bin/env python2 # -*- coding: utf-8 -*- import os, pickle, re, sys, time, traceback diff --git a/over-video.py b/over-video.py index dcc7d4a..845cf30 100755 --- a/over-video.py +++ b/over-video.py @@ -1,4 +1,4 @@ -#! /bin/env python3 +#! /usr/bin/env python3 # encoding: utf-8 import json @@ -8,16 +8,12 @@ import pathlib import re import tempfile import time +import version from aux import parse_fps, to_Path -from version import _version Command = over.core.cmd.Command - -# -------------------------------------------------- - -prefix = over.core.textui.prefix -_print = over.core.textui.Output('over.video') +prefix = over.core.text.prefix # -------------------------------------------------- @@ -38,7 +34,7 @@ command.sub_copy_video = Command('-codec:v', 'copy') # -------------------------------------------------- if __name__ == '__main__': - main = over.core.app.Main('Over-Video', '%d (%s)' %_version, 'AWARE-Overwatch Joint Software License', '~/.over/video.cfg') + main = over.core.app.Main('over-video', 'Overwatch Video', version.str, 'AO-JSL', use_cfg_file=True) main.add_option('audio', 'str', 'vorbis', 'Audio codec to use, either §mvorbis§/, §mpcm§/, §mcopy§/ or §mdrop§/.', short_name='a') main.add_option('audio-quality', 'float', 2, 'Audio encoding quality with -1 being the worst and 10 being the best.', short_name='q') main.add_option('video', 'str', 'x264', 'Video codec to use, either §mx264§/, §mtheora§/, §mcopy§/ or §mdrop§/.', short_name='v') @@ -92,24 +88,24 @@ if __name__ == '__main__': elif main.cfg.audio == 'vorbis': files.container = 'ogg' - _print('settings', prefix.start, suffix=':\n') - _print('audio: %s' %(', '.join(audio_words))) - _print('video: %s' %(', '.join(video_words))) - _print('container: §gtype§/=§m%s§/' %(files.container)) + main.print('settings', prefix.start, suffix=':\n') + main.print('audio: %s' %(', '.join(audio_words))) + main.print('video: %s' %(', '.join(video_words))) + main.print('container: §gtype§/=§m%s§/' %(files.container)) if main.cfg.move_source: - _print('move source files to §B%s§//' %(main.cfg.move_source)) + main.print('move source files to §B%s§//' %(main.cfg.move_source)) if main.cfg.audio not in ('drop', 'copy', 'pcm', 'vorbis'): - _print('unknown audio codec', prefix.fail) + main.print('unknown audio codec', prefix.fail) raise RuntimeError if main.cfg.video not in ('drop', 'copy', 'theora', 'x264'): - _print('unknown video codec', prefix.fail) + main.print('unknown video codec', prefix.fail) raise RuntimeError if not main.targets: - _print('no files specified', prefix.warn) + main.print('no files specified', prefix.warn) for tgt in main.targets: print() @@ -120,10 +116,10 @@ if __name__ == '__main__': files.move_infile_to = to_Path(main.cfg.move_source) / files.infile.name if main.cfg.move_source else None if not os.path.exists(tgt) or os.path.isdir(tgt): - _print('target §y%s§/ §ris not a readable file§/, skipping' %(tgt), prefix.fail) + main.print('target §y%s§/ §ris not a readable file§/, skipping' %(tgt), prefix.fail) continue - _print('processing §B%s§/' %(tgt), prefix.start) + main.print('processing §B%s§/' %(tgt), prefix.start) # -------------------------------------------------- # identify the input file @@ -146,54 +142,54 @@ if __name__ == '__main__': amount_as = len(audio_streams) if amount_vs != 1: - _print('detected §r%d§/ video streams' %(amount_vs), prefix.fail) + main.print('detected §r%d§/ video streams' %(amount_vs), prefix.fail) print(video_streams) main.exit(1) if amount_as > 1: - _print('detected §y%d§/ audio streams, picking the "best" one (see man 1 ffmpeg, section STREAM SELECTION)' %(amount_as), prefix.warn) + main.print('detected §y%d§/ audio streams, picking the "best" one (see man 1 ffmpeg, section STREAM SELECTION)' %(amount_as), prefix.warn) video = video_streams[0] info.video_codec = video['codec_name'] info.video_size_x = video['width'] info.video_size_y = video['height'] - info.video_fps = over.core.textui.Unit(parse_fps(video['r_frame_rate']), 'Hz') - info.video_bitrate = over.core.textui.Unit(video['bit_rate'], 'b/s') if 'bit_rate' in video else '§r??§/' + info.video_fps = over.core.text.Unit(parse_fps(video['r_frame_rate']), 'Hz') + info.video_bitrate = over.core.text.Unit(video['bit_rate'], 'b/s') if 'bit_rate' in video else '§r??§/' if audio_streams: audio = audio_streams[0] info.audio_codec = audio['codec_name'] info.audio_channels = audio['channels'] - info.audio_samplerate = over.core.textui.Unit(audio['sample_rate'], 'Hz') + info.audio_samplerate = over.core.text.Unit(audio['sample_rate'], 'Hz') info.audio_language = audio['tags']['language'] if 'tags' in audio and 'language' in audio['tags'] else 'und' - info.audio_bitrate = over.core.textui.Unit(audio['bit_rate'], 'b/s') if 'bit_rate' in audio else '§r??§/' + info.audio_bitrate = over.core.text.Unit(audio['bit_rate'], 'b/s') if 'bit_rate' in audio else '§r??§/' except: - _print('exception while reading identify_dict, dump follows', prefix.fail) + main.print('exception while reading identify_dict, dump follows', prefix.fail) print(identify_dict) raise # TODO wordify :-) - _print('§mvideo§/: size=§b%d§/x§b%d§/ px, framerate=%s, codec=%s, bitrate=%s' %(info.video_size_x, info.video_size_y, info.video_fps, info.video_codec, info.video_bitrate)) + main.print('§mvideo§/: size=§b%d§/x§b%d§/ px, framerate=%s, codec=%s, bitrate=%s' %(info.video_size_x, info.video_size_y, info.video_fps, info.video_codec, info.video_bitrate)) if audio_streams: - _print('§caudio§/: channels=§b%d§/, samplerate=%s, codec=%s, bitrate=%s, language=%s' %(info.audio_channels, info.audio_samplerate, info.audio_codec, info.audio_bitrate, info.audio_language)) + main.print('§caudio§/: channels=§b%d§/, samplerate=%s, codec=%s, bitrate=%s, language=%s' %(info.audio_channels, info.audio_samplerate, info.audio_codec, info.audio_bitrate, info.audio_language)) else: - _print('§caudio§/: §yNone§/', prefix.warn) + main.print('§caudio§/: §yNone§/', prefix.warn) # -------------------------------------------------- # normalization pre-pass if audio_streams and main.cfg.normalize and (main.cfg.armed or main.cfg.dump_commands) and (not main.cfg.audio == 'drop'): if main.cfg.normalize_override == 0.0: - _print('running normalization pre-pass') + main.print('running normalization pre-pass') command.normalize_prepass.reset() command.normalize_prepass.INFILE = 'file:' + str(files.infile) command.normalize_prepass.run(stderr=True) - pb = over.core.textui.ProgressBar(60, int(info.video_fps.value * info.duration), 'frames') + pb = over.core.text.ProgressBar(60, int(info.video_fps.value * info.duration), 'frames') output_buffer = [] @@ -218,16 +214,16 @@ if __name__ == '__main__': info.mean_volume = float(re.findall(b'mean_volume: (-\d+\.\d+) dB', output)[0]) info.volume_correction = main.cfg.normalize_target - info.mean_volume else: - _print('§runexpected ffmpeg output§/, dump follows', prefix.fail, suffix=':\n') + main.print('§runexpected ffmpeg output§/, dump follows', prefix.fail, suffix=':\n') print(output.decode('utf-8')) raise RuntimeError pb.blank() - _print('detected volume %.1f dB, correction %.1f dB' %(info.mean_volume, info.volume_correction)) + main.print('detected volume %.1f dB, correction %.1f dB' %(info.mean_volume, info.volume_correction)) else: info.volume_correction = main.cfg.normalize_override - _print('using user-supplied volume correction §m%.1f dB§/' %(info.volume_correction)) + main.print('using user-supplied volume correction §m%.1f dB§/' %(info.volume_correction)) info.normalize_command = command.sub_normalize info.normalize_command.reset() @@ -292,14 +288,14 @@ if __name__ == '__main__': cmd = ' '.join(encode_cmd.dump(pretty=True)) if main.cfg.armed: - _print('executing §B%s§/' %(cmd), prefix.start) + main.print('executing §B%s§/' %(cmd), prefix.start) else: - _print('will execute §B%s§/' %(cmd)) + main.print('will execute §B%s§/' %(cmd)) else: - _print('will encode into §B%s§/' %(files.tmpfile)) + main.print('will encode into §B%s§/' %(files.tmpfile)) if main.cfg.armed: - pb = over.core.textui.ProgressBar(60, int(info.video_fps.value * info.duration), 'frames') + pb = over.core.text.ProgressBar(60, int(info.video_fps.value * info.duration), 'frames') encode_cmd.run(stderr=True) @@ -316,15 +312,15 @@ if __name__ == '__main__': elif out is None: break - original_filesize = over.core.textui.Unit(files.infile.stat().st_size, 'B') - new_filesize = over.core.textui.Unit(files.tmpfile.stat().st_size, 'B') + original_filesize = over.core.text.Unit(files.infile.stat().st_size, 'B') + new_filesize = over.core.text.Unit(files.tmpfile.stat().st_size, 'B') pb.blank() if encode_cmd.returncode == 0: - _print('encoding finished: %s -> %s' %(original_filesize, new_filesize), prefix.done) + main.print('encoding finished: %s -> %s' %(original_filesize, new_filesize), prefix.done) else: - _print('§rencoding failed§/, ffmpeg returned §y%d§/' %(encode_cmd.returncode), prefix.fail) + main.print('§rencoding failed§/, ffmpeg returned §y%d§/' %(encode_cmd.returncode), prefix.fail) raise RuntimeError # -------------------------------------------------- @@ -335,20 +331,20 @@ if __name__ == '__main__': if not move_to_dir.is_dir(): if main.cfg.armed: - _print('creating directory §B%s§/' %(move_to_dir), prefix.start) + main.print('creating directory §B%s§/' %(move_to_dir), prefix.start) move_to_dir.mkdir() else: - _print('will create directory §B%s§/' %(move_to_dir)) + main.print('will create directory §B%s§/' %(move_to_dir)) if files.move_infile_to: if main.cfg.armed: - _print('moving §B%s§/ -> §B%s§/' %(files.infile, files.move_infile_to), prefix.start) + main.print('moving §B%s§/ -> §B%s§/' %(files.infile, files.move_infile_to), prefix.start) files.infile.rename(files.move_infile_to) else: - _print('will move §B%s§/ -> §B%s§/' %(files.infile, files.move_infile_to)) + main.print('will move §B%s§/ -> §B%s§/' %(files.infile, files.move_infile_to)) if main.cfg.armed: - _print('moving §B%s§/ -> §B%s§/' %(files.tmpfile, files.outfile), prefix.start) + main.print('moving §B%s§/ -> §B%s§/' %(files.tmpfile, files.outfile), prefix.start) files.tmpfile.rename(files.outfile) else: - _print('will move §B%s§/ -> §B%s§/' %(files.tmpfile, files.outfile)) + main.print('will move §B%s§/ -> §B%s§/' %(files.tmpfile, files.outfile)) diff --git a/version.py b/version.py index 91b177c..519a9af 100644 --- a/version.py +++ b/version.py @@ -1,4 +1,8 @@ -#! /bin/env python3 +#! /usr/bin/env python3 # encoding: utf-8 _version = (0, '00000000') # OVER_VERSION_IDENTIFIER + +rev = _version[0] +commit = _version[1] +str = '%d (%s)' %_version