
And, in new verbose mode, report when audio files are skipped (as they have been previously processed)
40 lines
1.2 KiB
Python
Executable file
40 lines
1.2 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
|
|
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)
|
|
|
|
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')
|
|
if language in config['translate'] and not files.hasTranslation(audioFile):
|
|
skipped = False
|
|
print(f"Translating audio: {audioFile} ({audioLength})", flush=True)
|
|
files.generateFromAudio(audioFile, 'translate')
|
|
if skipped and options.verbose:
|
|
print(f"Skipped audio: {audioFile} ({audioLength})")
|
|
|
|
|