fixing broken banner

This commit is contained in:
langolierz
2018-01-06 04:17:49 +00:00
parent 7519b8e1bd
commit a4a4467145
6 changed files with 15 additions and 82 deletions

View File

@@ -32,7 +32,7 @@ class Actions(object):
def enter_on_settings_selection(self):
self.data.switch_settings(self.display.selected_list_index)
def clear_all_sampler_slots(self):
def clear_all_slots(self):
self.data.clear_all_slots()
def quit_the_program(self):
@@ -48,8 +48,8 @@ class Actions(object):
self.video_driver.manual_next = True
def cycle_display_mode(self):
self.display.topscreen_menu_index = 0
self.display.current_menu_index = self.display.topscreen_menu_index
self.display.top_menu_index = 0
self.display.selected_menu_index = self.display.top_menu_index
if self.display.display_mode == "BROWSER":
self.display.display_mode = "SETTINGS"
elif self.display.display_mode == "SAMPLER":
@@ -71,9 +71,9 @@ class Actions(object):
def set_playing_sample_start_to_current_duration(self):
current_slot = self.video_driver.current_player.slot_number
current_duration = self.video_driver.current_player.get_duration()
self.data.update_slot_start_to_this_time(current_slot, current_duration)
current_position = self.video_driver.current_player.get_position()
self.data.update_slot_start_to_this_time(current_slot, current_position)
def clear_playing_sample_start_time(self):
current_slot = self.video_driver.current_player.slot_number
self.data.update_slot_start_to_this_time(current_slot, 0)
self.data.update_slot_start_to_this_time(current_slot, -1)

View File

@@ -128,9 +128,9 @@ class Data(object):
slot_number=next_slot_number)
return context
def update_slot_start_to_this_time(self, slot_number, time):
def update_slot_start_to_this_time(self, slot_number, position):
memory_bank = read_json(BANK_DATA_JSON)
memory_bank[slot_number]['start'] = time
memory_bank[slot_number]['start'] = position
update_json(BANK_DATA_JSON, memory_bank)
def _get_length_for_file(self, path):

View File

@@ -1,72 +1 @@
[
{
"start": -1,
"end": -1,
"location": "/media/pi/TIM1/samplerloop3s.mp4",
"length": 4,
"name": "samplerloop3s.mp4"
},
{
"start": -1,
"end": -1,
"location": "/media/pi/TIM1/teaser1.mp4",
"length": 3,
"name": "teaser1.mp4"
},
{
"start": -1,
"end": -1,
"location": "/media/pi/TIM1/teaser2.mp4",
"length": 3,
"name": "teaser2.mp4"
},
{
"start": -1,
"end": -1,
"location": "/media/pi/TIM1/teaser3.mp4",
"length": 3,
"name": "teaser3.mp4"
},
{
"start": -1,
"end": -1,
"location": "/media/pi/TIM1/teaser4.mp4",
"length": 2,
"name": "teaser4.mp4"
},
{
"start": -1,
"end": -1,
"location": "/media/pi/TIM1/Test.mp4",
"length": 600,
"name": "Test.mp4"
},
{
"start": -1,
"end": -1,
"location": "/media/pi/TIM1/TRASHPALACEVIDEOS/01_trashpalaceintro.mp4",
"length": 26,
"name": "01_trashpalaceintro.mp4"
},
{
"start": 5,
"end": 40,
"location": "/media/pi/TIM1/videos_to_play/colour_pixel_01.mp4",
"length": 49,
"name": "colour_pixel_01.mp4"
},
{
"start": -1,
"end": -1,
"location": "/media/pi/TIM1/teaser1.mp4",
"length": 0,
"name": "teaser1.mp4"
},
{
"start": -1,
"end": -1,
"location": "/media/pi/TIM1/samplerloop3s2.mp4",
"length": 0,
"name": "samplerloop3s2.mp4"
}
]
[{"start": -1, "length": 4, "name": "samplerloop3s.mp4", "location": "/media/pi/TIM1/samplerloop3s.mp4", "end": -1}, {"start": -1, "length": 3, "name": "teaser1.mp4", "location": "/media/pi/TIM1/teaser1.mp4", "end": -1}, {"start": -1, "length": 3, "name": "teaser2.mp4", "location": "/media/pi/TIM1/teaser2.mp4", "end": -1}, {"start": -1, "length": 3, "name": "teaser3.mp4", "location": "/media/pi/TIM1/teaser3.mp4", "end": -1}, {"start": -1, "length": 2, "name": "teaser4.mp4", "location": "/media/pi/TIM1/teaser4.mp4", "end": -1}, {"start": 14.509256, "length": 600, "name": "Test.mp4", "location": "/media/pi/TIM1/Test.mp4", "end": -1}, {"start": -1, "length": 26, "name": "01_trashpalaceintro.mp4", "location": "/media/pi/TIM1/TRASHPALACEVIDEOS/01_trashpalaceintro.mp4", "end": -1}, {"start": -1, "length": 49, "name": "colour_pixel_01.mp4", "location": "/media/pi/TIM1/videos_to_play/colour_pixel_01.mp4", "end": 40}, {"start": -1, "length": 0, "name": "teaser1.mp4", "location": "/media/pi/TIM1/teaser1.mp4", "end": -1}, {"start": -1, "length": 0, "name": "samplerloop3s2.mp4", "location": "/media/pi/TIM1/samplerloop3s2.mp4", "end": -1}]

View File

@@ -1 +1 @@
7
5

View File

@@ -154,12 +154,14 @@ class Display(object):
@staticmethod
def create_video_display_banner(start, end, length, position):
banner_list = ['[', '-', '-', '-', '-', '-', '-', '-', '-',
'-', '-', '-', '-', '-', '-', '-', '-', '-',
'-', '-', '-', '-', '-', '-', '-', '-', '-',
'-', '-', '-', '-', '-',
']']
max = len(banner_list) - 1
print('start:{},end:{},length:{},position:{},max:{}'.format(start,end,length,position,max))
if position < start:
banner_list[0] = '<'
elif position > end:
@@ -167,6 +169,7 @@ class Display(object):
elif length != 0:
marker = int(math.floor(float(position - start) /
float(length) * (max - 1)) + 1)
print('marker:{}'.format(marker))
banner_list[marker] = '*'
return ''.join(banner_list)

View File

@@ -98,13 +98,14 @@ class NumpadInput(object):
def on_2_press(self):
if self.message_handler.function_on:
print('function called')
self.actions.clear_playing_sample_start_time()
else:
self.actions.load_this_slot_into_next_player(2)
def on_3_press(self):
if self.message_handler.function_on:
pass
self.actions.clear_all_slots()
else:
self.actions.load_this_slot_into_next_player(3)