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 new methods to edit object fields #876

Merged
merged 18 commits into from
Feb 27, 2022

Conversation

JonnyWong16
Copy link
Collaborator

@JonnyWong16 JonnyWong16 commented Jan 21, 2022

Description

Adds a new EditFieldMixin to edit Plex object fields (title, summary, content rating, etc.).

  • New base method EditFieldMixin.editField()

Each of the following field mixin subclasses EditFieldMixin.

  • Common fields: ContentRatingMixin, OriginallyAvailableMixin, OriginalTitleMixin, SortTitleMixin, StudioMixin, SummaryMixin, TaglineMixin, TitleMixin
  • Unique for tracks: TrackArtistMixin, TrackNumberMixin, TrackDiscNumberMixin
  • Unique for photos: PhotoCapturedTimeMixin

Adds new batch editing mode to save all edits in a single API call.

  • New methods PlexPartialObject.batchEdits() and PlexPartialObject.saveEdits().

Examples:

# Single edits
Movie.editTitle('A New Title', locked=True)
Show.editSummary('A summary of the show.')
Episode.editContentRating('TV-14')
Artist.editStudio('New Record Label')
Track.editTrackArtist('New Artist')

# Chaining multiple edits with reloading (individual API call for each edit)
Movie.editTitle('A New Title').editSummary('A new summary').editTagline('A new tagline').reload()

# Batch editing multiple fields and tags in a single API call
Movie.batchEdits()
Movie.editTitle('A New Title').editSummary('A new summary').editTagline('A new tagline') \
    .addCollection('New Collection').removeGenre('Action').addLabel('Favorite')
Movie.saveEdits()

Closes #354

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 changed the title Add new convenience methods to edit object fields Add new methods to edit object fields Jan 24, 2022
@JonnyWong16 JonnyWong16 mentioned this pull request Feb 7, 2022
7 tasks
@JonnyWong16 JonnyWong16 merged commit 59638dc into pkkid:master Feb 27, 2022
@JonnyWong16 JonnyWong16 deleted the feature/edit branch April 7, 2022 17:05
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.

Editing userRating of a track does not save
1 participant