def remove_movie(self, title, year):
"""Removes the DB entry & the strm file for the movie given
Parameters
----------
title : :obj:`str`
Title of the movie
year : :obj:`int`
Release year of the movie
Returns
-------
bool
Delete successfull
"""
title = re.sub(r'[?|$|!|:|#]', r'', title)
movie_meta = '%s (%d)' % (title, year)
folder = re.sub(
pattern=r'[?|$|!|:|#]',
repl=r'',
string=self.db[self.movies_label][movie_meta]['alt_title'])
progress = xbmcgui.DialogProgress()
progress.create(self.kodi_helper.get_local_string(1210), movie_meta)
progress.update(50)
time.sleep(0.5)
del self.db[self.movies_label][movie_meta]
self._update_local_db(filename=self.db_filepath, db=self.db)
dirname = self.kodi_helper.check_folder_path(
path=os.path.join(self.movie_path, folder))
filename = os.path.join(self.movie_path, folder, movie_meta + '.strm')
if xbmcvfs.exists(dirname):
xbmcvfs.delete(filename)
xbmcvfs.rmdir(dirname)
return True
return False
time.sleep(1)
progress.close()
评论列表
文章目录