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

Refactor and cleanup tag methods #875

Merged
merged 8 commits into from
Feb 27, 2022

Conversation

JonnyWong16
Copy link
Collaborator

@JonnyWong16 JonnyWong16 commented Jan 21, 2022

Description

Refactor all tag methods into EditTagsMixin.

  • Moves PlexPartialObject._edit_tags() (deprecated) to EditTagsMixin.editTags()
  • Moves utils.tag_singular() to EditTagsMixin._tagSingular()
  • Moves utils.tag_plural() to EditTagsMixin._tagPlural()
  • Moves utils.tag_helper() to EditTagsMixin._tagHelper()
  • All other tag mixins subclass EditTagsMixin
  • Make editing tags chainable

Batch editing mode added in #876.

Example:

# Chaining multiple tags with reloading (individual API call for each edit)
Movie.addCollection('New Collection').removeGenre('Action').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()

Type of change

Please delete options that are not relevant.

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 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 (no new tests required)

@JonnyWong16 JonnyWong16 merged commit 870ba66 into pkkid:master Feb 27, 2022
@JonnyWong16 JonnyWong16 deleted the bugfix/edit_tags branch April 7, 2022 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant