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

View file

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