Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions pyharp/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ class HarpMidiTrack(HarpComponent):
required: bool
type: str = "midi_track"

@dataclass
class HarpTextTrack(HarpComponent):
required: bool
type: str = "text_track"

@dataclass
class HarpSlider(HarpComponent):
minimum: float
Expand Down Expand Up @@ -124,6 +129,15 @@ def get_harp_component(gr_cmp: Component) -> HarpComponent:
info=gr_cmp.info,
required=gr_cmp.is_harp_required
)
elif isinstance(gr_cmp, gr.File) \
and '.txt' in gr_cmp.file_types:
assert gr_cmp.type == "filepath", \
f"File input must be of type filepath, not {gr_cmp.type}"
harp_cmp = HarpTextTrack(
label=gr_cmp.label,
info=gr_cmp.info,
required=gr_cmp.is_harp_required
)
elif isinstance(gr_cmp, gr.Slider):
harp_cmp = HarpSlider(
minimum=gr_cmp.minimum,
Expand Down