This commit is contained in:
Sergio Costas 2015-06-30 01:09:34 +02:00
commit 1dcaa6f6c0
4 changed files with 156 additions and 48 deletions

View file

@ -47,6 +47,7 @@ class dvd_menu(devedeng.interface_manager.interface_manager):
self.add_group("position_horizontal", ["left", "center", "right"], "center", self.update_preview)
self.add_group("at_startup", ["menu_show_at_startup", "play_first_title_at_startup"], "menu_show_at_startup")
self.add_group("play_all", ["menu_play_all", "menu_no_play_all"], "menu_no_play_all", self.update_preview)
self.add_integer_adjustment("sound_length", 30)
@ -373,6 +374,8 @@ class dvd_menu(devedeng.interface_manager.interface_manager):
entry_height = self.cached_menu_size + self.entry_vertical_margin * 2.0 + self.entry_separation
entries_per_page = int((self.y - top_margin_p - bottom_margin_p) / entry_height)
if (self.play_all == "menu_play_all"):
entries_per_page -= 1
n_entries = len(self.title_list)
if (n_entries > entries_per_page):
paint_arrows = True
@ -392,6 +395,18 @@ class dvd_menu(devedeng.interface_manager.interface_manager):
xr = 720.0 - right_margin_p
y = top_margin_p + entry_height/2.0
height = (self.cached_menu_size + self.entry_vertical_margin) / 2.0
if (self.play_all == "menu_play_all"):
coordinates.append([xl, y-height, xr, y+height, "play_all"])
if paint_background:
self.paint_base(xl, xr, y, 0)
self.write_text("Play All", "menu_entry", xl, xr, y, self.position_horizontal)
if paint_selected:
self.write_text("Play All", "menu_entry_selected", xl, xr, y, self.position_horizontal)
if paint_activated:
self.write_text("Play All", "menu_entry_activated", xl, xr, y, self.position_horizontal)
y += entry_height
for entry in self.title_list[page_number*entries_per_page:(page_number+1)*entries_per_page]:
coordinates.append([xl, y-height, xr, y+height, "entry"])
text = entry[0].title_name

View file

