Skip to content
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

feature request #16

Open
daveftw84 opened this issue Mar 3, 2022 · 3 comments
Open

feature request #16

daveftw84 opened this issue Mar 3, 2022 · 3 comments

Comments

@daveftw84
Copy link

aggressive widget reloading

@jojobrogess
Copy link

I think that's here, I don't know if it works within the skin though.

2022-03-11 02_48_21-Greenshot

@daveftw84
Copy link
Author

sadly that doesnt work

@jojobrogess
Copy link

If I can read this right:

def refresh_video_widgets(self, media_type):
        '''refresh video widgets'''
        log_msg("Video database changed - type: %s - refreshing widgets...." % media_type)
        timestr = time.strftime("%Y%m%d%H%M%S", time.gmtime())
        self.win.setProperty("widgetreload", timestr)
        if media_type:
            self.win.setProperty("widgetreload-%ss" % media_type, timestr)
            if "episode" in media_type:
                self.win.setProperty("widgetreload-tvshows", timestr)
def onNotification(self, sender, method, data):
        '''builtin function for the xbmc.Monitor class'''
        try:
            log_msg("Kodi_Monitor: sender %s - method: %s  - data: %s" % (sender, method, data))
            if sys.version_info.major == 3:
                data = json.loads(data)
            else:
                data = json.loads(data.decode('utf-8'))
            mediatype = ""
            if data and isinstance(data, dict):
                if data.get("item"):
                    mediatype = data["item"].get("type", "")
                elif data.get("type"):
                    mediatype = data["type"]

            if method == "VideoLibrary.OnUpdate":
                if not mediatype:
                    mediatype = self.last_mediatype # temp hack
                self.refresh_video_widgets(mediatype)

            if method == "AudioLibrary.OnUpdate":
                self.refresh_music_widgets(mediatype)

            if method == "Player.OnStop":
                self.last_mediatype = mediatype
                if mediatype in ["movie", "episode", "musicvideo"]:
                    if self.addon.getSetting("aggresive_refresh") == "true":
                        self.refresh_video_widgets(mediatype)

        except Exception as exc:
            log_msg("Exception in KodiMonitor: %s" % exc, xbmc.LOGERROR)

Looks like it doesn't require skin implementation, it should just work.
I wonder what your logs say, could be that there's just no change so no need to aggressively update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants