Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LibrarySection methods to multi-edit items #1184

Merged
merged 9 commits into from
Jul 27, 2023

Conversation

JonnyWong16
Copy link
Collaborator

@JonnyWong16 JonnyWong16 commented Jul 13, 2023

Description

  • Adds LibrarySection methods to multi-edit items.
    • common(items) lists all common fields/tags between all items in a new Common object.
    • multiEdit(items) used to edit multiple items at once.
      • Note: This is a low level method, use batchMultiEdits() instead.
    • batchMultiEdits(items) used to enable batch multi-editing mode.
    • saveMultiEdits() to save all the batch multi-edits.
  • Adds UserRatingMixin.
    • Note: rate() is equivalent to rating media on the pre-play screen whereas editUserRating() is equivalent to rating media in the edit modal.
  • Updates the base fetchItems() to accept a list of rating keys (int) to fetch multiple items at once.
  • Removes deprecated banner resource and all related objects.

Example:

Multi-editing:

movies = MovieSection.all()
items = [movies[0], movies[3], movies[5]]  # List of items to multi-edit

# Batch multi-editing multiple fields and tags in a single API call
MovieSection.batchMultiEdits(items)
MovieSection.editTitle('A New Title').editSummary('A new summary').editTagline('A new tagline') \\
    .addCollection('New Collection').removeGenre('Action').addLabel('Favorite').lockPoster()
MovieSection.saveMultiEdits()

Multi-fetching:

ratingKeys = [49, 78, 33, 54, 66]
items = PlexServer.fetchItems(ratingKeys)  # Return a list of multiple items in a single API call

ratingKey = 38
item = PlexServer.fetchItem(ratingKey)  # Return a single item

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the docstring for new or existing methods
  • I have added tests when applicable

@JonnyWong16 JonnyWong16 merged commit 9ede493 into pkkid:master Jul 27, 2023
3 checks passed
@JonnyWong16 JonnyWong16 deleted the feature/multiedit branch July 27, 2023 21:46
@JonnyWong16 JonnyWong16 mentioned this pull request Jul 27, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant