String & remove like/dislike

To review: music rating since server does not have like/dislike anymore
This commit is contained in:
angelblue05 2016-06-19 20:32:09 -05:00
parent 313899c8e7
commit 0efc37f646
4 changed files with 63 additions and 71 deletions

View file

@ -258,15 +258,13 @@
<!-- contextmenu -->
<string id="30401">Emby options</string>
<string id="30402">Clear like for this item</string>
<string id="30403">Like this item</string>
<string id="30404">Dislike this item</string>
<string id="30405">Add to Emby favorites</string>
<string id="30406">Remove from Emby favorites</string>
<string id="30407">Set custom song rating</string>
<string id="30408">Emby addon settings</string>
<string id="30409">Delete item from the server</string>
<string id="30410">Refresh this item</string>
<string id="30411">Set custom song rating (0-5)</string>
<!-- add-on settings -->
<string id="30000">Primary Server Address</string><!-- Verified -->
@ -358,5 +356,6 @@
<string id="33038">Add network credentials to allow Kodi access to your content? Important: Kodi will need to be restarted to see the credentials. They can also be added at a later time.</string>
<string id="33039">Disable Emby music library?</string>
<string id="33040">Direct stream the music library? Select this option if the music library will be remotely accessed.</string>
<string id="33041">Delete file(s) from Emby Server? This will also delete the file(s) from disk!</string>
</strings>

View file

@ -15,11 +15,11 @@ import base64
import read_embyserver as embyserver
from utils import Logging, window
log = Logging('MusicTools').log
#################################################################################################
# Helper for the music library, intended to fix missing song ID3 tags on Emby
log = Logging('MusicTools').log
def getRealFileName(filename, isTemp=False):
#get the filename path accessible by python if possible...

View file

@ -539,32 +539,20 @@ class Read_EmbyServer():
return sorted_items
def updateUserRating(self, itemid, like=None, favourite=None, deletelike=False):
def updateUserRating(self, itemid, favourite=None):
# Updates the user rating to Emby
doUtils = self.doUtils
if favourite:
url = "{server}/emby/Users/{UserId}/FavoriteItems/%s?format=json" % itemid
doUtils(url, action_type="POST")
elif favourite == False:
elif not favourite:
url = "{server}/emby/Users/{UserId}/FavoriteItems/%s?format=json" % itemid
doUtils(url, action_type="DELETE")
if not deletelike and like:
url = "{server}/emby/Users/{UserId}/Items/%s/Rating?Likes=true&format=json" % itemid
doUtils(url, action_type="POST")
elif not deletelike and like is False:
url = "{server}/emby/Users/{UserId}/Items/%s/Rating?Likes=false&format=json" % itemid
doUtils(url, action_type="POST")
elif deletelike:
url = "{server}/emby/Users/{UserId}/Items/%s/Rating?format=json" % itemid
doUtils(url, action_type="DELETE")
else:
log("Error processing user rating.", 1)
log("Update user rating to emby for itemid: %s "
"| like: %s | favourite: %s | deletelike: %s"
% (itemid, like, favourite, deletelike), 1)
log("Update user rating to emby for itemid: %s | favourite: %s" % (itemid, favourite), 1)
def refreshItem(self, itemid):
@ -578,4 +566,9 @@ class Read_EmbyServer():
'ReplaceAllMetadata': True
}
self.doUtils(url, postBody=params, action_type="POST")
self.doUtils(url, postBody=params, action_type="POST")
def deleteItem(self, itemid):
url = "{server}/emby/Items/%s?format=json" % itemId
self.doUtils(url, action_type="DELETE")