foobnix / LibreraReader

Book Reader for Android
http://librera.mobi
Other
3.09k stars 313 forks source link

How to skip URL while using TTS #1231

Closed bheeshmpita closed 10 months ago

bheeshmpita commented 10 months ago

i use calibre to download news recipe and use librera with tts to read it. The issue i face is that at the end of article there is text i dont want to get read and rather get skipped. for eg:

Screenshot_20240110-214240_Trebuchet

i did go through the librera text replacements and tried using 'ttsNEXT' but that skips to the page leaving several articles in between. Also tried using 'ttsSKIP' with the phrases, but unable to skip the URL as that is unique in each case. Is there any way i can skip the whole part in the red coloured box (in image) and move to the new article while using TTS?

TheHardew commented 10 months ago

You can use regular expressions: http://librera.mobi/faq/tts-replacements/ I'm not sure what flavor it uses though.

Maybe something like this will work? *This article was downloaded by calibre from https?:\/\/[^\s]+ -> ttsSKIP

If that does not work, please send the document.

bheeshmpita commented 10 months ago

Thanks @TheHardew that worked as intended. If you could help me with 2 other points:

  1. Could you modify the command to include this type of url too-

image

(to modify TTS speaking "ece dot")

  1. (unrelated to previous ones) While using TTS I could only skip to the next page (using buttons). Is there provision to skip to the next sentence or next para instead?
TheHardew commented 10 months ago

@bheeshmpita

  1. Please send the document. The original replacement should work, so I'll have to see why it breaks.

  2. Sorry, no idea

TheHardew commented 10 months ago

Maybe try *This article was downloaded by calibre from https?:\/\/.+

nobkd commented 10 months ago

It breaks the regex right after a line break, so maybe \s is breaking it? \s checks for white-space characters which also include line breaks. If that's the case, . would also not work, as it does not include line breaks and at the same time includes spaces.

Maybe the following works? *This article was downloaded by calibre from https?:\/\/[^ \t\v]+ It only breaks on real spaces, tabs and vertical tabs.

Or it won't work, if the regex is applied line-wise...

bheeshmpita commented 10 months ago
1. Please send the document. The original replacement should work, so I'll have to see why it breaks.

@TheHardew @nobkd tried both *This article was downloaded by calibre from https?:\/\/.+ & *This article was downloaded by calibre from https?:\/\/[^ \t\v]+ but both didint work. As this is only a minor issue, so no worries. Anyway if you want to try the file yourself, here it is The Hindu [Thu, 11 Jan 2024] - calibre.txt It is a epub file but as the github didnt support the .epub file upload, kindly change the .txt to .epub Thanks for your time.

TheHardew commented 10 months ago

What version are you on? I'm on 8.9.158 and *this\s+article\s+was\s+downloaded\s+by\s+calibre\s+from.+ works.

bheeshmpita commented 10 months ago

@TheHardew After multiple hit and trials, it is now working. Thanks again for the help.