tictacsync 0.3a3__py3-none-any.whl → 0.4a0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of tictacsync might be problematic. Click here for more details.
- tictacsync/device_scanner.py +27 -35
- tictacsync/entry.py +8 -8
- tictacsync/timeline.py +350 -161
- tictacsync/yaltc.py +179 -171
- {tictacsync-0.3a3.dist-info → tictacsync-0.4a0.dist-info}/METADATA +1 -1
- tictacsync-0.4a0.dist-info/RECORD +15 -0
- tictacsync-0.3a3.dist-info/RECORD +0 -15
- {tictacsync-0.3a3.dist-info → tictacsync-0.4a0.dist-info}/LICENSE +0 -0
- {tictacsync-0.3a3.dist-info → tictacsync-0.4a0.dist-info}/WHEEL +0 -0
- {tictacsync-0.3a3.dist-info → tictacsync-0.4a0.dist-info}/entry_points.txt +0 -0
- {tictacsync-0.3a3.dist-info → tictacsync-0.4a0.dist-info}/top_level.txt +0 -0
tictacsync/device_scanner.py
CHANGED
|
@@ -77,6 +77,7 @@ class Device:
|
|
|
77
77
|
name: str
|
|
78
78
|
dev_type: str # CAM or REC
|
|
79
79
|
n_chan: int
|
|
80
|
+
ttc: int
|
|
80
81
|
tracks: Tracks
|
|
81
82
|
def __hash__(self):
|
|
82
83
|
return self.UID
|
|
@@ -115,7 +116,7 @@ def media_at_path(input_structure, p):
|
|
|
115
116
|
logger.debug('for file %s dev_UID established %s'%(p.name, dev_UID))
|
|
116
117
|
return Media(p,
|
|
117
118
|
Device(UID=dev_UID, folder=p.parent, name=dev_name, dev_type=dt,
|
|
118
|
-
n_chan=n, tracks=None))
|
|
119
|
+
n_chan=n, ttc=None, tracks=None))
|
|
119
120
|
|
|
120
121
|
def get_device_ffprobe_UID(file):
|
|
121
122
|
"""
|
|
@@ -230,21 +231,6 @@ class Scanner:
|
|
|
230
231
|
Sets Scanner.input_structure = 'loose'|'folder_is_device'
|
|
231
232
|
|
|
232
233
|
"""
|
|
233
|
-
visible = [f for f in listdir(self.top_directory) if f[0] != '.']
|
|
234
|
-
logger.debug('visible: %s'%visible)
|
|
235
|
-
are_dir = all([isdir(join(self.top_directory, f)) for f in visible])
|
|
236
|
-
are_files = all([isfile(join(self.top_directory, f)) for f in visible])
|
|
237
|
-
logger.debug('dir: %s'%[isdir(join(self.top_directory, f)) for f
|
|
238
|
-
in visible])
|
|
239
|
-
if are_dir:
|
|
240
|
-
visible = [e for e in visible if e != 'SyncedMedia']
|
|
241
|
-
print('\nAssuming those are device folders: ',end='')
|
|
242
|
-
[print('[gold1]%s[/gold1]'%f, end=', ') for f in visible[:-1]]
|
|
243
|
-
print('[gold1]%s[/gold1].'%visible[-1])
|
|
244
|
-
self.input_structure = 'folder_is_device'
|
|
245
|
-
else: # are_files
|
|
246
|
-
self.input_structure = 'loose'
|
|
247
|
-
self.top_dir_has_multicam = False
|
|
248
234
|
files = Path(self.top_directory).rglob('*.*')
|
|
249
235
|
paths = [
|
|
250
236
|
p
|
|
@@ -252,17 +238,33 @@ class Scanner:
|
|
|
252
238
|
if p.suffix[1:] in av_file_extensions
|
|
253
239
|
and 'SyncedMedia' not in p.parts
|
|
254
240
|
]
|
|
241
|
+
logger.debug('found media files %s'%paths)
|
|
242
|
+
parents = [p.parent for p in paths]
|
|
243
|
+
logger.debug('found parents %s'%parents)
|
|
244
|
+
def _list_all_the_same(a_list):
|
|
245
|
+
return a_list.count(a_list[0]) == len(a_list)
|
|
246
|
+
all_parents_are_the_same = _list_all_the_same(parents)
|
|
247
|
+
logger.debug('all_parents_are_the_same %s'%all_parents_are_the_same)
|
|
248
|
+
if all_parents_are_the_same:
|
|
249
|
+
# all media (video + audio) are in a same folder, so this is loose
|
|
250
|
+
self.input_structure = 'loose'
|
|
251
|
+
# for now (TO DO?) 'loose' == no multi-cam
|
|
252
|
+
self.top_dir_has_multicam = False
|
|
253
|
+
else:
|
|
254
|
+
# check later if inside each folder, media have same device,
|
|
255
|
+
# for now, we'll guess structure is 'folder_is_device'
|
|
256
|
+
self.input_structure = 'folder_is_device'
|
|
255
257
|
for p in paths:
|
|
256
258
|
new_media = media_at_path(self.input_structure, p) # dev UID set here
|
|
257
259
|
self.found_media_files.append(new_media)
|
|
258
260
|
# files from devices without UID or name
|
|
259
|
-
def
|
|
260
|
-
|
|
261
|
+
# def _list_all_the_same(l):
|
|
262
|
+
# return all(e == l[0] for e in l)
|
|
261
263
|
def _try_name(medias):
|
|
262
264
|
# return common first strings in filename
|
|
263
265
|
names = [m.path.name for m in medias]
|
|
264
266
|
transposed_names = list(map(list, zip(*names)))
|
|
265
|
-
same = list(map(
|
|
267
|
+
same = list(map(_list_all_the_same, transposed_names))
|
|
266
268
|
try:
|
|
267
269
|
first_diff = same.index(False)
|
|
268
270
|
except:
|
|
@@ -341,32 +343,22 @@ class Scanner:
|
|
|
341
343
|
ntracks += len(tracks.others)
|
|
342
344
|
ntracks += 1 # for ttc track
|
|
343
345
|
logger.debug(' n chan: %i n tracks file: %i'%(nchan, ntracks))
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
346
|
+
if ntracks != nchan:
|
|
347
|
+
print('\nError parsing %s content'%tracks_file)
|
|
348
|
+
print('incoherent number of tracks, %i vs %i quitting\n'%
|
|
349
|
+
(nchan, ntracks))
|
|
350
|
+
sys.exit(1)
|
|
349
351
|
err_msg = tracks.error_msg
|
|
350
352
|
if err_msg != None:
|
|
351
353
|
print('Error, quitting: in file %s, %s'%(tracks_file, err_msg))
|
|
352
354
|
raise Exception
|
|
353
355
|
else:
|
|
356
|
+
logger.debug('tracks object%s'%tracks)
|
|
354
357
|
return tracks
|
|
355
358
|
else:
|
|
356
359
|
logger.debug('no tracks.txt file found')
|
|
357
360
|
return None
|
|
358
361
|
|
|
359
|
-
# def _use_folder_as_device_name(self):
|
|
360
|
-
# """
|
|
361
|
-
# For each media in self.found_media_files replace existing Device.name by
|
|
362
|
-
# folder name.
|
|
363
|
-
|
|
364
|
-
# Returns nothing
|
|
365
|
-
# """
|
|
366
|
-
# for m in self.found_media_files:
|
|
367
|
-
# m.device.name = m.path.parent.name
|
|
368
|
-
# logger.debug(self.found_media_files)
|
|
369
|
-
|
|
370
362
|
def _check_folders_have_same_device(self):
|
|
371
363
|
"""
|
|
372
364
|
Since input_structure == 'folder_is_device,
|
tictacsync/entry.py
CHANGED
|
@@ -126,10 +126,10 @@ def main():
|
|
|
126
126
|
# logger.add(sys.stdout, filter="__main__")
|
|
127
127
|
# logger.add(sys.stdout, filter="device_scanner")
|
|
128
128
|
# logger.add(sys.stdout, filter="yaltc") _extract_sound_to_merge
|
|
129
|
-
logger.add(sys.stdout, filter=lambda r: r["function"] == "
|
|
130
|
-
# logger.add(sys.stdout, filter=lambda r: r["function"] == "
|
|
131
|
-
logger.add(sys.stdout, filter=lambda r: r["function"] == "
|
|
132
|
-
logger.add(sys.stdout, filter=lambda r: r["function"] == "
|
|
129
|
+
# logger.add(sys.stdout, filter=lambda r: r["function"] == "_get_tracks_from_file")
|
|
130
|
+
# logger.add(sys.stdout, filter=lambda r: r["function"] == "_get_device_mix")
|
|
131
|
+
# logger.add(sys.stdout, filter=lambda r: r["function"] == "_sox_mono2stereo")
|
|
132
|
+
# logger.add(sys.stdout, filter=lambda r: r["function"] == "_sox_mix_files")
|
|
133
133
|
top_dir = args.directory[0]
|
|
134
134
|
if os.path.isfile(top_dir):
|
|
135
135
|
file = top_dir
|
|
@@ -234,7 +234,7 @@ def main():
|
|
|
234
234
|
print('\nNothing to sync, exiting.\n')
|
|
235
235
|
sys.exit(1)
|
|
236
236
|
matcher = timeline.Matcher(recordings_with_time)
|
|
237
|
-
matcher.
|
|
237
|
+
matcher.scan_audio_for_each_videoclip()
|
|
238
238
|
if not matcher.video_mergers:
|
|
239
239
|
if not args.terse:
|
|
240
240
|
print('\nNothing to sync, bye.\n')
|
|
@@ -263,11 +263,11 @@ def main():
|
|
|
263
263
|
print('\nWrote output in folder [gold1]%s[/gold1]'%(
|
|
264
264
|
a_stitcher.synced_clip_dir))
|
|
265
265
|
for stitcher in matcher.video_mergers:
|
|
266
|
-
print('[gold1]%s[/gold1]'%stitcher.
|
|
266
|
+
print('[gold1]%s[/gold1]'%stitcher.videoclip.AVpath.name, end='')
|
|
267
267
|
for audio in stitcher.get_matched_audio_recs():
|
|
268
268
|
print(' + [gold1]%s[/gold1]'%audio.AVpath.name, end='')
|
|
269
|
-
new_file = stitcher.
|
|
270
|
-
print(' became [gold1]%s[/gold1]'%stitcher.
|
|
269
|
+
new_file = stitcher.videoclip.final_synced_file.parts
|
|
270
|
+
print(' became [gold1]%s[/gold1]'%stitcher.videoclip.final_synced_file.name)
|
|
271
271
|
# matcher._build_otio_tracks_for_cam()
|
|
272
272
|
matcher.shrink_gaps_between_takes()
|
|
273
273
|
sys.exit(0)
|