+ @log
+ def export_to_library (self, video_id, alt_title):
+ """Adds an item to the local library
+
+ Parameters
+ ----------
+ video_id : :obj:`str`
+ ID of the movie or show
+
+ alt_title : :obj:`str`
+ Alternative title (for the folder written to disc)
+ """
+ metadata = self.netflix_session.fetch_metadata(id=video_id)
+ # check for any errors
+ if self._is_dirty_response(response=metadata):
+ return False
+ video = metadata['video']
+
+ if video['type'] == 'movie':
+ self.library.add_movie(title=video['title'], alt_title=alt_title, year=video['year'], video_id=video_id, pin=video['requiresPin'], build_url=self.build_url)
+ if video['type'] == 'show':
+ episodes = []
+ for season in video['seasons']:
+ for episode in season['episodes']:
+ episodes.append({'season': season['seq'], 'episode': episode['seq'], 'id': episode['id'], 'pin': episode['requiresAdultVerification']})
+
+ self.library.add_show(title=video['title'], alt_title=alt_title, episodes=episodes, build_url=self.build_url)
+ return self.kodi_helper.refresh()
+
+ @log
+ def remove_from_library (self, video_id, season=None, episode=None):
+ """Removes an item from the local library
+
+ Parameters
+ ----------
+ video_id : :obj:`str`
+ ID of the movie or show
+ """
+ metadata = self.netflix_session.fetch_metadata(id=video_id)
+ # check for any errors
+ if self._is_dirty_response(response=metadata):
+ return False
+ video = metadata['video']
+
+ if video['type'] == 'movie':
+ self.library.remove_movie(title=video['title'], year=video['year'])
+ if video['type'] == 'show':
+ self.library.remove_show(title=video['title'])
+ return self.kodi_helper.refresh()
+