Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tooltips and persistent settings for export options, added VTT support #124

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

smrl
Copy link
Contributor

@smrl smrl commented Dec 6, 2024

No description provided.

@smrl
Copy link
Contributor Author

smrl commented Dec 6, 2024

Have not verified VTT output works properly, need to find something for validating. SRT coordinate widgets are still rendering funny.

@smrl
Copy link
Contributor Author

smrl commented Dec 6, 2024

also sorry, looks like my autoformatting made a bunch of non-edit edits

@mikeylove
Copy link
Contributor

at a quick glance it looks like one big auto-formatting change is from two space indentation to four? maybe you can tweak that setting back to two to remove some of the unrelated diff noise?

@smrl
Copy link
Contributor Author

smrl commented Dec 6, 2024

Playing around with a validator, I'm seeing a fundamental issue with our idea of subtitle export:
These subtitle files should be per source file, not one big lump, and i'm not sure what the purpose of them is without the timestamps relating directly to a source media clip. Unless that is accomplished specifically by the user selecting only one source clip, this will always be the case. Transcribing multiple clips and exporting them yields overlapping timecodes that break the subtitle spec.

Might a better approach be to make subtitle files that are just the name of the source clip + subtitle extension?

JSON and CSV may be an entirely different use case, but I think this is a big quirk right now...

Another very small UI suggestion I have for this related to our discussion of getting rid of modals is to remove the "success" dialog and just disappear the export dialog if successful.

Copy link
Contributor

@mikeylove mikeylove left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry this review is taking so long - trying to put an honest effort into understanding all the changes correctly.

also a bit curious about the commit history on this pr? it seems a bit odd that it shows all of those historical merge commits as part of this branch specifically? 🤔🤔🤔🤔🤔

might be worth it to apply these changes to a clean branch, especially after turning off some of your auto-formatting settings. 🤷🏻‍♂️

if is_selected then
ImGui.SetItemDefaultFocus(ctx)
function TranscriptExporterFormats:init()
if not self.format_widget then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

init will only be called once so i don't think this block needs to be wrapped

Comment on lines 206 to 224
if not options.json_widgets then
local storage = Storage.ExtState.make {
section = 'ReaSpeech.Export.JSON',
persist = true
}

options.json_widgets = {
object_per_segment = ReaSpeechCheckbox.new {
state = storage:boolean('object_per_segment', false),
label_long = 'One Object per Transcript Segment', -- Changed from label to label_long
help_text = [[Each transcript segment is exported a separate JSON object.]]
}
}
end

Trap(function()
options.json_widgets.object_per_segment:render()
options.object_per_segment = options.json_widgets.object_per_segment:value()
end)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think maybe it might be best to just call render instead of also setting the value by calling the widget value with each render cycle. maybe we create another group of functions that represent each of these "if not options.*_widgets" blocks:

function TranscriptExportFormat.widgets_json(options)
  if options.json_options then
    return options.json_options -- already initialized
  end

  local storage = Storage.ExtState.make {...}

  options.json_options = {
    object_per_segment = ReaSpeechCheckbox.new {...},
  }

  return options.json_options
end

function TranscriptExportFormat.options_json(options)
  Trap(function()
    local widgets = TranscriptExportFormat.widgets_json(options)
    widgets.object_per_segment:render()
  end)
end

function TranscriptExportFormat.writer_json(transcript, output_file, options)
  Trap(function()
    local widgets = TranscriptExportFormat.widgets_json(options)

    if widgets.object_per_segment:value() then
      ...
    else
      ...
    end
  end)
end

also kinda nice benefit to keep the persistence/widget definitions separate from the rendering stuff. this all gets super noisy so it's a challenge to keep it understandable (clearly, right? lol).

@mikeylove
Copy link
Contributor

Playing around with a validator, I'm seeing a fundamental issue with our idea of subtitle export: These subtitle files should be per source file, not one big lump, and i'm not sure what the purpose of them is without the timestamps relating directly to a source media clip. Unless that is accomplished specifically by the user selecting only one source clip, this will always be the case. Transcribing multiple clips and exporting them yields overlapping timecodes that break the subtitle spec.

i've definitely wondered about this before. our main one-big-blob-of-transcript data model kinda leaves a bunch of questions like this open.

Might a better approach be to make subtitle files that are just the name of the source clip + subtitle extension?

that could at least be a nice option maybe? like, a checkbox "per source file" that un-disables a set of file naming options?

Another very small UI suggestion I have for this related to our discussion of getting rid of modals is to remove the "success" dialog and just disappear the export dialog if successful.

on another branch (#115) i'm working on providing a "reveal" command. maybe on success it says "Export successful" with a "reveal" link but the notice can...disappear automatically after a short interval. 🤔

@smrl smrl marked this pull request as draft January 7, 2025 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants