mirror of
https://github.com/iluvcapra/ptulsconv.git
synced 2026-01-01 17:30:47 +00:00
Movie enhancements
This commit is contained in:
3
.idea/misc.xml
generated
3
.idea/misc.xml
generated
@@ -1,4 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (ptulsconv)" project-jdk-type="Python SDK" />
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (ptulsconv)" project-jdk-type="Python SDK" />
|
||||||
|
<component name="PyPackaging">
|
||||||
|
<option name="earlyReleasesAsUpgrades" value="true" />
|
||||||
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@@ -43,7 +43,10 @@ adr_field_map = ((['Title', 'PT.Session.Name'], 'Title', str),
|
|||||||
(['TBW'], 'To Be Written', str),
|
(['TBW'], 'To Be Written', str),
|
||||||
(['OMIT'], 'Omit', str),
|
(['OMIT'], 'Omit', str),
|
||||||
(['ADLIB'], 'Adlib', str),
|
(['ADLIB'], 'Adlib', str),
|
||||||
(['OPT'], 'Optional', str))
|
(['OPT'], 'Optional', str),
|
||||||
|
(['Movie.Filename'], 'Movie', str),
|
||||||
|
(['Movie.Start_Offset_Frames'], 'Movie Frames', int),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def fmp_dump(data, input_file_name, output):
|
def fmp_dump(data, input_file_name, output):
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class TagInterpreter(Transformation):
|
|||||||
tag_junk = word word_sep?
|
tag_junk = word word_sep?
|
||||||
word = ~"[^ \[\{\$][^ ]*"
|
word = ~"[^ \[\{\$][^ ]*"
|
||||||
word_sep = ~" +"
|
word_sep = ~" +"
|
||||||
modifier = ("@" / "&") word_sep?
|
modifier = ("@" / "&" / "!") word_sep?
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -200,7 +200,8 @@ class TagInterpreter(Transformation):
|
|||||||
self.timespan_rules.append(rule)
|
self.timespan_rules.append(rule)
|
||||||
|
|
||||||
elif clip_tags['mode'] == 'Movie':
|
elif clip_tags['mode'] == 'Movie':
|
||||||
rule = dict(movie_path=clip['filename'],
|
print_status_style("Movie Clip tags: {}".format(clip_tags))
|
||||||
|
rule = dict(movie_path=clip_tags['tags']['Movie'],
|
||||||
start_time=clip['start_time_decoded']['frame_count'],
|
start_time=clip['start_time_decoded']['frame_count'],
|
||||||
end_time=clip['end_time_decoded']['frame_count'])
|
end_time=clip['end_time_decoded']['frame_count'])
|
||||||
self.movie_rules.append(rule)
|
self.movie_rules.append(rule)
|
||||||
@@ -210,11 +211,12 @@ class TagInterpreter(Transformation):
|
|||||||
|
|
||||||
def decorate_event(self, clip, clip_tags, input_dict, track_context_tags, track_tags):
|
def decorate_event(self, clip, clip_tags, input_dict, track_context_tags, track_tags):
|
||||||
event = dict()
|
event = dict()
|
||||||
|
start_frame = clip['start_time_decoded']['frame_count']
|
||||||
event.update(self.title_tags['tags'])
|
event.update(self.title_tags['tags'])
|
||||||
event.update(track_context_tags)
|
event.update(track_context_tags)
|
||||||
event.update(self.effective_timespan_tags_at_time(clip['start_time_decoded']['frame_count']))
|
event.update(self.effective_timespan_tags_at_time(start_frame))
|
||||||
event.update(self.effective_marker_tags_at_time(clip['start_time_decoded']['frame_count']))
|
event.update(self.effective_marker_tags_at_time(start_frame))
|
||||||
event.update(self.effective_movie_at_time(clip['start_time_decoded']['frame_count']))
|
event.update(self.effective_movie_at_time(start_frame))
|
||||||
event.update(clip_tags['tags'])
|
event.update(clip_tags['tags'])
|
||||||
event['PT.Track.Name'] = track_tags['line']
|
event['PT.Track.Name'] = track_tags['line']
|
||||||
event['PT.Session.Name'] = self.title_tags['line']
|
event['PT.Session.Name'] = self.title_tags['line']
|
||||||
@@ -223,9 +225,9 @@ class TagInterpreter(Transformation):
|
|||||||
event['PT.Clip.Name'] = clip_tags['line']
|
event['PT.Clip.Name'] = clip_tags['line']
|
||||||
event['PT.Clip.Start'] = clip['start_time']
|
event['PT.Clip.Start'] = clip['start_time']
|
||||||
event['PT.Clip.Finish'] = clip['end_time']
|
event['PT.Clip.Finish'] = clip['end_time']
|
||||||
event['PT.Clip.Start_Frames'] = clip['start_time_decoded']['frame_count']
|
event['PT.Clip.Start_Frames'] = start_frame
|
||||||
event['PT.Clip.Finish_Frames'] = clip['end_time_decoded']['frame_count']
|
event['PT.Clip.Finish_Frames'] = clip['end_time_decoded']['frame_count']
|
||||||
event['PT.Clip.Start_Seconds'] = clip['start_time_decoded']['frame_count'] / input_dict['header'][
|
event['PT.Clip.Start_Seconds'] = start_frame / input_dict['header'][
|
||||||
'timecode_format']
|
'timecode_format']
|
||||||
event['PT.Clip.Finish_Seconds'] = clip['end_time_decoded']['frame_count'] / input_dict['header'][
|
event['PT.Clip.Finish_Seconds'] = clip['end_time_decoded']['frame_count'] / input_dict['header'][
|
||||||
'timecode_format']
|
'timecode_format']
|
||||||
@@ -236,8 +238,10 @@ class TagInterpreter(Transformation):
|
|||||||
|
|
||||||
for rule in reversed(self.movie_rules):
|
for rule in reversed(self.movie_rules):
|
||||||
if rule['start_time'] <= time <= rule['end_time']:
|
if rule['start_time'] <= time <= rule['end_time']:
|
||||||
retval['Movie.Filename'] = rule['filename']
|
retval['Movie.Filename'] = rule['movie_path']
|
||||||
retval['Movie.Start_Offset_Frames'] = time - rule['start_time']
|
retval['Movie.Start_Offset_Frames'] = time - rule['start_time']
|
||||||
|
retval['Movie.Start_Offset_Seconds'] = (time - rule['start_time'] ) / input_dict['header'][
|
||||||
|
'timecode_format']
|
||||||
break
|
break
|
||||||
|
|
||||||
return retval
|
return retval
|
||||||
|
|||||||
Reference in New Issue
Block a user