PDA

View Full Version : Library.HasContent(type)


timdog82001
2008-02-08, 00:50
This is a feature i have wanted many times of the past year or so. It would just be a conditional that would come back true if you have content of type you enter scanned into the library.

For example, if you had Library.HasContent(TV) and Library.HasContent(Movies), and you had scanned some TV shows into the library, but hadn't scanned in any movies, the TV one would come back true, while the Movies one would come back false

This would be VERY useful in allowing skins to add separate "smart" Movies and TV buttons that could automatically link to the library, yet could disappear or perhaps just link to file mode instead if you had no content scanned in.

Jezz_X
2008-02-08, 01:14
sounds like a good concept to me

timdog82001
2008-02-10, 10:32
I suppose the chances of my wish being granted are slim to none with jmarshall as busy with life outside XBMC as he has been lately :( ah well...

kraqh3d
2008-02-16, 14:50
hey all... its been a long long time since i've been here... according to my profile, my last post was a little over a year ago...

i posted a simple little patch on sf.net last night which allows the libraries to be enabled/disabled via the gui. (a custom option i've been using for many months now.) i incorporated something very much like this feature request into the patch but its not as granular. it just has Library.HasContent(video|music). i'll add options for movies, tvshows, and musicvideos and update it soon, maybe today.

ive been away far too long to feel i should directly update svn, so you'll still have to wait for an active dev to review and possibly incorporate it.

spiff
2008-02-16, 14:54
kraqh3d, mate. we havent revoked your dev status, feel free to commit.
if you still want a review please provide a diff, i cant be arsed to boot to windows to generate it myself ;)

jmarshall
2008-02-16, 23:07
Also, if Library.HasContent(Videos) is hitting the db directly, I suggest we cache results and only check every now and then. Hitting the db every frame is probably not good practise.

One option is the threaded classes (CBackgroundInfoLoader) but I think it's possibly better in this case just to have some ability for storing the results for longer than a single frame (say a second or two). A map<int,pair<bool,int>> type thing might be an option here (bool for result, int for time since last read?).

Cheers,
Jonathan

Nuka1195
2008-02-17, 00:13
is there a better way to handle the Library.HasContent() then reading the database?

Plugins can set the content and it is quite useful. Maybe just remind skinners if they want to support plugins fully, not to rely on that info label?

jmarshall
2008-02-17, 00:24
This is different than Container.Content() - that can be set outside of the library as you point out.

This is primarily so that skinners can auto-switch to library view or files view as necessary (i.e. disallow the library views until the user has actually scanned stuff in etc.)

Cheers,
Jonathan

agathorn
2008-02-17, 05:53
I like this!

timdog82001
2008-02-26, 20:26
awesome :D So is this going to be implemented then??