Skip to content

Commit 870ba66

Browse files
authored
Refactor and cleanup tag methods (#875)
* Refactor tag functions into EditTagsMixin * Fix test mixins tag use of _tagSingular * Add kwargs to editTags * Fix _tagSingular and _tagPlural if tag is already singular or plural * Make editing tags chainable * Add chaining example to doc string * Update editTags doc string for batch editing
1 parent 59638dc commit 870ba66

File tree

4 files changed

+134
-107
lines changed

4 files changed

+134
-107
lines changed

plexapi/base.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -591,22 +591,6 @@ def saveEdits(self):
591591
self._edit(**edits)
592592
return self.reload()
593593

594-
def _edit_tags(self, tag, items, locked=True, remove=False):
595-
""" Helper to edit tags.
596-
597-
Parameters:
598-
tag (str): Tag name.
599-
items (list): List of tags to add.
600-
locked (bool): True to lock the field.
601-
remove (bool): True to remove the tags in items.
602-
"""
603-
if not isinstance(items, list):
604-
items = [items]
605-
value = getattr(self, utils.tag_plural(tag))
606-
existing_tags = [t.tag for t in value if t and remove is False]
607-
tag_edits = utils.tag_helper(tag, existing_tags + items, locked, remove)
608-
self.edit(**tag_edits)
609-
610594
def refresh(self):
611595
""" Refreshing a Library or individual item causes the metadata for the item to be
612596
refreshed, even if it already has metadata. You can think of refreshing as

0 commit comments

Comments
 (0)