xconv: [h1] Import changes

master
Taeyeon Mori 7 years ago
parent b1e7f0ba03
commit 07504093e0
  1. 2
      lib/python/xconv/__init__.py
  2. 16
      lib/python/xconv/app.py
  3. 1
      lib/python/xconv/profile.py
  4. 2
      lib/python/xconv/profiles/getsubs.py

@ -23,4 +23,4 @@ xconv ffmpeg wrapper based on AdvancedAV
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
""" """
version_info = 0, 3, 1 version_info = 0, 3, 2

@ -47,13 +47,15 @@ class OutputFile(advancedav.OutputFile):
self.name = splitext(self.name)[0] + "." + ext self.name = splitext(self.name)[0] + "." + ext
class SimpleTask(advancedav.SimpleTask): class XconvMixin:
output_factory = OutputFile output_factory = OutputFile
class AdvancedTask(advancedav.Task): class SimpleTask(XconvMixin, advancedav.SimpleTask):
output_factory = OutputFile pass
class AdvancedTask(XconvMixin, advancedav.Task):
def __init__(self, aav, output_prefix): def __init__(self, aav, output_prefix):
self.output_prefix = output_prefix self.output_prefix = output_prefix
self.output_directory = dirname(output_prefix) self.output_directory = dirname(output_prefix)
@ -215,12 +217,12 @@ def main(argv):
if args.update: if args.update:
for task in tasks[:]: for task in tasks[:]:
for output in [o for o in task.outputs if exists(o.name)]: for output in [o for o in task.outputs if exists(o.filename)]:
print("\033[33m Skipping existing '%s' (--update)\033[0m\033[K" % basename(skip.name)) print("\033[33m Skipping existing '%s' (--update)\033[0m\033[K" % output.name)
task.outputs.remove(skip) task.outputs.remove(output)
if not tasks.outputs: if not tasks.outputs:
print("\033[33m Skipping task '%s' because no output files are left\033[0m\033[K" % task_name(task)) print("\033[33m Skipping task '%s' because no output files are left\033[0m\033[K" % task_name(task))
tasks.remove[task] tasks.remove(task)
print("\033[35mExecuting Tasks..\033[0m\033[K") print("\033[35mExecuting Tasks..\033[0m\033[K")

@ -97,6 +97,7 @@ def features(**features):
- argshax: Pass parsed cmdline arguments in 'args' kwd - argshax: Pass parsed cmdline arguments in 'args' kwd
- singleaudio: Indicates that it operates on a single audio stream. No effects - singleaudio: Indicates that it operates on a single audio stream. No effects
- no_single_output: Profile doesn't constitute a 1:1 file conversion. Don't use SimpleTask - no_single_output: Profile doesn't constitute a 1:1 file conversion. Don't use SimpleTask
- skip_existing_output: omit any outputs that already exist. (i.e. always --update)
- advanced_task: reserved - advanced_task: reserved
""" """
def apply(f): def apply(f):

@ -34,7 +34,7 @@ from ..profile import *
@features(no_single_output=True) @features(no_single_output=True)
def getsubs(task, defines): def getsubs(task, defines):
for stream in task.iter_subtitle_streams(): for stream in task.iter_subtitle_streams():
of = task.add_output("%s.%s.%s" % (task.output_prefix, task.inputs.index(stream.file), stream.stream_spec), None) # TODO get real file extension of = task.add_output("%s.%s.%s.%s" % (task.output_prefix, task.inputs.index(stream.file), stream.pertype_index, stream.codec), None) # TODO get real file extension
os = of.map_stream(stream) os = of.map_stream(stream)
if "format" in defines: if "format" in defines:
os.codec = defines["format"] os.codec = defines["format"]

Loading…
Cancel
Save