trakt / script.trakt

Trakt.tv movie and TV show scrobbler for Kodi
GNU General Public License v2.0
318 stars 149 forks source link

Error: xbmc.getInfoLabel('ListItem.DBID') returns empty value #510

Open burekas7 opened 4 years ago

burekas7 commented 4 years ago

Hi, @Razzeee

1) Open one of the Video Addons 2) Select an item 3) Open the context menu 4) Choose the Trakr Contextmenu - "Trakt options" 5) Select one of the options, "Rate this ..."

Then I get this error:

ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
     - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
    Error Type: <type 'exceptions.ValueError'>
    Error Contents: invalid literal for int() with base 10: ''
    Traceback (most recent call last):
      File "C:\Users\aUser\AppData\Roaming\Kodi\addons\script.trakt\defaultscript.py", line 14, in <module>
        Main()
      File "C:\Users\aUser\AppData\Roaming\Kodi\addons\script.trakt\defaultscript.py", line 11, in Main
        script.run()
      File "C:\Users\aUser\AppData\Roaming\Kodi\addons\script.trakt\resources\lib\script.py", line 91, in run
        data['dbid'] = int(xbmc.getInfoLabel('ListItem.DBID'))
    ValueError: invalid literal for int() with base 10: ''
    -->End of Python script error report<--

The code from the script.trakt\resources\lib\script.py:

elif args['action'] in ['rate', 'unrate']:
        data = {'action': args['action']}
        media_type = None
        if 'media_type' in args and 'dbid' in args:
            media_type = args['media_type']
            try:
                data['dbid'] = int(args['dbid'])
            except ValueError:
                logger.debug("Manual %s triggered for library item, but DBID is invalid." % args['action'])
                return
        elif 'media_type' in args and 'remoteid' in args:
            media_type = args['media_type']
            data['remoteid'] = args['remoteid']
            try:
                data['season'] = int(args['season'])
                data['episode'] = int(args['episode'])
            except ValueError:
                logger.debug("Error parsing season or episode for manual %s" % args['action'])
                return
            except KeyError:
                pass
        else:
            media_type = kodiUtilities.getMediaType()
            if not utilities.isValidMediaType(media_type):
                logger.debug("Error, not in video library.")
                return
            data['dbid'] = int(xbmc.getInfoLabel('ListItem.DBID'))

So I checked the: xbmc.getInfoLabel('ListItem.DBID') value and I saw that it's empty. I also checked the "args" and get only this: args = {'action': 'rate'} The fact is when I'm in the Kodi libraries it's ok, it does have a value and it's working. The problem occurs only in Video Addons, Trakt lists.

One of the Kodi's team said: "items provided by a video addon usually don't have a dbid, as they're not in the database."

So how does it should work with Video Addons if this code always returns empty value here? Because as I noticed when I followed the code of 'script.py', args never includes a "media_type". This line exist there and "media_type" has a correct value but it is never added to "args" params: media_type = kodiUtilities.getMediaType()

Do you have any info about that? Does it sound familiar to you?


Thanks.

razzeee commented 4 years ago

Are you using the default skin?

burekas7 commented 4 years ago

No. It's the Titan skin. But I'm already using this skin for years.

Regarding the first problem: Probably I have never tested the context menu inside video addons. It seems that it was never supported to work there.

Regarding the second issue, I'm trying to find the relevant code differences between the versions.

razzeee commented 4 years ago

I think Problem one should not happen with the official skins

On Fri, Sep 11, 2020, 14:36 burekas7 notifications@github.com wrote:

No. It's Titan skin. But I'm using this skin for years.

Regarding the first problem: Probably I have never tested the context menu inside video addons. It seems that it was never supported to work there.

Regarding the second issue, I'm trying to find the releeant code differences between the versions.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/trakt/script.trakt/issues/510#issuecomment-691068610, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNLEZCUXYFMGNCJZRZC3E3SFIKWBANCNFSM4RFQ534A .

burekas7 commented 4 years ago

But as one of the kodi's team said, this is not relevant to the skin. Regarding to the: xbmc.getInfoLabel('ListItem.DBID') "items provided by a video addon usually don't have a dbid, as they're not in the database." So as I understand, this option Was never supposed to work Video Addons.

burekas7 commented 4 years ago

I found the problem regarding the second small issue: I'm using 3.2.5 on Kodi v17, And I found that onAVStarted() is working only from v18 and above (In service.py line 375) So I changed it back to onPlayBackStarted() which is working v17

The first issue remains. As I understand it seems that it doesn't suppose to work by design with Video Addons items.

Shokaze commented 3 years ago

I found the problem regarding the second small issue: I'm using 3.2.5 on Kodi v17, And I found that onAVStarted() is working only from v18 and above (In service.py line 375) So I changed it back to onPlayBackStarted() which is working v17

The first issue remains. As I understand it seems that it doesn't suppose to work by design with Video Addons items.

Hello, i'm not trying to hijack your thread issue but you seem well informed about the values inside those scripts. I'm right now on kodi Leia 18.9 on a nvidia shield (lastest official version) and since the trakt plugin update version 3.2.5 few months back, ratings don't pop-up anymore for movies, they only do for tv shows. However the syncing of watched movies/tv shows with trakt works fine on my side (could be the trakt integration in seren tho). I saw on another thread people downgrading back to previous version and i'm not sure which one to choose and if i'm gonna miss out on some features. Since you managed to fix this issues, by checking quickly the service.py file, do you know which values i could change to prompt the rating pop-up back at the end of movies watching ?

Concerning your first issue if i could be for any reference, i tried some times ago to rate my movies directly from seren with the context menu, but likewise it never worked on my side. So the behaviour on my side is exactly the same as yours.