{"action":"created","comment":{"url":"https://api.github.com/repos/pkkid/python-plexapi/pulls/comments/128869568","pull_request_review_id":51594710,"id":128869568,"diff_hunk":"@@ -314,6 +316,75 @@ def isPartialObject(self):\n         \"\"\" Returns True if this is not a full object. \"\"\"\n         return not self.isFullObject()\n \n+    def edit(self, **kwargs):\n+        \"\"\" Edit a object.\n+\n+            Parameters:\n+                kwargs (dict): Dict of settings to edit.\n+\n+            Example:\n+\n+                {'type': 1,\n+                 'id': movie.ratingKey,\n+                 'collection[0].tag.tag': 'Super',\n+                 'collection.locked': 0\n+                }\n+\n+        \"\"\"\n+        if 'id' not in kwargs:\n+            kwargs['id'] = self.ratingKey\n+        if 'type' not in kwargs:\n+            kwargs['type'] = utils.searchType(self.type)\n+\n+        part = '/library/sections/%s/all?%s' % (self.librarySectionID, urlencode(kwargs))\n+        self._server.query(part, method=self._server._session.put)\n+\n+    def _edit_tags(self, tag, items, locked=True, remove=False):\n+        \"\"\"Helper to edit and refresh a tags.\n+\n+            Parameters:\n+                tag (str): tag name\n+                items (list): list of tags to add\n+                locked (bool): lock this field.\n+                remove (bool): If this is active remove the tags in items.\n+            Returns:\n+                None\n+\n+        \"\"\"\n+        if not isinstance(items, list):\n+            items = [items]\n+\n+        existing_cols = [t.tag for t in self.collections if t and remove is False]\n+        d = tag_helper(tag, existing_cols + items, locked, remove)\n+        self.edit(**d)\n+        self.refresh()\n+\n+    def addCollection(self, collections):\n+        \"\"\"Add collection(s).\n+\n+           Args:\n+                collections (list): list of strings\n+\n+           Returns:\n+                None\n+        \"\"\"\n+        self._edit_tags('collection', collections)\n+\n+    def removeCollection(self, collections):\n+        self._edit_tags('collection', collections, remove=True)\n+\n+    def addLabel(self, labels):\n+        self._edit_tags('collection', labels)","path":"plexapi/base.py","position":89,"original_position":89,"commit_id":"145f49808bf4dd4f8e5dabcf475de64ebf0e6a03","original_commit_id":"145f49808bf4dd4f8e5dabcf475de64ebf0e6a03","user":{"login":"JonnyWong16","id":9099342,"avatar_url":"https://avatars1.githubusercontent.com/u/9099342?v=4","gravatar_id":"","url":"https://api.github.com/users/JonnyWong16","html_url":"https://github.com/JonnyWong16","followers_url":"https://api.github.com/users/JonnyWong16/followers","following_url":"https://api.github.com/users/JonnyWong16/following{/other_user}","gists_url":"https://api.github.com/users/JonnyWong16/gists{/gist_id}","starred_url":"https://api.github.com/users/JonnyWong16/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JonnyWong16/subscriptions","organizations_url":"https://api.github.com/users/JonnyWong16/orgs","repos_url":"https://api.github.com/users/JonnyWong16/repos","events_url":"https://api.github.com/users/JonnyWong16/events{/privacy}","received_events_url":"https://api.github.com/users/JonnyWong16/received_events","type":"User","site_admin":false},"body":"`'label'`","created_at":"2017-07-21T21:58:06Z","updated_at":"2017-07-21T21:58:06Z","html_url":"https://github.com/pkkid/python-plexapi/pull/151#discussion_r128869568","pull_request_url":"https://api.github.com/repos/pkkid/python-plexapi/pulls/151","_links":{"self":{"href":"https://api.github.com/repos/pkkid/python-plexapi/pulls/comments/128869568"},"html":{"href":"https://github.com/pkkid/python-plexapi/pull/151#discussion_r128869568"},"pull_request":{"href":"https://api.github.com/repos/pkkid/python-plexapi/pulls/151"}}},"pull_request":{"url":"https://api.github.com/repos/pkkid/python-plexapi/pulls/151","id":130765579,"html_url":"https://github.com/pkkid/python-plexapi/pull/151","diff_url":"https://github.com/pkkid/python-plexapi/pull/151.diff","patch_url":"https://github.com/pkkid/python-plexapi/pull/151.patch","issue_url":"https://api.github.com/repos/pkkid/python-plexapi/issues/151","number":151,"state":"open","locked":false,"title":"Init edit.","user":{"login":"Hellowlol","id":1214134,"avatar_url":"https://avatars1.githubusercontent.com/u/1214134?v=4","gravatar_id":"","url":"https://api.github.com/users/Hellowlol","html_url":"https://github.com/Hellowlol","followers_url":"https://api.github.com/users/Hellowlol/followers","following_url":"https://api.github.com/users/Hellowlol/following{/other_user}","gists_url":"https://api.github.com/users/Hellowlol/gists{/gist_id}","starred_url":"https://api.github.com/users/Hellowlol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hellowlol/subscriptions","organizations_url":"https://api.github.com/users/Hellowlol/orgs","repos_url":"https://api.github.com/users/Hellowlol/repos","events_url":"https://api.github.com/users/Hellowlol/events{/privacy}","received_events_url":"https://api.github.com/users/Hellowlol/received_events","type":"User","site_admin":false},"body":null,"created_at":"2017-07-16T20:46:35Z","updated_at":"2017-07-21T21:58:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6be23acb9e2933c5f089e43b328e0cc9ce1dbdad","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/pkkid/python-plexapi/pulls/151/commits","review_comments_url":"https://api.github.com/repos/pkkid/python-plexapi/pulls/151/comments","review_comment_url":"https://api.github.com/repos/pkkid/python-plexapi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pkkid/python-plexapi/issues/151/comments","statuses_url":"https://api.github.com/repos/pkkid/python-plexapi/statuses/145f49808bf4dd4f8e5dabcf475de64ebf0e6a03","head":{"label":"pkkid:eddit","ref":"eddit","sha":"145f49808bf4dd4f8e5dabcf475de64ebf0e6a03","user":{"login":"pkkid","id":435619,"avatar_url":"https://avatars2.githubusercontent.com/u/435619?v=4","gravatar_id":"","url":"https://api.github.com/users/pkkid","html_url":"https://github.com/pkkid","followers_url":"https://api.github.com/users/pkkid/followers","following_url":"https://api.github.com/users/pkkid/following{/other_user}","gists_url":"https://api.github.com/users/pkkid/gists{/gist_id}","starred_url":"https://api.github.com/users/pkkid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkkid/subscriptions","organizations_url":"https://api.github.com/users/pkkid/orgs","repos_url":"https://api.github.com/users/pkkid/repos","events_url":"https://api.github.com/users/pkkid/events{/privacy}","received_events_url":"https://api.github.com/users/pkkid/received_events","type":"User","site_admin":false},"repo":{"id":28577719,"name":"python-plexapi","full_name":"pkkid/python-plexapi","owner":{"login":"pkkid","id":435619,"avatar_url":"https://avatars2.githubusercontent.com/u/435619?v=4","gravatar_id":"","url":"https://api.github.com/users/pkkid","html_url":"https://github.com/pkkid","followers_url":"https://api.github.com/users/pkkid/followers","following_url":"https://api.github.com/users/pkkid/following{/other_user}","gists_url":"https://api.github.com/users/pkkid/gists{/gist_id}","starred_url":"https://api.github.com/users/pkkid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkkid/subscriptions","organizations_url":"https://api.github.com/users/pkkid/orgs","repos_url":"https://api.github.com/users/pkkid/repos","events_url":"https://api.github.com/users/pkkid/events{/privacy}","received_events_url":"https://api.github.com/users/pkkid/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pkkid/python-plexapi","description":"Python bindings for the Plex API.","fork":false,"url":"https://api.github.com/repos/pkkid/python-plexapi","forks_url":"https://api.github.com/repos/pkkid/python-plexapi/forks","keys_url":"https://api.github.com/repos/pkkid/python-plexapi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pkkid/python-plexapi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pkkid/python-plexapi/teams","hooks_url":"https://api.github.com/repos/pkkid/python-plexapi/hooks","issue_events_url":"https://api.github.com/repos/pkkid/python-plexapi/issues/events{/number}","events_url":"https://api.github.com/repos/pkkid/python-plexapi/events","assignees_url":"https://api.github.com/repos/pkkid/python-plexapi/assignees{/user}","branches_url":"https://api.github.com/repos/pkkid/python-plexapi/branches{/branch}","tags_url":"https://api.github.com/repos/pkkid/python-plexapi/tags","blobs_url":"https://api.github.com/repos/pkkid/python-plexapi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pkkid/python-plexapi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pkkid/python-plexapi/git/refs{/sha}","trees_url":"https://api.github.com/repos/pkkid/python-plexapi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pkkid/python-plexapi/statuses/{sha}","languages_url":"https://api.github.com/repos/pkkid/python-plexapi/languages","stargazers_url":"https://api.github.com/repos/pkkid/python-plexapi/stargazers","contributors_url":"https://api.github.com/repos/pkkid/python-plexapi/contributors","subscribers_url":"https://api.github.com/repos/pkkid/python-plexapi/subscribers","subscription_url":"https://api.github.com/repos/pkkid/python-plexapi/subscription","commits_url":"https://api.github.com/repos/pkkid/python-plexapi/commits{/sha}","git_commits_url":"https://api.github.com/repos/pkkid/python-plexapi/git/commits{/sha}","comments_url":"https://api.github.com/repos/pkkid/python-plexapi/comments{/number}","issue_comment_url":"https://api.github.com/repos/pkkid/python-plexapi/issues/comments{/number}","contents_url":"https://api.github.com/repos/pkkid/python-plexapi/contents/{+path}","compare_url":"https://api.github.com/repos/pkkid/python-plexapi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pkkid/python-plexapi/merges","archive_url":"https://api.github.com/repos/pkkid/python-plexapi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pkkid/python-plexapi/downloads","issues_url":"https://api.github.com/repos/pkkid/python-plexapi/issues{/number}","pulls_url":"https://api.github.com/repos/pkkid/python-plexapi/pulls{/number}","milestones_url":"https://api.github.com/repos/pkkid/python-plexapi/milestones{/number}","notifications_url":"https://api.github.com/repos/pkkid/python-plexapi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pkkid/python-plexapi/labels{/name}","releases_url":"https://api.github.com/repos/pkkid/python-plexapi/releases{/id}","deployments_url":"https://api.github.com/repos/pkkid/python-plexapi/deployments","created_at":"2014-12-29T02:38:06Z","updated_at":"2017-07-20T06:49:19Z","pushed_at":"2017-07-21T21:25:13Z","git_url":"git://github.com/pkkid/python-plexapi.git","ssh_url":"git@github.com:pkkid/python-plexapi.git","clone_url":"https://github.com/pkkid/python-plexapi.git","svn_url":"https://github.com/pkkid/python-plexapi","homepage":"","size":1633,"stargazers_count":171,"watchers_count":171,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":48,"mirror_url":null,"open_issues_count":21,"forks":48,"open_issues":21,"watchers":171,"default_branch":"master"}},"base":{"label":"pkkid:master","ref":"master","sha":"36630d7448f40526697195375121cad8beede62e","user":{"login":"pkkid","id":435619,"avatar_url":"https://avatars2.githubusercontent.com/u/435619?v=4","gravatar_id":"","url":"https://api.github.com/users/pkkid","html_url":"https://github.com/pkkid","followers_url":"https://api.github.com/users/pkkid/followers","following_url":"https://api.github.com/users/pkkid/following{/other_user}","gists_url":"https://api.github.com/users/pkkid/gists{/gist_id}","starred_url":"https://api.github.com/users/pkkid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkkid/subscriptions","organizations_url":"https://api.github.com/users/pkkid/orgs","repos_url":"https://api.github.com/users/pkkid/repos","events_url":"https://api.github.com/users/pkkid/events{/privacy}","received_events_url":"https://api.github.com/users/pkkid/received_events","type":"User","site_admin":false},"repo":{"id":28577719,"name":"python-plexapi","full_name":"pkkid/python-plexapi","owner":{"login":"pkkid","id":435619,"avatar_url":"https://avatars2.githubusercontent.com/u/435619?v=4","gravatar_id":"","url":"https://api.github.com/users/pkkid","html_url":"https://github.com/pkkid","followers_url":"https://api.github.com/users/pkkid/followers","following_url":"https://api.github.com/users/pkkid/following{/other_user}","gists_url":"https://api.github.com/users/pkkid/gists{/gist_id}","starred_url":"https://api.github.com/users/pkkid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkkid/subscriptions","organizations_url":"https://api.github.com/users/pkkid/orgs","repos_url":"https://api.github.com/users/pkkid/repos","events_url":"https://api.github.com/users/pkkid/events{/privacy}","received_events_url":"https://api.github.com/users/pkkid/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pkkid/python-plexapi","description":"Python bindings for the Plex API.","fork":false,"url":"https://api.github.com/repos/pkkid/python-plexapi","forks_url":"https://api.github.com/repos/pkkid/python-plexapi/forks","keys_url":"https://api.github.com/repos/pkkid/python-plexapi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pkkid/python-plexapi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pkkid/python-plexapi/teams","hooks_url":"https://api.github.com/repos/pkkid/python-plexapi/hooks","issue_events_url":"https://api.github.com/repos/pkkid/python-plexapi/issues/events{/number}","events_url":"https://api.github.com/repos/pkkid/python-plexapi/events","assignees_url":"https://api.github.com/repos/pkkid/python-plexapi/assignees{/user}","branches_url":"https://api.github.com/repos/pkkid/python-plexapi/branches{/branch}","tags_url":"https://api.github.com/repos/pkkid/python-plexapi/tags","blobs_url":"https://api.github.com/repos/pkkid/python-plexapi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pkkid/python-plexapi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pkkid/python-plexapi/git/refs{/sha}","trees_url":"https://api.github.com/repos/pkkid/python-plexapi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pkkid/python-plexapi/statuses/{sha}","languages_url":"https://api.github.com/repos/pkkid/python-plexapi/languages","stargazers_url":"https://api.github.com/repos/pkkid/python-plexapi/stargazers","contributors_url":"https://api.github.com/repos/pkkid/python-plexapi/contributors","subscribers_url":"https://api.github.com/repos/pkkid/python-plexapi/subscribers","subscription_url":"https://api.github.com/repos/pkkid/python-plexapi/subscription","commits_url":"https://api.github.com/repos/pkkid/python-plexapi/commits{/sha}","git_commits_url":"https://api.github.com/repos/pkkid/python-plexapi/git/commits{/sha}","comments_url":"https://api.github.com/repos/pkkid/python-plexapi/comments{/number}","issue_comment_url":"https://api.github.com/repos/pkkid/python-plexapi/issues/comments{/number}","contents_url":"https://api.github.com/repos/pkkid/python-plexapi/contents/{+path}","compare_url":"https://api.github.com/repos/pkkid/python-plexapi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pkkid/python-plexapi/merges","archive_url":"https://api.github.com/repos/pkkid/python-plexapi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pkkid/python-plexapi/downloads","issues_url":"https://api.github.com/repos/pkkid/python-plexapi/issues{/number}","pulls_url":"https://api.github.com/repos/pkkid/python-plexapi/pulls{/number}","milestones_url":"https://api.github.com/repos/pkkid/python-plexapi/milestones{/number}","notifications_url":"https://api.github.com/repos/pkkid/python-plexapi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pkkid/python-plexapi/labels{/name}","releases_url":"https://api.github.com/repos/pkkid/python-plexapi/releases{/id}","deployments_url":"https://api.github.com/repos/pkkid/python-plexapi/deployments","created_at":"2014-12-29T02:38:06Z","updated_at":"2017-07-20T06:49:19Z","pushed_at":"2017-07-21T21:25:13Z","git_url":"git://github.com/pkkid/python-plexapi.git","ssh_url":"git@github.com:pkkid/python-plexapi.git","clone_url":"https://github.com/pkkid/python-plexapi.git","svn_url":"https://github.com/pkkid/python-plexapi","homepage":"","size":1633,"stargazers_count":171,"watchers_count":171,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":48,"mirror_url":null,"open_issues_count":21,"forks":48,"open_issues":21,"watchers":171,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pkkid/python-plexapi/pulls/151"},"html":{"href":"https://github.com/pkkid/python-plexapi/pull/151"},"issue":{"href":"https://api.github.com/repos/pkkid/python-plexapi/issues/151"},"comments":{"href":"https://api.github.com/repos/pkkid/python-plexapi/issues/151/comments"},"review_comments":{"href":"https://api.github.com/repos/pkkid/python-plexapi/pulls/151/comments"},"review_comment":{"href":"https://api.github.com/repos/pkkid/python-plexapi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pkkid/python-plexapi/pulls/151/commits"},"statuses":{"href":"https://api.github.com/repos/pkkid/python-plexapi/statuses/145f49808bf4dd4f8e5dabcf475de64ebf0e6a03"}}}}
{"actor":{"display_login":"JonnyWong16"}}