ace20022 / service.LanguagePreferenceManager

A manager for audio and subtitle preferences
GNU General Public License v2.0
9 stars 18 forks source link

Error when using own subclass of xbmc.Player #3

Closed zbyna closed 8 years ago

zbyna commented 8 years ago

Hi, I am creating another feature for custom addon and after subclassing xbmc.Player() on my own I see this error:

23:02:59 T:2768   DEBUG: [Language Preference Manager]: {u'jsonrpc': u'2.0', u'id': 1, u'error': {u'message': u'Failed to execute method.', u'code': -32100}}
23:02:59 T:2768   DEBUG: JSONRPC: Incoming request: {"jsonrpc": "2.0", "method": "Player.GetItem", "params": { "properties": ["genre", "tag"], "playerid": 1 }, "id": 1}
23:02:59 T:7872   DEBUG: JSONRPC: Incoming request: {"jsonrpc": "2.0", "id": 1, "method": "Player.GetActivePlayers"}
23:02:59 T:7872   DEBUG: JSONRPC: Incoming request: {"jsonrpc": "2.0", "id": 1, "method": "Player.GetItem", "params": {"playerid": 0, "properties": ["showtitle", "tvshowid", "episode", "season", "playcount","genre"] } }
23:02:59 T:2768   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.AttributeError'>
                                            Error Contents: 'LangPrefMan_Player' object has no attribute 'genres_and_tags'
                                            Traceback (most recent call last):
                                              File "C:\Users\decak\AppData\Roaming\Kodi\addons\service.LanguagePreferenceManager\default.py", line 82, in onPlayBackStarted
                                                self.getDetails()
                                              File "C:\Users\decak\AppData\Roaming\Kodi\addons\service.LanguagePreferenceManager\default.py", line 304, in getDetails
                                                log(LOG_DEBUG, 'Video tags/genres: {0}'.format(self.genres_and_tags))
                                            AttributeError: 'LangPrefMan_Player' object has no attribute 'genres_and_tags'
                                            -->End of Python script error report<--

It may be joined with my filling list info with:

def adjustGenre(genre):
        result = ''
        for g in genre:
            result = result + g + u' / '
        return result[:-3]

so the result is:

 "genre": "Dobrodru\u017en\u00fd / Krimi / Drama / Historick\u00fd", 

I enclose full log:

kodi.txt

Thanks for reply.

zbyna commented 8 years ago

I have fixed it, here is pull request: https://github.com/ace20022/service.LanguagePreferenceManager/pull/4 Thanks for merging

ace20022 commented 8 years ago

It may be joined with my filling list info with:

def adjustGenre(genre): result = '' for g in genre: result = result + g + u' / ' return result[:-3]

so the result is:

"genre": "Dobrodru\u017en\u00fd / Krimi / Drama / Historick\u00fd",

I don't get what this is for.

zbyna commented 8 years ago

I thought that supplying adjusted genre string should caused my issue but it was impasse.