larryhudson / astro-sqlite-tts-feed

astro-sqlite-tts-feed
5 stars 0 forks source link

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

Closed larryhudson closed 11 months ago

larryhudson commented 11 months ago

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

larryhudson commented 11 months ago

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 commented 11 months ago

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 commented 11 months ago

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 commented 11 months ago

This is done now.