mirror of
https://github.com/iluvcapra/ptulsconv.git
synced 2025-12-31 08:50:48 +00:00
Some functional util code
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
from fractions import Fraction
|
||||
from ptulsconv.broadcast_timecode import smpte_to_frame_count
|
||||
from typing import Tuple, List
|
||||
from typing import Tuple, List, Generator
|
||||
from . import apply_appends
|
||||
from .tagged_string_parser_visitor import parse_tags
|
||||
|
||||
|
||||
class SessionDescriptor:
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
from parsimonious import NodeVisitor, Grammar
|
||||
from typing import Dict, Optional
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class TagPreModes(Enum):
|
||||
NORMAL = 'Normal'
|
||||
APPEND = 'Append'
|
||||
TIMESPAN = 'Timespan'
|
||||
|
||||
|
||||
tag_grammar = Grammar(
|
||||
@@ -16,7 +23,7 @@ tag_grammar = Grammar(
|
||||
tag_junk = word word_sep?
|
||||
word = ~"[^ \[\{\$][^ ]*"
|
||||
word_sep = ~" +"
|
||||
modifier = ("@" / "&" / "!") word_sep?
|
||||
modifier = ("@" / "&") word_sep?
|
||||
"""
|
||||
)
|
||||
|
||||
@@ -55,13 +62,11 @@ class TagListVisitor(NodeVisitor):
|
||||
@staticmethod
|
||||
def visit_modifier(node, _):
|
||||
if node.text.startswith('@'):
|
||||
return 'Timespan'
|
||||
return TagPreModes.TIMESPAN
|
||||
elif node.text.startswith('&'):
|
||||
return 'Append'
|
||||
elif node.text.startswith('!'):
|
||||
return 'Movie'
|
||||
return TagPreModes.APPEND
|
||||
else:
|
||||
return 'Normal'
|
||||
return TagPreModes.NORMAL
|
||||
|
||||
@staticmethod
|
||||
def visit_tag_list(_, visited_children):
|
||||
|
||||
Reference in New Issue
Block a user