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

Idea: allow to manually tweak text content before converting to audio #5

Closed
larryhudson opened this issue Sep 29, 2023 · 4 comments
Closed

Comments

@larryhudson
Copy link
Owner

Related to my other issue (#4) about setting content extraction rules, another idea is to allow the user to manually tweak the text content, either before they convert to audio, or tweak and re-convert to update the audio.

Sometimes when you're adding a bigger article, it's worth having a quick look at the audio just to see if you can quickly strip out some annoying tags. That'll make the final audio much nicer to listen to.

How we would implement this

  • We'll need to change the structure of the app, because currently content extraction + generating audio happens in one step. So we'll need to separate the extraction from the audio generation.
  • We can add a 'text content' column to the articles database table
  • Then, split the existing background task into two tasks - one for content extraction, one for audio generation.
  • When adding a new article to the app, you would have the option of extract + generate, or just extract and let me tweak. That would be passed through to the extract task so that it would add a 'generate' background task when it's done, or not.
  • Then, in the Astro app you would have another view for editing the text content. This could just be a big <textarea> tag to start with. That would have a 'save' button and a 'generate' button, which would add the 'generate' task to the queue.
  • For articles that have already been extracted, it's probably fine to just leave the text content blank. Maybe we need a 're-extract' button for those articles that will be blank.
@larryhudson
Copy link
Owner Author

I used ChatGPT to help write the SQL for updating the SQLite database table: https://chat.openai.com/share/e80e64bb-542e-45b4-aa2e-54741814465d

@larryhudson
Copy link
Owner Author

I created a new folder called db-migrations and added a JS file in there that does the 'alter' SQL on the database file. Not sure if this is the correct approach but seems ok for now!

@larryhudson
Copy link
Owner Author

I forgot that when I extract the content from the URL, I'm breaking up the HTML into sections, then getting audio for each section, then stitching them together. This makes separating the text extraction and the audio generation steps trickier!

Potential solutions:

  1. Make a new database table for 'chapters', and then when you're extracting content, create the sections in the DB. Then when you're generating the audio, get the list of chapters from the database (that match the article ID). Then when you're editing the text content, you edit each chapter individually. This makes tweaking and saving more complicated...
  2. Still have the article's 'text content' in one DB field, but have something like Markdown headings (eg. the headings are prefixed by "##"). Then when we're doing the audio, we convert the Markdown to HTML, then split up into sections as we're currently doing... that would make it a bit more flexible and also make it easier to manually insert headings into an article that doesn't already have headings.

I think I like option 2. I'm going ahead with that for now!

@larryhudson
Copy link
Owner Author

This is done now.

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

No branches or pull requests

1 participant