diff --git a/README.md b/README.md index 3141763..14540b4 100644 --- a/README.md +++ b/README.md @@ -14,3 +14,5 @@ a diy videolooper for py/pi - sudo apt-get install gedit - change keyboard layout : sudo raspi-config => localiation options => change keyboard layout => generic 104 => english us => english us => the default for => no compose => no then sudo reboot + +(for reading video lengths :) sudo apt-get ffmpeg and pip install ffprobe diff --git a/data_centre.py b/data_centre.py index 8107eba..ac666f7 100644 --- a/data_centre.py +++ b/data_centre.py @@ -70,7 +70,7 @@ class data(object): self._browser_list = generate_browser_list(PATH_TO_BROWSER, 0, self._open_folders) def get_browser_data_for_display(self): - ######## map the browser_list to format for displaying in asciimatics ######## + ######## map the browser_list to format for displaying ######## if not self._browser_list: self.rewrite_browser_list() @@ -162,11 +162,12 @@ def create_new_bank_mapping(bank_number,file_name,memory_bank=[]): ######## used for mapping current video to a specific bank ######## has_location , location = get_path_for_file(file_name) length = get_length_for_file(location) - new_bank = dict(name=file_name, location=location, length=-1, start=-1, end=-1) + new_bank = dict(name=file_name, location=location, length=length, start=-1, end=-1) update_a_banks_data(bank_number, new_bank, memory_bank) def get_length_for_file(location): - return FFProbe(location).streams[0].duration + video_length = FFProbe(location).streams[0].duration + return int(round(float(video_length))) def get_path_for_file(file_name): ######## returns full path for a given file name ######## @@ -174,8 +175,7 @@ def get_path_for_file(file_name): if file_name in files: print root return True, '{}/{}'.format(root,file_name) - else: - return False, '' + return False, '' def update_a_banks_data(bank_number, bank_info, memory_bank=[]): ######## overwrite a given banks info with new data ######## @@ -196,6 +196,7 @@ def get_all_looper_data_for_display(): ######## read bank mappings from data object and format for displaying in asciimatics ######## memory_bank = read_json(BANK_DATA_JSON) loop_data = [] + print 'getting the loop data' for index, bank in enumerate(memory_bank): length = convert_int_to_string_for_display(bank["length"]) start = convert_int_to_string_for_display(bank["start"]) diff --git a/display_data.json b/display_data.json index 0c433d5..7a36d35 100644 --- a/display_data.json +++ b/display_data.json @@ -1 +1 @@ -[{"start": -1, "length": -1, "end": -1, "location": "/media/pi/TIM/samplerloop3s.mp4", "name": "samplerloop3s.mp4"}, {"start": -1, "length": -1, "end": -1, "location": "/media/pi/TIM/samplerloop3s2.mp4", "name": "samplerloop3s2.mp4"}, {"start": -1, "length": -1, "end": -1, "location": "/media/pi/TIM/samplerloop3s3.mp4", "name": "samplerloop3s3.mp4"}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}] \ No newline at end of file +[{"start": -1, "length": 4, "end": -1, "location": "/media/pi/TIM/samplerloop3s.mp4", "name": "samplerloop3s.mp4"}, {"start": -1, "length": 5, "end": -1, "location": "/media/pi/TIM/samplerloop3s2.mp4", "name": "samplerloop3s2.mp4"}, {"start": -1, "length": 3, "end": -1, "location": "/media/pi/TIM/samplerloop3s3.mp4", "name": "samplerloop3s3.mp4"}, {"start": -1, "length": 4, "end": -1, "location": "/media/pi/TIM/samplerloop3s.mp4", "name": "samplerloop3s.mp4"}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}, {"start": -1, "length": -1, "end": -1, "location": "", "name": ""}] \ No newline at end of file diff --git a/next_bank_number.json b/next_bank_number.json index c227083..56a6051 100644 --- a/next_bank_number.json +++ b/next_bank_number.json @@ -1 +1 @@ -0 \ No newline at end of file +1 \ No newline at end of file