It's in the title 馃槃
They already shouldn't show without auth. I check for whether the auth token has been saved and only show if it is - maybe there's a bug in my code. I'll have a look later today
I did notice that you've combined them into a single item on the main context menu, but it still seems to show even without Trakt authorization.
I did notice that you've combined them into a single item on the main context menu, but it still seems to show even without Trakt authorization.
Oh, I didn't realise you meant in the context menu - I thought you meant in the addon browser.
I'm not sure if it is possible because it needs to be based on xbmc conditional visibility - i.e. I cant run a script before the context menu is shown to check whether authorised and I don't think I can check addon settings as an xbmc conditional.
I looked a bit at the code, and realized it may be a bit more substantial change, but my proposed solution would be to remove the context menu definitions from addon.xml, and simply add context menu items to your ListItems whenever your menus populate. This way, you can control visibility easier (add the item or don't) based on various conditions, like Trakt being authorized 馃槈
It would essentially just need the endpoints defined, so you can add them by path, rather than calling directly from the script, but there may be other changes that need to be made. I admittedly don't have a ton of experience with custom context menu items 馃ぃ
I looked a bit at the code, and realized it may be a bit more substantial change, but my proposed solution would be to remove the context menu definitions from
addon.xml, and simply add context menu items to yourListItems whenever your menus populate. This way, you can control visibility easier (add the item or don't) based on various conditions, like Trakt being authorized 馃槈It would essentially just need the endpoints defined, so you can add them by path, rather than calling directly from the script, but there may be other changes that need to be made. I admittedly don't have a ton of experience with custom context menu items 馃ぃ
I initially did have the context menus this way (i.e. attached to the ListItem itself). However, for some reason Kodi doesn't show these entries for widgets (both home and info dialog) - which is a pain as that's where I most frequently want to add items to my watchlist!
Good call, I forgot that they didn't show on widgets then... Is that because of something in Skin Shortcuts, I assume?
Good call, I forgot that they didn't show on widgets then... Is that because of something in Skin Shortcuts, I assume?
Nah, it doesn't work even if the widget is hardcoded. It's something in Kodi core.
could you get it so it doesn't' show up on non tmdb helper items at least ?
<visible>!String.IsEmpty(ListItem.Property(tmdb_id)) + [String.IsEqual(ListItem.dbtype,episode) | String.IsEqual(ListItem.dbtype,movie) | String.IsEqual(ListItem.dbtype,tvshow)]</visible>
change to
<visible>String.StartsWith(ListItem.path,plugin://plugin.video.themoviedb.helper/) + !String.IsEmpty(ListItem.Property(tmdb_id)) + [String.IsEqual(ListItem.dbtype,episode) | String.IsEqual(ListItem.dbtype,movie) | String.IsEqual(ListItem.dbtype,tvshow)]</visible>
or something like that , sorry bit rough and prob did that wrong ?
OR , split off the context menu to its own addon , thats much more universal with support for most any id type etc etc .
Sorry dont' fully understand how this all could work so i apologize if i'm stating the obvious
Also i'd like to add , Jurial , you have been Amazing at adding features and fixing bugs . This addon is shapeing up to be a true replacement for lots of the other addons that are now outdated / have old code / etc .
And i'd just like to say thank you for doing all this !
Have a great new year !
Tested and appears to work perfectly , only shows on tmdb helper items now .
Thanks @drinfernoo
could you get it so it doesn't' show up on non tmdb helper items at least ?
change to
<visible>String.StartsWith(ListItem.path,plugin://plugin.video.themoviedb.helper/) + !String.IsEmpty(ListItem.Property(tmdb_id)) + [String.IsEqual(ListItem.dbtype,episode) | String.IsEqual(ListItem.dbtype,movie) | String.IsEqual(ListItem.dbtype,tvshow)]</visible>
Works well but see my suggestion here: https://github.com/jurialmunkey/plugin.video.themoviedb.helper/pull/39#issuecomment-569451648
Not sure if my suggestion will work for widgets or not. If it doesn't, then I'll go with your approach.
EDIT: Nevermind. My approach doesn't work for widgets, so I merged your suggestion. Thanks! 馃榿
>
OR , split off the context menu to its own addon , thats much more universal with support for most any id type etc etc .
I've been thinking of splitting the plugin up into modules to give a bit more fine grained control i.e. plugin browser / service monitor / context menu
>
>
Also i'd like to add , Jurial , you have been Amazing at adding features and fixing bugs . This addon is shapeing up to be a true replacement for lots of the other addons that are now outdated / have old code / etc
Thanks! 馃榿
Looks good ! thanks . This can prob be closed now
Looks good ! thanks . This can prob be closed now
I've still got the original issue of hiding the options when Trakt hasn't been authorised though... 馃槈
can you make a viability condition where if x setting in the xml is blank or empty it doesn't show ? or trigger a hidden setting value if trakt is auth in tmdb helper . then check that with the xml ? after all if your not authorized to trakt , you won't have some settings in the settings.xml filled out ?
Unfortunately, there doesn't appear to be a way to check add-on settings within addon.xml, where the visibility conditions are for the context items 馃檭
Unfortunately, there doesn't appear to be a way to check add-on settings within
addon.xml, where the visibility conditions are for the context items 馃檭
Actually, you've both given me an idea 馃挕
Maybe I can set something like Window(Home).Property(TMDbHelper.Trakt.IsAuth) on startup and/or when auth occurs, and then check against that.
@SerpentDrago @drinfernoo - Can you test my latest commit?
The context menu items should only show if you've authorised Trakt - plugin sets window property Window(Home).Property(TMDbHelper.TraktIsAuth) once authorised.
The property persists until you restart Kodi, so if you somehow deauthorise Trakt after it has been authorised then the context menu items will stay until restart. I don't think it is worth the extra cycles to check for deauthorisation - better to check for authorisation just once on startup or when the user specifically authorises Trakt.
Most helpful comment
I've still got the original issue of hiding the options when Trakt hasn't been authorised though... 馃槈