@ -29,7 +29,7 @@ class dvdauthor_converter(devedeng.executor.executor):
self.config = devedeng.configuration_data.configuration.get_config()
def create_dvd_project (self, path, name, file_movies, menu_entries, start_with_menu):
def create_dvd_project (self, path, name, file_movies, menu_entries, start_with_menu, play_all_opt):
movie_path = os.path.join(path,"dvd_tree")
try:
@ -37,7 +37,7 @@ class dvdauthor_converter(devedeng.executor.executor):
except:
pass
xml_file = self.create_dvdauthor_xml(path, file_movies, menu_entries, start_with_menu)
xml_file = self.create_dvdauthor_xml(path, file_movies, menu_entries, start_with_menu, play_all_opt)
self.command_var=[]
self.command_var.append("dvdauthor")
@ -59,7 +59,7 @@ class dvdauthor_converter(devedeng.executor.executor):
return
def create_dvdauthor_xml(self,movie_folder, file_movies, menu_entries, start_with_menu):
def create_dvdauthor_xml(self,movie_folder, file_movies, menu_entries, start_with_menu, play_all_opt):
xmlpath = os.path.join(movie_folder,"xml_data")
xml_file_path = os.path.join(xmlpath,"dvdauthor.xml")
@ -94,11 +94,17 @@ class dvdauthor_converter(devedeng.executor.executor):
xml_file.write('\t\t<fpc>\n')
xml_file.write('\t\t\tg0=100;\n')
xml_file.write('\t\t\tg1=') #goto variable
if (menu_entries != None) and (start_with_menu):
xml_file.write('\t\t\tg1=0;\n')
xml_file.write('0;\n') #show menu
else:
xml_file.write('\t\t\tg1=100;\n')
xml_file.write('\t\t\tg2=1024;\n')
xml_file.write('100;\n') #auto play
xml_file.write('\t\t\tg2=1024;\n') #highlight?
xml_file.write('\t\t\tg3=') #play all variable
if play_all_opt and (menu_entries != None) and (start_with_menu):
xml_file.write('1;\n') #auto play all
else:
xml_file.write('0;\n') #do not play all
xml_file.write('\t\t\tjump menu 1;\n')
xml_file.write('\t\t</fpc>\n')
@ -173,8 +179,8 @@ class dvdauthor_converter(devedeng.executor.executor):
for menu_page in menu_entries:
xml_file.write('\t\t\t<pgc>\n')
xml_file.write('\t\t\t\t<pre>\n')
# first we recover the currently selected button
xml_file.write('\t\t\t\t\ts8=g2;\n')
xml_file.write('\t\t\t\t\ts8=g2;\n') # first we recover the currently selected button
xml_file.write('\t\t\t\t\tg3=0;\n') #turnoff play all
if first_entry: # here we add some code to jump to each menu
for menu2 in range(nmenues-1):
@ -195,8 +201,15 @@ class dvdauthor_converter(devedeng.executor.executor):
xml_file.write('"></vob>\n')
for nbutton in menu_page["chapters"]:
xml_file.write('\t\t\t\t<button name="'+nbutton+'"> g0='+str(title_list[button_counter])+'; jump vmgm menu; </button>\n')
button_counter+=1
#xml_file.write('\t\t\t\t<button name="'+nbutton+'"> g0='+str(title_list[button_counter])+'; jump vmgm menu; </button>\n')
xml_file.write('\t\t\t\t<button name="'+nbutton+'">\n')
xml_file.write('\t\t\t\t\tg0='+str(title_list[button_counter])+';\n')
if play_all_opt and nbutton == "boton0x0":
xml_file.write('\t\t\t\t\tg3=1;\n')
xml_file.write('\t\t\t\t\tjump vmgm menu;\n')
xml_file.write('\t\t\t\t</button>\n')
if not play_all_opt:
button_counter+=1
if (menu_page["left"] != None):
xml_file.write('\t\t\t\t<button name="'+menu_page["left"]+'"> g1=')
@ -384,32 +397,42 @@ class dvdauthor_converter(devedeng.executor.executor):
xml_file.write('\t\t\t\t<post>\n')
files+=1
xml_file.write('\t\t\t\t\tg1='+str(int(titles/elements_per_menu))+';\n')
if (action=="action_stop"):
xml_file.write('\t\t\t\t\tg0=100;\n')
xml_file.write('\t\t\t\t\tcall vmgm menu entry title;\n')
else:
xml_file.write('\t\t\t\t\tg0=')
if action=="action_play_previous":
if titles == 0:
prev_t = total_t - 1
else:
prev_t = titles - 1
xml_file.write(str(prev_t + 1))
elif action=="action_play_again":
xml_file.write(str(titles + 1))
elif action=="action_play_next":
if titles==total_t-1:
next_t=0
else:
next_t=titles + 1
xml_file.write(str(next_t + 1))
elif action=="action_play_last":
xml_file.write(str(total_t))
#play all
xml_file.write('\t\t\t\t\tif (g3 eq 1) {\n') #if play all:
if titles==total_t-1: #return to menu if last title
xml_file.write('\t\t\t\t\t\tg0=100;\n')
else: #play next title
xml_file.write('\t\t\t\t\t\tg0='+str(titles + 2)+';\n')
xml_file.write('\t\t\t\t\t} else {\n')
#end of play opt
xml_file.write('\t\t\t\t\t\tg0=')
if action=="action_stop":
xml_file.write('100')
elif action=="action_play_previous":
if titles == 0:
prev_t = total_t - 1
else:
xml_file.write('1') # first
prev_t = titles - 1
xml_file.write(str(prev_t + 1))
elif action=="action_play_again":
xml_file.write(str(titles + 1))
elif action=="action_play_next":
if titles==total_t-1:
next_t=0
else:
next_t=titles + 1
xml_file.write(str(next_t + 1))
elif action=="action_play_last":
xml_file.write(str(total_t))
else:
xml_file.write('1') # first
xml_file.write(';\n')
xml_file.write('\t\t\t\t\tcall vmgm menu entry title;\n')
xml_file.write(';\n')
xml_file.write('\t\t\t\t\t}\n')
xml_file.write('\t\t\t\t\tcall vmgm menu entry title;\n') #preform action
xml_file.write('\t\t\t\t</post>\n')
xml_file.write("\t\t\t</pgc>\n")
xml_file.write("\t\t</titles>\n")

View file

@ -525,8 +525,12 @@ class devede_project:
start_with_menu = True
else:
start_with_menu = False
if (self.menu.play_all == "menu_play_all"):
play_all_opt = True
else:
play_all_opt = False
dvdauthor = devedeng.dvdauthor_converter.dvdauthor_converter()
dvdauthor.create_dvd_project(data.path, data.name, file_movies, menu_entries, start_with_menu)
dvdauthor.create_dvd_project(data.path, data.name, file_movies, menu_entries, start_with_menu, play_all_opt)
# dvdauthor must wait until all the files have been converted
for element in final_dependencies:
dvdauthor.add_dependency(element)