Fix class __repr__ to account for Python 3
This commit is contained in:
parent
f771b8d3aa
commit
4b4dc1afbf
4 changed files with 5 additions and 22 deletions
|
@ -94,8 +94,7 @@ class Section(object):
|
|||
"'section_type': '{self.section_type}', "
|
||||
"'sync_to_kodi': {self.sync_to_kodi}, "
|
||||
"'last_sync': {self.last_sync}"
|
||||
"}}").format(self=self).encode('utf-8')
|
||||
__str__ = __repr__
|
||||
"}}").format(self=self)
|
||||
|
||||
def __bool__(self):
|
||||
return (self.section_id is not None and
|
||||
|
|
|
@ -86,12 +86,8 @@ class Playqueue_Object(object):
|
|||
"'repeat': {self.repeat}, "
|
||||
"'kodi_playlist_playback': {self.kodi_playlist_playback}, "
|
||||
"'pkc_edit': {self.pkc_edit}, ".format(self=self))
|
||||
answ = answ.encode('utf-8')
|
||||
# Since list.__repr__ will return string, not unicode
|
||||
return answ + b"'items': {self.items}}}".format(self=self)
|
||||
|
||||
def __str__(self):
|
||||
return self.__repr__()
|
||||
return answ + "'items': {self.items}}}".format(self=self)
|
||||
|
||||
def is_pkc_clear(self):
|
||||
"""
|
||||
|
@ -201,7 +197,7 @@ class PlaylistItem(object):
|
|||
def uri(self):
|
||||
return self._uri
|
||||
|
||||
def __unicode__(self):
|
||||
def __repr__(self):
|
||||
return ("{{"
|
||||
"'id': {self.id}, "
|
||||
"'plex_id': {self.plex_id}, "
|
||||
|
@ -217,9 +213,6 @@ class PlaylistItem(object):
|
|||
"'force_transcode': {self.force_transcode}, "
|
||||
"'part': {self.part}".format(self=self))
|
||||
|
||||
def __repr__(self):
|
||||
return self.__unicode__().encode('utf-8')
|
||||
|
||||
def plex_stream_index(self, kodi_stream_index, stream_type):
|
||||
"""
|
||||
Pass in the kodi_stream_index [int] in order to receive the Plex stream
|
||||
|
|
|
@ -64,7 +64,7 @@ class Playlist(object):
|
|||
self.kodi_type = None
|
||||
self.kodi_hash = None
|
||||
|
||||
def __unicode__(self):
|
||||
def __repr__(self):
|
||||
return ("{{"
|
||||
"'plex_id': {self.plex_id}, "
|
||||
"'plex_name': '{self.plex_name}', "
|
||||
|
@ -75,12 +75,6 @@ class Playlist(object):
|
|||
"'kodi_hash': '{self.kodi_hash}'"
|
||||
"}}").format(self=self)
|
||||
|
||||
def __repr__(self):
|
||||
return self.__unicode__().encode('utf-8')
|
||||
|
||||
def __str__(self):
|
||||
return self.__repr__()
|
||||
|
||||
def __bool__(self):
|
||||
return (self.plex_id and self.plex_updatedat and self.plex_name and
|
||||
self._kodi_path and self.kodi_filename and self.kodi_type and
|
||||
|
|
|
@ -267,14 +267,11 @@ class AttributeDict(dict):
|
|||
def __setattr__(self, attr, value):
|
||||
self[attr] = value
|
||||
|
||||
def __unicode__(self):
|
||||
def __repr__(self):
|
||||
return '<{0}:{1}:{2}>'.format(self.__class__.__name__,
|
||||
self.id,
|
||||
self.get('title', 'None'))
|
||||
|
||||
def __repr__(self):
|
||||
return self.__unicode__().encode('utf-8')
|
||||
|
||||
|
||||
def cast(func, value):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue