diff --git a/src/devede/executor.py b/src/devede/executor.py
index a10e07e..651bf58 100644
--- a/src/devede/executor.py
+++ b/src/devede/executor.py
@@ -52,7 +52,6 @@ class executor(GObject.GObject):
self.handle = None
-
def add_dependency(self, dep):
self.add_dependency2(dep)
@@ -73,6 +72,7 @@ class executor(GObject.GObject):
for child in self.childs:
child.add_dependency(dep)
+
def remove_dependency(self,process):
# dependencies are removed only in the parent because the running class have all the processes, parents and childs, and calls
# this method on all of them
@@ -86,6 +86,7 @@ class executor(GObject.GObject):
else:
self.dependencies = None
+
def add_child_process(self,child):
# the childs have the same dependencies than the parent process because, from outside, it is viewed as a single process
@@ -96,16 +97,23 @@ class executor(GObject.GObject):
if (self.childs.count(child) == 0):
self.childs.append(child)
+
def run(self, progress_bar):
self.progress_bar = progress_bar
self.progress_bar[0].set_label(self.text)
self.progress_bar[1].set_fraction(0.0)
self.progress_bar[0].show_all()
+ # call, if it exists, the pre-function
+ try:
+ self.pre_function()
+ except:
+ pass
self.launch_process(self.command_var)
if self.use_pulse_mode != self.pulse_mode:
self.set_pulse_mode(self.use_pulse_mode)
+
def remove_ansi(self,line):
output=""
@@ -221,6 +229,7 @@ class executor(GObject.GObject):
self.file_out.write(line_data)
return True
+
def read_stdin_from_file(self,source,condition):
line_data = self.file_in.read1(4096)
@@ -265,7 +274,7 @@ class executor(GObject.GObject):
if (condition != GLib.IO_IN):
self.channel_stderr = None
- if ((self.channel_stdout == None) and (self.channel_stdin == None)):
+ if (((self.channel_stdout == None) or (self.stdout_file != None)) and ((self.channel_stdin == None) or (self.stdin_file != None))):
self.wait_end()
return False
else:
@@ -286,6 +295,7 @@ class executor(GObject.GObject):
self.process_stderr(final_data)
return True
+
def cancel(self):
""" Called to kill this process. """
@@ -306,6 +316,12 @@ class executor(GObject.GObject):
self.set_pulse_mode(False)
+ # call, if it exists, the post-function
+ try:
+ self.post_function(retval,self.killed)
+ except:
+ pass
+
if self.killed:
retval = 0
else:
diff --git a/src/devede/file_movie.py b/src/devede/file_movie.py
index e45bc8c..0361f75 100644
--- a/src/devede/file_movie.py
+++ b/src/devede/file_movie.py
@@ -24,7 +24,6 @@ import devede.converter
import devede.ask_subtitles
import devede.preview
import devede.file_copy
-import devede.rename_file
import devede.subtitles_mux
class file_movie(devede.interface_manager.interface_manager):
@@ -405,7 +404,7 @@ class file_movie(devede.interface_manager.interface_manager):
self.wtreview_subtitles = self.builder.get_object("treeview_subtitles")
self.wdel_subtitles = self.builder.get_object("del_subtitles")
- selection = self.wsubtitles_list.get_selection()
+ selection = self.wtreview_subtitles.get_selection()
selection.set_mode(Gtk.SelectionMode.BROWSE)
# elements in page VIDEO OPTIONS
@@ -578,11 +577,8 @@ class file_movie(devede.interface_manager.interface_manager):
duration2 = self.original_length
else:
duration2 = duration
+ stream_id = 0
for subt in self.subtitles_list:
- renamer = devede.rename_file.rename_file()
- renamer.rename(output_path, output_path+".tmp")
- renamer.add_dependency(last_process)
- converter.add_child_process(renamer)
subt_file = subt[0]
subt_codepage = subt[1]
subt_lang = subt[2]
@@ -592,11 +588,13 @@ class file_movie(devede.interface_manager.interface_manager):
else:
final_aspect = "4:3"
subt_mux = devede.subtitles_mux.subtitles_mux()
- subt_mux.multiplex_subtitles( output_path+".tmp", output_path, subt_file, subt_codepage, subt_lang, subt_upper,
- self.subt_font_size,self.format_pal,self.force_subtitles, final_aspect, duration2)
- subt_mux.add_dependency(renamer)
+ subt_mux.multiplex_subtitles( output_path, subt_file, subt_codepage, subt_lang, subt_upper,
+ self.subt_font_size,self.format_pal,self.force_subtitles,
+ final_aspect, duration2, stream_id)
+ subt_mux.add_dependency(last_process)
converter.add_child_process(subt_mux)
last_process = subt_mux
+ stream_id += 1
return converter
diff --git a/src/devede/rename_file.py b/src/devede/rename_file.py
deleted file mode 100644
index 1ca1ca0..0000000
--- a/src/devede/rename_file.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/env python3
-
-# Copyright 2014 (C) Raster Software Vigo (Sergio Costas)
-#
-# This file is part of DeVeDe-NG
-#
-# DeVeDe-NG is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# DeVeDe-NG is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see
-
-import os
-import devede.configuration_data
-import devede.executor
-
-class rename_file(devede.executor.executor):
-
- def __init__(self):
-
- devede.executor.executor.__init__(self)
- self.config = devede.configuration_data.configuration.get_config()
-
- def rename(self,file_path_input, file_path_output):
-
- self.text = _("Renaming %(L)s to %(X)s") % {"X": os.path.basename(file_path_output), "L": os.path.basename(file_path_input)}
-
- self.command_var=[]
- self.command_var.append("mv")
- self.command_var.append("-f")
- self.command_var.append(file_path_input)
- self.command_var.append(file_path_output)
- self.use_pulse_mode = True
-
- def process_stdout(self,data):
-
- return
-
- def process_stderr(self,data):
-
- return
\ No newline at end of file
diff --git a/src/devede/subtitles_mux.py b/src/devede/subtitles_mux.py
index 9e0623b..a2ecbed 100644
--- a/src/devede/subtitles_mux.py
+++ b/src/devede/subtitles_mux.py
@@ -18,6 +18,8 @@
# along with this program. If not, see
import os
+import subprocess
+
import devede.configuration_data
import devede.executor
@@ -28,13 +30,14 @@ class subtitles_mux(devede.executor.executor):
devede.executor.executor.__init__(self)
self.config = devede.configuration_data.configuration.get_config()
- def multiplex_subtitles(self,file_path_input, file_path_output, subtitles_path,subt_codepage, subt_lang,
- subt_upper,font_size, pal, force_subtitles, aspect, duration):
+ def multiplex_subtitles(self, file_path, subtitles_path,subt_codepage, subt_lang,
+ subt_upper,font_size, pal, force_subtitles, aspect, duration, stream_id):
+ self.subt_path = file_path
self.duration = duration
- self.text = _("Adding %(L)s subtitles to %(X)s") % {"X": os.path.basename(file_path_output), "L": subt_lang}
+ self.text = _("Adding %(L)s subtitles to %(X)s") % {"X": os.path.basename(file_path), "L": subt_lang}
- out_xml = open(file_path_input+".xml","w")
+ out_xml = open(file_path+".xml","w")
out_xml.write('