From 7f24e891eca5d9d0f7f16bdf6c91e023cc93040b Mon Sep 17 00:00:00 2001 From: Sergio Costas Date: Fri, 8 Aug 2014 17:42:26 +0200 Subject: [PATCH] Now shows a default value for preview duration Fixed progress bar for subtitle creation Allows to choose the subtitle colors --- README.md | 9 ++- data/interface/wfile_properties.ui | 93 ++++++++++++++++++++++++++++++ data/interface/wpreview.ui | 1 + src/devede/configuration_data.py | 15 +++++ src/devede/file_movie.py | 21 +++++-- src/devede/subtitles_mux.py | 14 ++++- 6 files changed, 142 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index ef643f7..2dfb94a 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ The current visible changes are quite small in number: * Allows to use VLC or MPlayer for preview * Allows to choose between Brasero or K3B for burning the discs * Allows to set properties for several files in one step - +* Allow to choose the subtitle colors ## THINGS TO DO ## @@ -42,12 +42,15 @@ Some of the future ideas to add to Devede NG are, without an specific order: * allow to replace the movie's audio track with one or several MP3 or OGG audio files * widescreen menus for DVDs * choose between MP2 and AC3 audio for menus -* allow to choose the subtitle colors +* preview of a converted menu ## History of versions ## * version in GIT - * allow to set properties for several files in one step + * Now shows a default value for preview duration + * Fixed progress bar for subtitle creation + * Allows to choose the subtitle colors + * Allows to set properties for several files in one step * Fixed bug whe setting PAL or NTSC toggle in file properties * Added two-pass conversion * Now detects separately MKISOFS and GENISOIMAGE, allowing to have only one of them installed in the system diff --git a/data/interface/wfile_properties.ui b/data/interface/wfile_properties.ui index f3a3f1a..6ded7f4 100644 --- a/data/interface/wfile_properties.ui +++ b/data/interface/wfile_properties.ui @@ -37,6 +37,12 @@ 1 10 + + 30 + 3 + 1 + 10 + @@ -1067,6 +1073,93 @@ 1 + + + True + False + + + True + False + Fill color: + + + False + True + 0 + + + + + True + True + True + + + False + True + 1 + + + + + True + False + 8 + Outline color: + + + False + True + 2 + + + + + True + True + True + + + False + True + 3 + + + + + True + False + 8 + Outline thickness: + + + False + True + 4 + + + + + True + True + subt_thickness + 1 + 3 + + + False + True + 5 + + + + + False + True + 2 + + 1 diff --git a/data/interface/wpreview.ui b/data/interface/wpreview.ui index b2a636a..8451764 100644 --- a/data/interface/wpreview.ui +++ b/data/interface/wpreview.ui @@ -100,6 +100,7 @@ Devede will create a preview with the selected parameters, so you will be able t True True length + 60 True diff --git a/src/devede/configuration_data.py b/src/devede/configuration_data.py index 8419feb..5c06736 100644 --- a/src/devede/configuration_data.py +++ b/src/devede/configuration_data.py @@ -98,6 +98,9 @@ class configuration(GObject.GObject): self.sub_codepage = None self.burner = None self.mkiso = None + self.subt_fill_color = (1,1,1,1) + self.subt_outline_color = (0,0,0,1) + self.subt_outline_thickness = 0.0 config_path = os.path.join(os.environ.get("HOME"),".devede") try: @@ -150,6 +153,14 @@ class configuration(GObject.GObject): if linea[:19]=="subtitle_font_size:": self.subtitles_font_size = int(linea[19:].strip()) continue + if linea[:20] == "subtitle_fill_color:": + c = linea[20:].strip().split(",") + self.subt_fill_color = (float(c[0]), float(c[1]), float(c[2]), 1.0) + if linea[:23] == "subtitle_outline_color:": + c = linea[23:].strip().split(",") + self.subt_outline_color = (float(c[0]), float(c[1]), float(c[2]), 1.0) + if linea[:27] == "subtitle_outilne_thickness:": + self.subt_outline_thickness = float(linea[27:].strip()) config_data.close() except: pass @@ -199,6 +210,10 @@ class configuration(GObject.GObject): if (self.sub_language != None): config_data.write("sub_language:"+str(self.sub_language)+"\n") config_data.write("subtitle_font_size:"+str(self.subtitles_font_size)+"\n") + config_data.write("subtitle_fill_color:"+str(self.subt_fill_color[0])+","+str(self.subt_fill_color[1])+","+str(self.subt_fill_color[2])+"\n") + config_data.write("subtitle_outline_color:"+str(self.subt_outline_color[0])+","+str(self.subt_outline_color[1])+","+str(self.subt_outline_color[2])+"\n") + config_data.write("subtitle_outilne_thickness:"+str(self.subt_outline_thickness)) + config_data.close() except: pass diff --git a/src/devede/file_movie.py b/src/devede/file_movie.py index 6610b05..447b101 100644 --- a/src/devede/file_movie.py +++ b/src/devede/file_movie.py @@ -94,6 +94,10 @@ class file_movie(devede.interface_manager.interface_manager): self.add_float_adjustment("audio_delay", 0.0) self.add_integer_adjustment("chapter_size", 5) + self.add_colorbutton("subt_fill_color", self.config.subt_fill_color) + self.add_colorbutton("subt_outline_color", self.config.subt_outline_color) + self.add_float_adjustment("subt_thickness", self.config.subt_outline_thickness) + if list_files == None: self.add_list("subtitles_list") else: @@ -558,11 +562,16 @@ class file_movie(devede.interface_manager.interface_manager): def on_button_accept_clicked(self,b): self.store_ui(self.builder) + self.config.subt_fill_color = self.subt_fill_color + self.config.subt_outline_color = self.subt_outline_color + self.config.subt_outline_thickness = self.subt_thickness if self.list_files == None: + # editing file properties self.set_final_rates() self.set_final_size_aspect() self.emit('title_changed',self.title_name) else: + # editing properties for a group of files data = self.store_file() sel = self.wtreeview_multiproperties.get_selection() model, pathlist = sel.get_selected_rows() @@ -635,10 +644,11 @@ class file_movie(devede.interface_manager.interface_manager): if len(self.subtitles_list) != 0: last_process = converter - if duration == 0: - duration2 = self.original_length - else: - duration2 = duration + #if duration == 0: + # it seems that SPUMUX always fills the entire subtitles + duration2 = self.original_length + #else: + # duration2 = duration stream_id = 0 for subt in self.subtitles_list: subt_file = subt[0] @@ -652,7 +662,8 @@ class file_movie(devede.interface_manager.interface_manager): subt_mux = devede.subtitles_mux.subtitles_mux() 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) + final_aspect, duration2, stream_id, + self.subt_fill_color, self.subt_outline_color, self.subt_thickness) subt_mux.add_dependency(last_process) converter.add_child_process(subt_mux) last_process = subt_mux diff --git a/src/devede/subtitles_mux.py b/src/devede/subtitles_mux.py index a2ecbed..25a4c44 100644 --- a/src/devede/subtitles_mux.py +++ b/src/devede/subtitles_mux.py @@ -30,8 +30,13 @@ 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, subtitles_path,subt_codepage, subt_lang, - subt_upper,font_size, pal, force_subtitles, aspect, duration, stream_id): + def multiplex_subtitles(self, file_path, subtitles_path, subt_codepage, subt_lang, + subt_upper, font_size, pal, force_subtitles, aspect, duration, stream_id, fill_color, outline_color, outline_thick): + + if len(fill_color) == 4: + fill_color = fill_color[:3] + if len(outline_color) == 4: + outline_color = outline_color[:3] self.subt_path = file_path self.duration = duration @@ -53,7 +58,10 @@ class subtitles_mux(devede.executor.executor): out_xml.write(str(font_size)) if subt_upper: out_xml.write('" bottom-margin="50') - out_xml.write('" font="arial" horizontal-alignment="center" vertical-alignment="bottom" aspect="') + out_xml.write('" fill-color="#%02X%02X%02X"' % fill_color) + out_xml.write(' outline-color="#%02X%02X%02X"' % outline_color) + out_xml.write(' outline-thickness="%d"' % outline_thick) + out_xml.write(' font="arial" horizontal-alignment="center" vertical-alignment="bottom" aspect="') out_xml.write(str(aspect)) out_xml.write('" force="') if force_subtitles: