X-Git-Url: http://git.code-monkey.de/?p=plugin.video.netflix.git;a=blobdiff_plain;f=resources%2Flib%2FLibrary.py;h=0d70ad3c359c95abb9187f7d8ad237b9bc161005;hp=8c1d841217d786f23ae27af9abcd8fe9e7b62c74;hb=86455dfff7e4878e5192dd97991f2e96a3021739;hpb=b0976bc1b439d881585d37a79e3ea60fbeefa306 diff --git a/resources/lib/Library.py b/resources/lib/Library.py index 8c1d841..0d70ad3 100644 --- a/resources/lib/Library.py +++ b/resources/lib/Library.py @@ -4,12 +4,12 @@ # Created on: 13.01.2017 import os -import shutil +from shutil import rmtree +from utils import noop try: import cPickle as pickle except: import pickle -from utils import noop class Library: """Exports Netflix shows & movies to a local library folder""" @@ -218,7 +218,7 @@ class Library: episode_entry = 'S%02dE%02d' % (season, episode) return episode_entry in show_entry['episodes'] - def add_movie (self, title, alt_title, year, video_id, pin, build_url): + def add_movie (self, title, alt_title, year, video_id, build_url): """Adds a movie to the local db, generates & persists the strm file Parameters @@ -235,9 +235,6 @@ class Library: video_id : :obj:`str` ID of the video to be played - pin : bool - Needs adult pin - build_url : :obj:`fn` Function to generate the stream url """ @@ -253,7 +250,7 @@ class Library: if self.movie_exists(title=title, year=year) == False: self.db[self.movies_label][movie_meta] = {'alt_title': alt_title} self._update_local_db(filename=self.db_filepath, db=self.db) - self.write_strm_file(path=filename, url=build_url({'action': 'play_video', 'video_id': video_id, 'pin': pin})) + self.write_strm_file(path=filename, url=build_url({'action': 'play_video', 'video_id': video_id})) def add_show (self, title, alt_title, episodes, build_url): """Adds a show to the local db, generates & persists the strm files @@ -283,11 +280,11 @@ class Library: if self.show_exists(title) == False: self.db[self.series_label][show_meta] = {'seasons': [], 'episodes': [], 'alt_title': alt_title} for episode in episodes: - self._add_episode(show_dir=show_dir, title=title, season=episode['season'], episode=episode['episode'], video_id=episode['id'], pin=episode['pin'], build_url=build_url) + self._add_episode(show_dir=show_dir, title=title, season=episode['season'], episode=episode['episode'], video_id=episode['id'], build_url=build_url) self._update_local_db(filename=self.db_filepath, db=self.db) return show_dir - def _add_episode (self, title, show_dir, season, episode, video_id, pin, build_url): + def _add_episode (self, title, show_dir, season, episode, video_id, build_url): """Adds a single episode to the local DB, generates & persists the strm file Parameters @@ -307,9 +304,6 @@ class Library: video_id : :obj:`str` ID of the video to be played - pin : bool - Needs adult pin - build_url : :obj:`fn` Function to generate the stream url """ @@ -330,7 +324,7 @@ class Library: filepath = os.path.join(show_dir, filename) if os.path.exists(filepath): return - self.write_strm_file(path=filepath, url=build_url({'action': 'play_video', 'video_id': video_id, 'pin': pin})) + self.write_strm_file(path=filepath, url=build_url({'action': 'play_video', 'video_id': video_id})) def remove_movie (self, title, year): """Removes the DB entry & the strm file for the movie given @@ -354,7 +348,7 @@ class Library: self._update_local_db(filename=self.db_filepath, db=self.db) dirname = os.path.join(self.movie_path, folder) if os.path.exists(dirname): - shutil.rmtree(dirname) + rmtree(dirname) return True return False @@ -376,7 +370,7 @@ class Library: self._update_local_db(filename=self.db_filepath, db=self.db) show_dir = os.path.join(self.tvshow_path, folder) if os.path.exists(show_dir): - shutil.rmtree(show_dir) + rmtree(show_dir) return True return False