Only output info about file downloads in verbose mode

This commit is contained in:
Benno Lang 2025-01-23 13:50:03 +10:30
parent f9c98402bc
commit 005244e96d
2 changed files with 5 additions and 4 deletions

View file

@ -32,7 +32,7 @@ def replaceExtension(fileName, newExtension):
parts.pop()
return '.'.join(parts) + '.' + newExtension
def saveEpisode(podcast, episode):
def saveEpisode(podcast, episode, options):
match = startingNumerals.match(episode['title'])
if episode['episode']:
# Episode (& possibly season) number encoded in the RSS
@ -69,9 +69,10 @@ def saveEpisode(podcast, episode):
episodeName += ' - ' + episode['subtitle']
episodeRef = getRef(episodeName)
fileName = f"{episodeRef}.{ext}"
print(f"Downloading episode {identifier} of {podcast['name']} as {fileName}")
if options.verbose:
print(f"Downloading episode {identifier} of {podcast['name']} as {fileName}")
fetcher.download(episode['url'], f"{podcast['dir']}/{fileName}")
else:
elif options.verbose:
print(f"Episode {identifier} of {podcast['name']} has been downloaded previously; skipping")
def findAudio():

View file

@ -16,7 +16,7 @@ for podcast in config['podcasts']:
if options.downloadEpisodes:
eps = rss.getEpisodes(podcast, options.episodes, options.numEpisodes)
for ep in eps:
files.saveEpisode(podcast, ep)
files.saveEpisode(podcast, ep, options)
if not options.generate:
exit(0)