ghomasHudson / Jellyfin-Auto-Collections

Automatically make jellyfin collections from IMDB, Letterboxd lists and more.
MIT License
60 stars 9 forks source link

ability to remove/edit collection #5

Closed vortex91 closed 1 month ago

vortex91 commented 1 year ago

For top playlists it would be nice to remove entries.

  1. config to have playlist name from jellyfin along with matching imdb list or chart
  2. So logic would be read all entries in that collection name
  3. if imdb list does not contain that movie name then remove jf collection name
  4. add any missing movies which are in list/chart but not in jf collection name
vortex91 commented 11 months ago

i got this working via creating hardlinks since i cant for the life of me figure out the API to remove a movie from a specific collection. Any chance you can make util which handles lookup and removal of a movie in specific collection?

ghomasHudson commented 11 months ago

i got this working via creating hardlinks since i cant for the life of me figure out the API to remove a movie from a specific collection. Any chance you can make util which handles lookup and removal of a movie in specific collection?

yeah the Jellyfin API is not the easiest to work with. Here's the relevent api path: https://api.jellyfin.org/#tag/Collection/operation/RemoveFromCollection

It should be similar to adding a movie. E.g.

requests.delete(f'{server_url}/Collections/{collection_id}/Items?ids={movie_id}',headers=headers, params=params2)

The current logic would probably need modifying to, e.g.

  1. Keep track of all movie_ids added to a collection
  2. Get all movie_ids currently in the collection
  3. Remove any movies (see above) which are in the second list and not in the first.

I should have time to work on this later this evening. To be honest, this whole project needs a bit of a refactor.

ghomasHudson commented 1 month ago

This is now implemented in a super basic way. Add the clear_collection: true flag to a plugin which will remove all the entries from a collection before adding them again.