Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
:param force:
:type force: bool
"""
if not self.is_location_valid():
logger.log(u"Episode file doesn't exist, can't download subtitles for {} {}".format
(self.show.name, episode_num(self.season, self.episode) or
episode_num(self.season, self.episode, numbering='absolute')), logger.DEBUG)
return
new_subtitles = subtitles.download_subtitles(self)
if new_subtitles:
self.subtitles = subtitles.merge_subtitles(self.subtitles, new_subtitles)
self.subtitles_searchcount += 1 if self.subtitles_searchcount else 1
self.subtitles_lastsearch = datetime.datetime.now().strftime(dateTimeFormat)
self.save_to_db()
if new_subtitles:
subtitle_list = ', '.join([subtitles.name_from_code(code) for code in new_subtitles])
logger.log(u'Downloaded {} subtitles for {} {}'.format
(subtitle_list, self.show.name, episode_num(self.season, self.episode) or
episode_num(self.season, self.episode, numbering='absolute')))
notifiers.notify_subtitle_download(self.pretty_name(), subtitle_list)
return new_subtitles