def remove_episode(self, title, season, episode):
"""Removes the DB entry & the strm files for an episode of a show given
Parameters
----------
title : :obj:`str`
Title of the show
season : :obj:`int`
Season sequence number
episode : :obj:`int`
Episode sequence number
Returns
-------
bool
Delete successfull
"""
title = re.sub(r'[?|$|!|:|#]', r'', title.encode('utf-8'))
episodes_list = []
show_meta = '%s' % (title)
episode_meta = 'S%02dE%02d' % (season, episode)
alt_title = self.db[self.series_label][show_meta]['alt_title']
show_dir = self.kodi_helper.check_folder_path(
path=os.path.join(self.tvshow_path, alt_title))
if xbmcvfs.exists(os.path.join(show_dir, episode_meta + '.strm')):
xbmcvfs.delete(os.path.join(show_dir, episode_meta + '.strm'))
for episode_entry in self.db[self.series_label][show_meta]['episodes']:
if episode_meta != episode_entry:
episodes_list.append(episode_entry)
self.db[self.series_label][show_meta]['episodes'] = episodes_list
self._update_local_db(filename=self.db_filepath, db=self.db)
return True
评论列表
文章目录