Now the avconv converter checks which disc types supports
Fixed a bug in the converter class: now really returns the desired film converter
This commit is contained in:
parent
8773cebfda
commit
a42d8161f5
3 changed files with 71 additions and 7 deletions
|
|
@ -31,14 +31,67 @@ class avconv_converter(devede.executor.executor):
|
||||||
supports_menu = True
|
supports_menu = True
|
||||||
supports_burn = False
|
supports_burn = False
|
||||||
display_name = "AVCONV"
|
display_name = "AVCONV"
|
||||||
disc_types = ["dvd","vcd","svcd","cvd","divx","mkv"]
|
disc_types = []
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def check_is_installed():
|
def check_is_installed():
|
||||||
try:
|
try:
|
||||||
handle = subprocess.Popen(["avconv","-version"], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
|
handle = subprocess.Popen(["avconv","-codecs"], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
|
||||||
(stdout, stderr) = handle.communicate()
|
(stdout, stderr) = handle.communicate()
|
||||||
if 0==handle.wait():
|
if 0==handle.wait():
|
||||||
|
mp2 = False
|
||||||
|
mp3 = False
|
||||||
|
ac3 = False
|
||||||
|
mpeg1 = False
|
||||||
|
mpeg2 = False
|
||||||
|
divx = False
|
||||||
|
h264 = False
|
||||||
|
for line in stdout.decode("latin-1").split("\n"):
|
||||||
|
parts = line.split(" ")
|
||||||
|
if len(parts) < 2:
|
||||||
|
continue
|
||||||
|
if len(parts[0]) != 6:
|
||||||
|
continue
|
||||||
|
capabilities = parts[0]
|
||||||
|
codec = parts[1]
|
||||||
|
|
||||||
|
if capabilities[1] != 'E':
|
||||||
|
continue
|
||||||
|
|
||||||
|
if (codec == "mpeg1video"):
|
||||||
|
mpeg1 = True
|
||||||
|
continue
|
||||||
|
if (codec == "mpeg2video"):
|
||||||
|
mpeg2 = True
|
||||||
|
continue
|
||||||
|
if (codec == "mp2"):
|
||||||
|
mp2 = True
|
||||||
|
continue
|
||||||
|
if (codec == "mp3"):
|
||||||
|
mp3 = True
|
||||||
|
continue
|
||||||
|
if (codec == "ac3"):
|
||||||
|
ac3 = True
|
||||||
|
continue
|
||||||
|
if (codec == "h264") or (codec == "H264"):
|
||||||
|
h264 = True
|
||||||
|
continue
|
||||||
|
if (codec == "mpeg4"):
|
||||||
|
divx = True
|
||||||
|
continue
|
||||||
|
|
||||||
|
if (mpeg1 and mp2):
|
||||||
|
devede.avconv_converter.avconv_converter.disc_types.append("vcd")
|
||||||
|
if (mpeg2 and mp2):
|
||||||
|
devede.avconv_converter.avconv_converter.disc_types.append("svcd")
|
||||||
|
devede.avconv_converter.avconv_converter.disc_types.append("cvd")
|
||||||
|
if (mpeg2 and mp2 and ac3):
|
||||||
|
devede.avconv_converter.avconv_converter.disc_types.append("dvd")
|
||||||
|
if (divx and mp3):
|
||||||
|
devede.avconv_converter.avconv_converter.disc_types.append("divx")
|
||||||
|
if (h264 and mp3):
|
||||||
|
devede.avconv_converter.avconv_converter.disc_types.append("mkv")
|
||||||
|
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@ class converter:
|
||||||
def get_menu_converter(self):
|
def get_menu_converter(self):
|
||||||
""" returns a class for the desired menu converter, or the most priviledged if the desired is not installed """
|
""" returns a class for the desired menu converter, or the most priviledged if the desired is not installed """
|
||||||
|
|
||||||
if (self.config.menu_converter == None) or (self.config.menu_converter not in self.analizers):
|
if (self.config.menu_converter == None) or (self.config.menu_converter not in self.menuers):
|
||||||
return self.default_menuer
|
return self.default_menuer
|
||||||
else:
|
else:
|
||||||
return self.menuers[self.config.menu_converter]
|
return self.menuers[self.config.menu_converter]
|
||||||
|
|
@ -172,10 +172,18 @@ class converter:
|
||||||
def get_disc_converter(self):
|
def get_disc_converter(self):
|
||||||
""" returns a class for the desired disc converter, or the most priviledged if the desired is not installed """
|
""" returns a class for the desired disc converter, or the most priviledged if the desired is not installed """
|
||||||
|
|
||||||
if (self.config.film_converter == None) or (self.config.film_converter not in self.analizers):
|
# if there is a film converter chosen by the user, and it is installed in the system
|
||||||
return self.default_converter
|
if (self.config.film_converter != None) and (self.config.film_converter in self.converters):
|
||||||
else:
|
# and that converter supports the current disc type
|
||||||
return self.converters[self.config.film_converter]
|
if self.converters[self.config.film_converter].disc_types.count(self.config.disc_type) != 0:
|
||||||
|
# return that converter
|
||||||
|
return self.converters[self.config.film_converter]
|
||||||
|
# if not, return the first available converter that supports the current disc type
|
||||||
|
for converter in self.converters:
|
||||||
|
if converter.disc_types.count(self.config.disc_type) != 0:
|
||||||
|
return converter
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def get_burner(self):
|
def get_burner(self):
|
||||||
""" returns a class for the desired burner, or the most priviledged if the desired is not installed """
|
""" returns a class for the desired burner, or the most priviledged if the desired is not installed """
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ from gi.repository import Gtk
|
||||||
import devede.project
|
import devede.project
|
||||||
import devede.configuration_data
|
import devede.configuration_data
|
||||||
import devede.choose_disc_type
|
import devede.choose_disc_type
|
||||||
|
import devede.converter
|
||||||
|
|
||||||
config_data = devede.configuration_data.configuration.get_config()
|
config_data = devede.configuration_data.configuration.get_config()
|
||||||
|
|
||||||
|
|
@ -46,5 +47,7 @@ Gtk.init(sys.argv)
|
||||||
|
|
||||||
mwindow = devede.project.devede_project()
|
mwindow = devede.project.devede_project()
|
||||||
ask_type = devede.choose_disc_type.choose_disc_type()
|
ask_type = devede.choose_disc_type.choose_disc_type()
|
||||||
|
# this allows to check the availability of all the programs needed for Devede
|
||||||
|
devede.converter.converter.get_converter()
|
||||||
Gtk.main()
|
Gtk.main()
|
||||||
config_data.save_config()
|
config_data.save_config()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue