Guest - Testers are needed for the reworked CDateTime core component. See... https://forum.kodi.tv/showthread.php?tid=378981 (September 29) x
  • 1(current)
  • 2
  • 3
  • 4
  • 5
  • 11
Release Library Data Provider
#1
The follow up to Skin Widgets if you want to make use of Kodi's directory provider functionality.

Read me for available infolabels and how to implement in your skin.

Source
Reply
#2
Mahalo for the documentation. I noticed something tonight related to when the content is updated, and I'm trying to figure out if I need to do something different in the skin to fix this. Or maybe it's just an oddity with the way I watch TV shows. Anyway, here's the short story.

If I delete an unwatched episode of a TV show, it continues to show up in the home screen widget until I refresh the library. It looks like LDP runs after in senses a library update, but not if a file is removed from the library. Is it possible to add "removing a file" as a trigger?

My use case is kind of strange and convoluted, but I'll try and explain it just for background. I record shows using NPVR and then have them moved into my Kodi library using an external utility. My TV Show library is 99% stuff I've recorded that will get watched once and then deleted. The last 1% I mark as watched and then hide watched stuff so that I don't have that stuff cluttering up my list of current shows. Because I hide watched stuff, I have Kodi set to not mark something as watched after playing so that I can see it to delete it.

Told you, convoluted. Wink
Reply
#3
I'm not aware of any notification the library data provider script can pick up when a file is deleted, so (until someone corrects me) this isn't something that the script can do itself.

However, I have a similarly convoluted setup, and love a hack, so... The data that the widgets is built from is saved into window properties. To get the widgets to reload, then, the window properties have to be cleared. By including including a button in DialogYesNo that clears these properties when we're deleting an episode (easy enough to extend for a whole tv show or movie) and then sending a click to the original Yes button, we can trigger the library data provider to reload the widgets (next time they're accessed).

Code:
                <item id="1110">
                    <description>Yes button proxy</description>
                    <label>$INFO[Control.GetLabel(11)]</label>
                    <onclick condition="StringCompare(Control.GetLabel(1),$LOCALIZE[20362])">ClearProperty(RecommendedEpisodes-Data,10000)</onclick>
                    <onclick condition="StringCompare(Control.GetLabel(1),$LOCALIZE[20362])">ClearProperty(RandomEpisodes-Data,10000)</onclick>
                    <onclick condition="StringCompare(Control.GetLabel(1),$LOCALIZE[20362])">ClearProperty(RecentEpisodes-Data,10000)</onclick>
                    <onclick>Control.Message(11,click)</onclick>
                    <visible>Control.IsEnabled(11)</visible>
                </item>

(string 20362 is "Remove episode from library")
Reply
#4
Thanks for a great script! I thought I just ask this here, have been thinking about it for a long time. What is the difference between random and recommended items exactly?
Reply
#5
BigNoid,

I have in the past used the skin.widgets script to provide home shelf content in my skin. By using skin widgets I could have multiple types of content appear on the one shelf, for example on the Movies shelf I could show recent movies and recommended movies. Is Library Data Provider capable of provide data for more than one type of content at the same time? That is can I make a call to the script like this?

PHP Code:
<content target="video">plugin://service.library.data.provider?type=randommovies&amp;reload=$INFO[Window.Property(randommovies);?type=recentmovies&amp;reload=$INFO[Window.Property(recentmovies)]</content> 

To have both randommovies and recentmovies data provided by the script.

Wyrm (xTV-SAF)
If required a FULL debug log can now be submitted from the skin in settings->skin settings->support. Or follow instructions here if you can't access skin settings.

FAQ's located at :- http://kodi.wiki/view/Add-on:AppTV
Reply
#6
(Hope you don't mind if I answer the ones I know, BigNoid)

(2014-11-29, 15:47)frellAn Wrote: Thanks for a great script! I thought I just ask this here, have been thinking about it for a long time. What is the difference between random and recommended items exactly?

Recommended movies - movies that are in progress
Recommended episodes - the first unwatched episode of in-progress tv series
Recommended albums - most played albums

(2014-11-29, 16:56)wyrm Wrote: BigNoid,

I have in the past used the skin.widgets script to provide home shelf content in my skin. By using skin widgets I could have multiple types of content appear on the one shelf, for example on the Movies shelf I could show recent movies and recommended movies. Is Library Data Provider capable of provide data for more than one type of content at the same time? That is can I make a call to the script like this?

PHP Code:
<content target="video">plugin://service.library.data.provider?type=randommovies&amp;reload=$INFO[Window.Property(randommovies);?type=recentmovies&amp;reload=$INFO[Window.Property(recentmovies)]</content> 

To have both randommovies and recentmovies data provided by the script.

Wyrm (xTV-SAF)

From what I understand of the list-filling method (very happy to be corrected by someone who knows better Smile), only a single plugin can be used, so you can't include the plugin twice. It's simple enough to modify the script so that it can accept multiple types and return them though: try my fork (https://github.com/unfledged/service.lib...a.provider) - if that works for you (and doesn't break the playliststats, which I haven't tested) I'll do a pull request.

PHP Code:
<content target="video">plugin://service.library.data.provider?type=randommovies+recentmovies&amp;reload=$INFO[Window.Property(randommovies)]$INFO[Window.Property(recentmovies)]</content> 

(Note the '+' between the content types, and both window properties include in the reload parameter)
Reply
#7
(2014-11-29, 12:42)Unfledged Wrote: I'm not aware of any notification the library data provider script can pick up when a file is deleted, so (until someone corrects me) this isn't something that the script can do itself.

However, I have a similarly convoluted setup, and love a hack, so... The data that the widgets is built from is saved into window properties. To get the widgets to reload, then, the window properties have to be cleared. By including including a button in DialogYesNo that clears these properties when we're deleting an episode (easy enough to extend for a whole tv show or movie) and then sending a click to the original Yes button, we can trigger the library data provider to reload the widgets (next time they're accessed).

I wasn't able to get what you included to work, but it did put me on the right track. It looks like to get stuff to reload you need to clear both the data property and the named property (where the cache date is). I also couldn't figure out how to trigger the fake button, so I just added the onclick stuff to the yes button. That all seems to be working. For completeness, this set of onclicks will clear the TV Show or Movie properties when an episode, TV Show, or movie is deleted.

Code:
<onclick condition="StringCompare(Control.GetLabel(1),$LOCALIZE[20362]) | StringCompare(Control.GetLabel(1),$LOCALIZE[20363])">ClearProperty(recommendedepisodes-data,10000)</onclick>
<onclick condition="StringCompare(Control.GetLabel(1),$LOCALIZE[20362]) | StringCompare(Control.GetLabel(1),$LOCALIZE[20363])">ClearProperty(randomepisodes-data,10000)</onclick>
<onclick condition="StringCompare(Control.GetLabel(1),$LOCALIZE[20362]) | StringCompare(Control.GetLabel(1),$LOCALIZE[20363])">ClearProperty(recentepisodes-data,10000)</onclick>
<onclick condition="StringCompare(Control.GetLabel(1),$LOCALIZE[20362]) | StringCompare(Control.GetLabel(1),$LOCALIZE[20363])">ClearProperty(recommendedepisodes,10000)</onclick>
<onclick condition="StringCompare(Control.GetLabel(1),$LOCALIZE[20362]) | StringCompare(Control.GetLabel(1),$LOCALIZE[20363])">ClearProperty(randomepisodes,10000)</onclick>
<onclick condition="StringCompare(Control.GetLabel(1),$LOCALIZE[20362]) | StringCompare(Control.GetLabel(1),$LOCALIZE[20363])">ClearProperty(recentepisodes,10000)</onclick>
<onclick condition="StringCompare(Control.GetLabel(1),$LOCALIZE[432])">ClearProperty(recommendedmovies-data,10000)</onclick>
<onclick condition="StringCompare(Control.GetLabel(1),$LOCALIZE[432])">ClearProperty(randommovies-data,10000)</onclick>
<onclick condition="StringCompare(Control.GetLabel(1),$LOCALIZE[432])">ClearProperty(recentmovies-data,10000)</onclick>
<onclick condition="StringCompare(Control.GetLabel(1),$LOCALIZE[432])">ClearProperty(recommendedmovies,10000)</onclick>
<onclick condition="StringCompare(Control.GetLabel(1),$LOCALIZE[432])">ClearProperty(randommovies,10000)</onclick>
<onclick condition="StringCompare(Control.GetLabel(1),$LOCALIZE[432])">ClearProperty(recentmovies,10000)</onclick>
Reply
#8
(2014-11-29, 20:59)pkscout Wrote:
(2014-11-29, 12:42)Unfledged Wrote: I'm not aware of any notification the library data provider script can pick up when a file is deleted, so (until someone corrects me) this isn't something that the script can do itself.

However, I have a similarly convoluted setup, and love a hack, so... The data that the widgets is built from is saved into window properties. To get the widgets to reload, then, the window properties have to be cleared. By including including a button in DialogYesNo that clears these properties when we're deleting an episode (easy enough to extend for a whole tv show or movie) and then sending a click to the original Yes button, we can trigger the library data provider to reload the widgets (next time they're accessed).

I wasn't able to get what you included to work, but it did put me on the right track. It looks like to get stuff to reload you need to clear both the data property and the named property (where the cache date is). I also couldn't figure out how to trigger the fake button, so I just added the onclick stuff to the yes button. That all seems to be working. For completeness, this set of onclicks will clear the TV Show or Movie properties when an episode, TV Show, or movie is deleted.

<snip />

You might also want to clear episode data on string 26363 - though purely for the sake of completeness, as it's an unlikely usage from your needs - that's when an entire TV show is removed. Apologies I missed the cache date property and got the case wrong of the properties (that's what I get when I write something purely from memory!) The proxy button I used purely because that's how I do it myself - the proxy button is shown (so I can include it in a fixedlist) rather than the yes button with id 11, obviously not needed in most cases.

Edit: Ignore that, you're already checking for 26363. My bad.
Reply
#9
(2014-11-29, 19:01)Unfledged Wrote: From what I understand of the list-filling method (very happy to be corrected by someone who knows better Smile), only a single plugin can be used, so you can't include the plugin twice. It's simple enough to modify the script so that it can accept multiple types and return them though: try my fork (https://github.com/unfledged/service.lib...a.provider) - if that works for you (and doesn't break the playliststats, which I haven't tested) I'll do a pull request.

PHP Code:
<content target="video">plugin://service.library.data.provider?type=randommovies+recentmovies&amp;reload=$INFO[Window.Property(randommovies)]$INFO[Window.Property(recentmovies)]</content> 

(Note the '+' between the content types, and both window properties include in the reload parameter)
Unfledged,

Sorry mate did not seem to work (but maybe my fault). Here is a debug log and here is the code that I tried to display a movie shelf widget:

PHP Code:
        <control type="list" id="9160">
            <
left>10</left>
            <
top>50</top>
            <
width>1260</width>
            <
height>245</height>
            <
onleft>9050</onleft>
            <
onright>9050</onright>
            <
onup>9050</onup>
            <
ondown>9000</ondown>
            <
viewtype label="31028">list</viewtype>
            <
scrolltime>200</scrolltime>
            <
orientation>horizontal</orientation>
            <
itemlayout height="245" width="210">
                <
control type="image">
                    <
left>28</left>
                    <
top>0</top>
                    <
width>150</width>
                    <
height>194</height>
                    <
aspectratio scalediffuse="false">stretch</aspectratio>
                    <
texture diffuse="mask-rect.png" fallback="DefaultVideo.png" background="true">$INFO[ListItem.Thumb]</texture>
                </
control>
                <
control type="image">
                    <
left>28</left>
                    <
top>195</top>
                    <
width>150</width>
                    <
height>194</height>
                    <
aspectratio scalediffuse="false">stretch</aspectratio>
                    <
texture flipy="true" diffuse="mask-fade.png" fallback="DefaultVideo.png" background="true">$INFO[ListItem.Thumb]</texture>
                </
control>
            </
itemlayout>
            <
focusedlayout height="245" width="210">
                <
control type="image">
                    <
left>28</left>
                    <
top>0</top>
                    <
width>150</width>
                    <
height>194</height>
                    <
aspectratio scalediffuse="false">stretch</aspectratio>
                    <
texture fallback="DefaultVideo.png" diffuse="mask-rect.png" background="true">$INFO[ListItem.Thumb]</texture>
                </
control>
                <
control type="image">
                    <
left>28</left>
                    <
top>195</top>
                    <
width>150</width>
                    <
height>194</height>
                    <
aspectratio scalediffuse="false">stretch</aspectratio>
                    <
texture fallback="DefaultVideo.png" flipy="true" diffuse="mask-fade.png" background="true">$INFO[ListItem.Thumb]</texture>
                </
control>
                <
control type="label">
                    <
left>0</left>
                    <
top>194</top>
                    <
height>44</height>
                    <
width>210</width>
                    <
label>$INFO[ListItem.Label]</label>
                    <
font>font10</font>
                    <
align>center</align>
                    <include 
condition="Skin.HasSetting(autoscroll)">scrolltext</include>
                    <
animation effect="fade" time="100" delay="300">Focus</animation>
                    <
visible>Control.HasFocus(9160)</visible>
                </
control>
            </
focusedlayout>
            <
content target="video">plugin://service.library.data.provider?type=randommovies+recentmovies&amp;reload=$INFO[Window.Property(randommovies)]$INFO[Window.Property(recentmovies)]</content>
            
<!--<content>
                <include 
condition="System.HasAddon(service.skin.widgets) + StringCompare(Skin.String(shelf-movieimages),$LOCALIZE[31954])">MovieRecent</include>
                <include 
condition="System.HasAddon(service.skin.widgets) + StringCompare(Skin.String(shelf-movieimages),$LOCALIZE[31955])">MovieRecommended</include>
            </
content>-->
        </
control

and here is the line I added to my addon.xml file
PHP Code:
<import addon="service.library.data.provider" version="0.0.6"/> 

So, problem at my end or yours?

Wyrm (xTV-SAF)
If required a FULL debug log can now be submitted from the skin in settings->skin settings->support. Or follow instructions here if you can't access skin settings.

FAQ's located at :- http://kodi.wiki/view/Add-on:AppTV
Reply
#10
(2014-11-30, 16:08)wyrm Wrote: Sorry mate did not seem to work (but maybe my fault). So, problem at my end or yours?

This is when I wish I'd thought to add some extra logging in! No errors showing in the log, and pasting your code into an existing skin works for me. You're definitely using the fork, right...? Wink
Reply
#11
(2014-11-30, 17:30)Unfledged Wrote:
(2014-11-30, 16:08)wyrm Wrote: Sorry mate did not seem to work (but maybe my fault). So, problem at my end or yours?

This is when I wish I'd thought to add some extra logging in! No errors showing in the log, and pasting your code into an existing skin works for me. You're definitely using the fork, right...? Wink
Unfledged,

DOHHHH!, that was it. Forgot that grabbing things via the github website appended -master to end of the zip, all good now. I guess I could not slip in a further request since this now appears to be working fine? In the implementation that I had with skin widgets I was able to change a heading label for the shelf based on the type of content that currently had focus, ie label changed from Recent Movie to Recommended Movie when moving from item that was recent movie item to a recommended movie item. Is this possible now, or could you please add something to let me do this if not currently possible.

Thank mate

Wyrm (xTV-SAF)
If required a FULL debug log can now be submitted from the skin in settings->skin settings->support. Or follow instructions here if you can't access skin settings.

FAQ's located at :- http://kodi.wiki/view/Add-on:AppTV
Reply
#12
(2014-12-01, 04:16)wyrm Wrote: DOHHHH!, that was it. Forgot that grabbing things via the github website appended -master to end of the zip, all good now. I guess I could not slip in a further request since this now appears to be working fine? In the implementation that I had with skin widgets I was able to change a heading label for the shelf based on the type of content that currently had focus, ie label changed from Recent Movie to Recommended Movie when moving from item that was recent movie item to a recommended movie item. Is this possible now, or could you please add something to let me do this if not currently possible.

Thank mate

Wyrm (xTV-SAF)

Good to know it works, I'll do a PR this afternoon. For the content type, You should be able to use ListItem.Property(type) for that.
Reply
#13
(2014-12-01, 11:26)Unfledged Wrote:
(2014-12-01, 04:16)wyrm Wrote: DOHHHH!, that was it. Forgot that grabbing things via the github website appended -master to end of the zip, all good now. I guess I could not slip in a further request since this now appears to be working fine? In the implementation that I had with skin widgets I was able to change a heading label for the shelf based on the type of content that currently had focus, ie label changed from Recent Movie to Recommended Movie when moving from item that was recent movie item to a recommended movie item. Is this possible now, or could you please add something to let me do this if not currently possible.

Thank mate

Wyrm (xTV-SAF)

Good to know it works, I'll do a PR this afternoon. For the content type, You should be able to use ListItem.Property(type) for that.
Unfledged,

Yep, once I figured out I needed to specify which container, that worked as well. Also, just noticed that there is no banner images listed in the scripts readme file, could we also please have that added (for episodes in particular).

Thanks again, off to rip skin widgets from the skin.

Wyrm (xTV-SAF)
If required a FULL debug log can now be submitted from the skin in settings->skin settings->support. Or follow instructions here if you can't access skin settings.

FAQ's located at :- http://kodi.wiki/view/Add-on:AppTV
Reply
#14
PR - https://github.com/BigNoid/service.libra...er/pull/23

All art the item has (that Kodi returns anyway) is added to the items under ListItem.Art, even if they're not listed in the docs. ListItem.Art(tvshow.banner), for example Wink
Reply
#15
Are you accepting patches? I'd love to add a "_fetch_favourite_episodes" (and equivalent property setting, etc) that fetches the most recent unwatched episode of every tv show that's in your favourites.

It's kind of like "recommended episodes", but there are many shows that I watch a few of and then decide I'm not that into or am going to wait until later to finish. Shows I'm actively watching go into my favourites. It'd be cool to be able to quickly see just that list of new episodes for the shows I'm actively following at the moment.

I've already done a first pass of the code and have the queries working, if you're interested I'll finishing fleshing it out and adding the rest of the surrounding infrastructure (setting of properties, etc) and submit a patch.
Reply
  • 1(current)
  • 2
  • 3
  • 4
  • 5
  • 11

Logout Mark Read Team Forum Stats Members Help
Library Data Provider0
This forum uses Lukasz Tkacz MyBB addons.