This commit is contained in:
Jesse Bannon 2023-12-13 14:49:56 -08:00
parent 837c6c1af9
commit 92031fd5b4
4 changed files with 7 additions and 2 deletions

View file

@ -68,6 +68,10 @@ class VariableDefinitions:
""" """
return MetadataVariable(metadata_key="id", variable_name="uid") return MetadataVariable(metadata_key="id", variable_name="uid")
@property
def duration(self) -> MetadataVariable:
return MetadataVariable("duration", metadata_key="duration")
@property @property
def uid_sanitized_plex(self) -> Variable: def uid_sanitized_plex(self) -> Variable:
""" """

View file

@ -138,6 +138,7 @@ ENTRY_DEFAULT_VARIABLES: Dict[MetadataVariable, str] = {
v.channel: entry_get_str(v.channel, v.uploader), v.channel: entry_get_str(v.channel, v.uploader),
v.creator: entry_get_str(v.creator, v.channel), v.creator: entry_get_str(v.creator, v.channel),
v.channel_id: entry_get_str(v.channel_id, v.uploader_id), v.channel_id: entry_get_str(v.channel_id, v.uploader_id),
v.duration: entry_get_int(v.duration, 0),
v.playlist_index: entry_get_int(v.playlist_index, 1), v.playlist_index: entry_get_int(v.playlist_index, 1),
v.playlist_count: entry_get_int(v.playlist_count, 1), v.playlist_count: entry_get_int(v.playlist_count, 1),
v.playlist_uid: entry_get_str(v.playlist_uid, v.uid), v.playlist_uid: entry_get_str(v.playlist_uid, v.uid),

View file

@ -333,7 +333,7 @@ class ChaptersPlugin(Plugin[ChaptersOptions]):
set_ffmpeg_metadata_chapters( set_ffmpeg_metadata_chapters(
file_path=entry.get_download_file_path(), file_path=entry.get_download_file_path(),
chapters=chapters, chapters=chapters,
file_duration_sec=entry.kwargs("duration"), file_duration_sec=entry.get_int(v.duration),
) )
if not has_chapters_from_comments: if not has_chapters_from_comments:

View file

@ -146,7 +146,7 @@ class SplitByChaptersPlugin(SplitPlugin[SplitByChaptersOptions]):
) )
timestamp_begin = chapters.timestamps[idx].readable_str timestamp_begin = chapters.timestamps[idx].readable_str
timestamp_end = Timestamp(new_entry.kwargs("duration")).readable_str timestamp_end = Timestamp(new_entry.get_int(v.duration)).readable_str
if idx + 1 < len(chapters.timestamps): if idx + 1 < len(chapters.timestamps):
timestamp_end = chapters.timestamps[idx + 1].readable_str timestamp_end = chapters.timestamps[idx + 1].readable_str