-
Notifications
You must be signed in to change notification settings - Fork 200
Add Favorite options for Photos #342
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,6 +93,7 @@ class Photo(PlexPartialObject): | |
title (str): Photo title. | ||
type (str): Unknown | ||
updatedAt (datatime): Datetime this item was updated. | ||
userRating (float): To mark photo as favorite (0.0, 10.0) 10.0 = favorite | ||
year (int): Year this photo was taken. | ||
""" | ||
TAG = 'Photo' | ||
|
@@ -115,9 +116,22 @@ def _loadData(self, data): | |
self.title = data.attrib.get('title') | ||
self.type = data.attrib.get('type') | ||
self.updatedAt = utils.toDatetime(data.attrib.get('updatedAt')) | ||
self.userRating = utils.cast(float, data.attrib.get('userRating', 0)) | ||
self.year = utils.cast(int, data.attrib.get('year')) | ||
self.media = self.findItems(data, media.Media) | ||
|
||
def favorite(self): | ||
""" Mark photo as favorite""" | ||
key = '/:/rate?key=%s&rating=10.0&identifier=com.plexapp.plugins.library' % self.ratingKey | ||
self._server.query(key) | ||
self.reload() | ||
|
||
def unfavorite(self): | ||
""" Remove favorite mark from photo""" | ||
key = '/:/rate?key=%s&rating=0&identifier=com.plexapp.plugins.library' % self.ratingKey | ||
self._server.query(key) | ||
self.reload() | ||
|
||
def photoalbum(self): | ||
""" Return this photo's :class:`~plexapi.photo.Photoalbum`. """ | ||
return self.fetchItem(self.parentKey) | ||
|
@@ -158,6 +172,7 @@ def sync(self, resolution, client=None, clientId=None, limit=None, title=None): | |
sync_item.contentType = self.listType | ||
sync_item.metadataType = self.METADATA_TYPE | ||
sync_item.machineIdentifier = self._server.machineIdentifier | ||
sync_item.userRating = self.userRating | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let me repeat my question: why are you assigning Maybe you could be polite yourself and answer the simple and not rude in any way question without throwing a tantrum? You're in the Internet, man, there are a lot of different cultures (in some of them being straightforward is the proper way of doing things, not the rude one) and not everybody here would like to offend you. Not marking conversation as resolved when it isn't seems for me like a good idea as well. |
||
|
||
section = self.section() | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.