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_burn = False
|
||||
display_name = "AVCONV"
|
||||
disc_types = ["dvd","vcd","svcd","cvd","divx","mkv"]
|
||||
disc_types = []
|
||||
|
||||
@staticmethod
|
||||
def check_is_installed():
|
||||
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()
|
||||
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
|
||||
else:
|
||||
return False
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ class converter:
|
|||
def get_menu_converter(self):
|
||||
""" 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
|
||||
else:
|
||||
return self.menuers[self.config.menu_converter]
|
||||
|
|
@ -172,10 +172,18 @@ class converter:
|
|||
def get_disc_converter(self):
|
||||
""" 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):
|
||||
return self.default_converter
|
||||
else:
|
||||
return self.converters[self.config.film_converter]
|
||||
# if there is a film converter chosen by the user, and it is installed in the system
|
||||
if (self.config.film_converter != None) and (self.config.film_converter in self.converters):
|
||||
# and that converter supports the current disc type
|
||||
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):
|
||||
""" returns a class for the desired burner, or the most priviledged if the desired is not installed """
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue