44 lines
1.4 KiB
Python
Executable file
44 lines
1.4 KiB
Python
Executable file
#!/usr/bin/python3
|
|
|
|
import lib.args as args
|
|
import lib.config as cfg
|
|
import lib.files as files
|
|
import lib.rss as rss
|
|
|
|
config = cfg.load()
|
|
options = args.read()
|
|
|
|
for podcast in config['podcasts']:
|
|
if options.filter and not options.filter in podcast['name'].lower():
|
|
continue
|
|
elif not options.filter and podcast['auto'] == False:
|
|
continue
|
|
files.addRef(podcast)
|
|
rss.fetch(podcast, options.loadFeed)
|
|
if options.downloadEpisodes:
|
|
eps = rss.getEpisodes(podcast, options.episodes, options.numEpisodes)
|
|
for ep in eps:
|
|
files.saveEpisode(podcast, ep, options)
|
|
|
|
if not options.generate:
|
|
exit(0)
|
|
audioFiles = files.findAudio()
|
|
for audioFile in audioFiles:
|
|
audioLength = files.getAudioLength(audioFile)
|
|
language = files.getLangCode(audioFile)
|
|
skipped = True
|
|
if not files.hasTranscript(audioFile):
|
|
skipped = False
|
|
print(f"Transcribing audio: {audioFile} ({audioLength})", flush=True)
|
|
files.generateFromAudio(audioFile, 'transcribe', options)
|
|
if (language in config['translate'] and not files.hasTranslation(audioFile)
|
|
and language != 'eo' and options.tts != 'vosk'
|
|
):
|
|
skipped = False
|
|
print(f"Translating audio: {audioFile} ({audioLength})", flush=True)
|
|
files.generateFromAudio(audioFile, 'translate', options)
|
|
if skipped and options.verbose:
|
|
print(f"Skipped audio: {audioFile} ({audioLength})")
|
|
|
|
|