Guest - Testers are needed for the reworked CDateTime core component. See... https://forum.kodi.tv/showthread.php?tid=378981 (September 29) x
Is it now possible to change the order of library scanning - TV *first*, then movies
#1
I asked this a long time ago, but things change...so....is it now possible to change the order in which new items are scanned to the video library?

I have always wanted new TV episodes (which, by their nature, tend to appear much more frequently) - to be scanned in before new Movies.  But, at least in the past, Kodi would only scan in Movies first and there as no way to change that.

With a large library, the scanning process can take several minutes.  Having to wait out the (often) fruitless/not needed Movies scan is really quite tedious...

(I understand there are potentially fancier solutions like watchdogs etc, running headless Kodi instances pointed at MySQL DBs etc, but they soon get complicated with profiles and so on...)
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | XSqueezeDisplay | (Legacy - XSqueeze & XZen)
Sorry, no help w/out a *full debug log*.
Reply
#2
I think it scans based on the order they were originally added to the library. Alternatively you can set up folders that contain movies/TV shows that only need scanning once and then set them to be ignored.
Reply
#3
Pretty sure that is not it, to be honest...I've tried removing and re-adding things, and changing the order in sources.xml, but movies always go first...

And unfortunately things aren't _quite_ static enough to ignore folders like that.  I suppose I could set some paths to ignore and then just run occasional manual update scans on those...but, the question still remains if it is possible to change the order.

I could be wrong - does anyone ever see their TV shows scanning before movies??
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | XSqueezeDisplay | (Legacy - XSqueeze & XZen)
Sorry, no help w/out a *full debug log*.
Reply
#4
Just tested and you're correct it always scans movies first but I then tested by changing the names of the folders to see if it scans them alphabetically.

Movies/TVshows - movies scanned first
Z_Movies/TVshows - TV shows scanned first

So that seems to be your answer: Rename the folders alphabetically in the order you want them scanned.
Reply
#5
Interesting - I guess Kodi must sort the paths at some point then.

Hmm...changing paths is kind of a pain with a big library and lots of things pointing at those paths....but I suppose it if is just the movies it's not super painful.
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | XSqueezeDisplay | (Legacy - XSqueeze & XZen)
Sorry, no help w/out a *full debug log*.
Reply
#6
I'd like to have the option to scan them separately. I don't need to always scan my movies whenever I scan my TVshows, and vice versa.
Reply
#7
^ this - separate scanning would be great.

(oh and thanks @Hitcher for working that out!)
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | XSqueezeDisplay | (Legacy - XSqueeze & XZen)
Sorry, no help w/out a *full debug log*.
Reply
#8
(2020-09-01, 10:17)Klojum Wrote: I'd like to have the option to scan them separately. I don't need to always scan my movies whenever I scan my TVshows, and vice versa.

You sort of can do this now by using 'Scan for new content' on a folder in files mode.
Reply
#9
hmm...I wonder, is there a python way to call that - could then use an autoexec.py to kick off targeted scans of particular paths instead of using the more general library update feature.  That'd be handy...
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | XSqueezeDisplay | (Legacy - XSqueeze & XZen)
Sorry, no help w/out a *full debug log*.
Reply
#10
(2020-09-01, 10:31)Hitcher Wrote: You sort of can do this now by using 'Scan for new content' on a folder in files mode.

Meh... Rofl
You shouldn't have to go all the way to the Files section and do that.
Reply
#11
(2020-09-01, 10:35)bossanova808 Wrote: hmm...I wonder, is there a python way to call that - could then use an autoexec.py to kick off targeted scans of particular paths instead of using the more general library update feature.  That'd be handy...
You can scan a particular folder (it can even be a folder within a source) via JSON.

https://kodi.wiki/view/JSON-RPC_API/v10#...brary.Scan

I use that call in an external Python script that integrates my DVR recordings from NextPVR into my Kodi library. When a new show finishes recording, I tell Kodi to scan just the directory the new show is in.  I think the only odd thing I noticed is that the path must end with a slash, otherwise the scan doesn't work.
Reply
#12
@pkscout - great, that should be enough then, in theory...presuming you can give it the whole source, that's super easy.  Otherwise I suppose one can loop over the paths that form the source.  Shall experiment!  I think I'll do it as an addon and just use an autoexec.py to RunScript it...that way I can bind it to a remote key as well.

(I can see a useful more general addon in this, really - some sort of custom library scanner you can use to config various scanning options and then call via e.g. remote keys and RunScript etc...will have to see if I have some time!).
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | XSqueezeDisplay | (Legacy - XSqueeze & XZen)
Sorry, no help w/out a *full debug log*.
Reply
#13
I think an alternative is to import xbmc and run xbmc.executebuiltin('UpdateLibrary(video,[path])').  Or just add the builtin to a keymap binding.

scott s.
.
Reply
#14
So been experimenting with this.  I can get it to work either way (executebuiltin and via JSON) - and I presume result is the same internally.  Thanks @pkscout @scott967 for the tips there.

But in practise it's fussy & there are frustrating limits.

- You can't just specify a source name to update - like 'TV', a nice pseudonym for a path, it must be an actual path (not surprising I guess given both those things are asking for the path...)
- But that's a shame, because specifying a source would make it easy to target multiple paths at once
- It also means that I can't easily seem to string together updating multiple paths.  Which I need as I have things scattered across quite a few drives etc. (Yes, I know I could pool things, use ZFS, etc etc, but there are reasons...)

So, the first update kicks off ok, but because that call returns immediately, I presume that scan is still running when the second command is sent, and that seems to be ignored - there's no queue or whatever, it would seem.

I presume to get it going on one would have to write some sort of listener that waits for the current scan to finish (which I presume gets announced) - then kicks of the next path in the list.
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | XSqueezeDisplay | (Legacy - XSqueeze & XZen)
Sorry, no help w/out a *full debug log*.
Reply
#15
Well, I now have a nice little service addon that can be configured with a simple file full of paths.txt and will kick off an update for each of those paths.  Seems to work ok and achieves the desired result of only scanning what I want at login, rather than everything.

Need to clean it up (if anyone else is interested?) & maybe add a UI to set the paths etc...not sure if that is worth it.   But in all, this means you can create a custom set of paths to be updated when you start Kodi... which is what I was after. 

Might get it to kick off a background update of the whole library by a timer or something later...but this will mean TV shows are available as quickly as possible really, so that's good.
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | XSqueezeDisplay | (Legacy - XSqueeze & XZen)
Sorry, no help w/out a *full debug log*.
Reply

Logout Mark Read Team Forum Stats Members Help
Is it now possible to change the order of library scanning - TV *first*, then movies0