Add plex.update_playlist method
MODIFY
plextraktsync/plex_api.py
plextraktsync/plex_api.py
@@ -606,6 +606,19 @@ def ratings(self):
def rate(self, m, rating):
m.rate(rating)
+ @nocache
+ def update_playlist(self, name: str, items: List):
+ """
+ Updates playlist (creates if name missing) replacing contents with items[]
+ """
+ try:
+ playlist = self.plex.playlist(name)
+ except NotFound:
+ playlist = self.plex.createPlaylist(name)
+
+ playlist.removeItems(playlist.items())
+ playlist.addItems(items)
+
@nocache
def create_playlist(self, name: str, items):
_, plex_items_sorted = zip(*sorted(dict(reversed(items)).items()))

Add plex.update_playlist method