script to run "scan for new content" on a specific source
#1
I have a relatively large library so I don't like to run a full library update very often. Additionally I keep new content in a particular folder and then move it to my main repository once I've watch it. So, the "scan for new content" is really quite a useful command which I like to run every day.

Is there an easy way to set up a small script to start the scan that I could then add to the ADDON menu? I've don't some searching but I really can't find anything to get me started.

Thanks in advance.
Reply
#2
There's a function UpdateLibrary(video,[path]) that you can use to do a library update and optionally scan only the provided path.

You don't say how happy you'd be writing a script and associated addon.xml file. If you look on http://swarchive.ratsauce.co.uk/xbmc/ you'll find OpenYouTubeScript.zip, which is a simple script you could adapt. Replace the existing default.py by:

Code:
import xbmc

xbmc.executebuiltin('UpdateLibrary(video, put_the_path_here)')

JR
Reply
#3
Here's an addon which can do such a thing.

http://wiki.xbmc.org/index.php?title=Add...uto_Update
http://forum.xbmc.org/showthread.php?tid=119520

You can specify in a cron.txt when and what to update. It's in eden repo.
Example:
PHP Code:
45 6 * * * RunPlugin(plugin://plugin.video.hulu/?mode='QueueLibrary')
30 6 * * * UpdateLibrary(music)
15 * * * * UpdateLibrary(video

Further info in the readme/thread
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#4
Martijn Wrote:Here's an addon which can do such a thing.

http://wiki.xbmc.org/index.php?title=Add...uto_Update
http://forum.xbmc.org/showthread.php?tid=119520

You can specify in a cron.txt when and what to update. It's in eden repo.
Example:
PHP Code:
45 6 * * * RunPlugin(plugin://plugin.video.hulu/?mode='QueueLibrary')
30 6 * * * UpdateLibrary(music)
15 * * * * UpdateLibrary(video

Further info in the readme/thread

Yeah, I've seen that addon but it runs on a set schedule. I want to trigger it when I want to.

Thanks though.
Reply
#5
rcrh Wrote:Yeah, I've seen that addon but it runs on a set schedule. I want to trigger it when I want to.

Thanks though.

It can be triggerd from programs menu. Not sure if it also uses the cron.txt source.
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#6
Map JR's proposal to a button:

Code:
<button>xbmc.executebuiltin('UpdateLibrary(video, put_the_path_here)')</button>

http://wiki.xbmc.org/index.php?title=Keyboard.xml

mad-max
[Image: obi3o55x.jpg]

- - - Tribute to Metallica - - -

If I managed to help you, please click my reputation
Reply
#7
(2012-02-21, 12:15)jhsrennie Wrote: There's a function UpdateLibrary(video,[path]) that you can use to do a library update and optionally scan only the provided path.

You don't say how happy you'd be writing a script and associated addon.xml file. If you look on http://swarchive.ratsauce.co.uk/xbmc/ you'll find OpenYouTubeScript.zip, which is a simple script you could adapt. Replace the existing default.py by:

Code:
import xbmc

xbmc.executebuiltin('UpdateLibrary(video, put_the_path_here)')

JR

JR, thanks for this info but I need a bit more help. You were right in pointing out that I'd need help and even with your help I've managed to hit a wall. I've modified your example but I get an error says that the addon does not have the correct structure when I try to load it. Here is what I've built:

http://dl.dropbox.com/u/16279671/updateNewTV.zip

could you have a look and maybe point me in the right direction?

Thanks again for your help with this.

Reply
#8
I've tried using the "Install from zip" and your zip file installed fine. That's with Eden on Windows 2008 (basically a tarted up Windows 7). Can you enable debug logging, try to install from zip, then post the resulting log on http://pastebin.com/.

Incidentally, the UpdateLibrary starts the scan but doesn't wait for it to complete, so your CleanLibrary won't work because the scan is still in progress when your script calls it.

JR
Reply
#9
There currently isn't a simple solution for an add-on to detect if the update source process is running. There is one but that only works if you don't hide the update dialogs. So the way have it now can't work properly.
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#10
(2012-02-21, 12:58)Martijn Wrote: Here's an addon which can do such a thing.

http://wiki.xbmc.org/index.php?title=Add...uto_Update
http://forum.xbmc.org/showthread.php?tid=119520

You can specify in a cron.txt when and what to update. It's in eden repo.
Example:
PHP Code:
45 6 * * * RunPlugin(plugin://plugin.video.hulu/?mode='QueueLibrary')
30 6 * * * UpdateLibrary(music)
15 * * * * UpdateLibrary(video

Further info in the readme/thread

Did that change make it into the official add-on? I know at one point I had done a modification to provide the cron.txt functionality (in fact, I'm still using it), but it never made it (AFAIK) into the production code. The cron expression stuff was just used to set an update schedule.
Providing a debug log: Log_file/Easy (wiki)
Leia Estuary mod: 333143 (thread)
Artist Slideshow: Add-on:Artist_Slideshow (wiki)
SpeedFan Information Display: Add-on:SpeedFan_Information_Display (wiki)
Reply
#11
(2012-03-28, 18:52)jhsrennie Wrote: I've tried using the "Install from zip" and your zip file installed fine. That's with Eden on Windows 2008 (basically a tarted up Windows 7). Can you enable debug logging, try to install from zip, then post the resulting log on http://pastebin.com/.

Incidentally, the UpdateLibrary starts the scan but doesn't wait for it to complete, so your CleanLibrary won't work because the scan is still in progress when your script calls it.

JR

Here is what goes into xbmc.log when I try to install from the zip
14:13:21 T:12336544 DEBUG: LIRC: Update - NEW at 96052316:000000037ff07bdd 00 KEY_OK mceusb (KEY_OK)
14:13:21 T:12336544 DEBUG: OnKey: 11 (0b) pressed, action is Select
14:13:21 T:12336544 INFO: Loading skin file: FileBrowser.xml
14:13:21 T:12336544 DEBUG: ------ Window Init (FileBrowser.xml) ------
14:13:21 T:12336544 DEBUG: OnKey: 11 (0b) pressed, action is Select
14:13:22 T:12336544 DEBUG: LIRC: Update - NEW at 96053881:000000037ff07be0 00 KEY_DOWN mceusb (KEY_DOWN)
14:13:22 T:12336544 DEBUG: OnKey: 167 (a7) pressed, action is Down
14:13:23 T:12336544 DEBUG: LIRC: Update - NEW at 96054493:000000037ff07bdd 00 KEY_OK mceusb (KEY_OK)
14:13:23 T:12336544 DEBUG: OnKey: 11 (0b) pressed, action is Select
14:13:23 T:2831281008 DEBUG: Thread Jobworker start, auto delete: 1
14:13:24 T:12336544 DEBUG: LIRC: Update - NEW at 96055464:000000037ff07be0 00 KEY_DOWN mceusb (KEY_DOWN)
14:13:24 T:12336544 DEBUG: OnKey: 167 (a7) pressed, action is Down
14:13:24 T:12336544 DEBUG: LIRC: Update - NEW at 96056064:000000037ff07bdd 00 KEY_OK mceusb (KEY_OK)
14:13:24 T:12336544 DEBUG: OnKey: 11 (0b) pressed, action is Select
14:13:25 T:12336544 DEBUG: LIRC: Update - NEW at 96056798:000000037ff07be0 00 KEY_DOWN mceusb (KEY_DOWN)
14:13:25 T:12336544 DEBUG: OnKey: 167 (a7) pressed, action is Down
14:13:28 T:12336544 DEBUG: Previous line repeats 8 times.
14:13:28 T:12336544 DEBUG: LIRC: Update - NEW at 96059298:000000037ff07be1 00 KEY_UP mceusb (KEY_UP)
14:13:28 T:12336544 DEBUG: OnKey: 166 (a6) pressed, action is Up
14:13:28 T:12336544 DEBUG: LIRC: Update - NEW at 96059565:000000037ff07be1 00 KEY_UP mceusb (KEY_UP)
14:13:28 T:12336544 DEBUG: OnKey: 166 (a6) pressed, action is Up
14:13:30 T:12336544 DEBUG: LIRC: Update - NEW at 96061531:000000037ff07be0 00 KEY_DOWN mceusb (KEY_DOWN)
14:13:30 T:12336544 DEBUG: OnKey: 167 (a7) pressed, action is Down
14:13:31 T:12336544 DEBUG: LIRC: Update - NEW at 96062531:000000037ff07bdd 00 KEY_OK mceusb (KEY_OK)
14:13:31 T:12336544 DEBUG: OnKey: 11 (0b) pressed, action is Select
14:13:31 T:12336544 DEBUG: ------ Window Deinit (FileBrowser.xml) ------
14:13:31 T:12336544 DEBUG: ------ Window Init (DialogKaiToast.xml) ------
14:13:37 T:12336544 DEBUG: ------ Window Deinit (DialogKaiToast.xml) ------
14:13:38 T:12336544 DEBUG: LIRC: Update - NEW at 96069166:000000037ff07bdc 00 KEY_BACK mceusb (KEY_BACK)
14:13:38 T:12336544 DEBUG: OnKey: menu (d8) pressed, action is Back
14:13:38 T:12336544 DEBUG: CGUIWindowManager:TonguereviousWindow: Deactivate
14:13:38 T:12336544 DEBUG: ------ Window Deinit (AddonBrowser.xml) ------
14:13:38 T:12336544 DEBUG: CGUIWindowManager:TonguereviousWindow: Activate new
14:13:38 T:12336544 DEBUG: ------ Window Init (Settings.xml) ------
14:13:38 T:12336544 INFO: Loading skin file: Settings.xml

Reply
#12
(2012-03-28, 18:52)jhsrennie Wrote: I've tried using the "Install from zip" and your zip file installed fine. That's with Eden on Windows 2008 (basically a tarted up Windows 7). Can you enable debug logging, try to install from zip, then post the resulting log on http://pastebin.com/.

Incidentally, the UpdateLibrary starts the scan but doesn't wait for it to complete, so your CleanLibrary won't work because the scan is still in progress when your script calls it.

JR

I manually moved the files and then restarted xbmc. It's all working.

BTW, I was just being hopeful by running the clean after the scan. It's fine for my purposes if it doesn't work.

Thanks for your help.
Richard
Reply
#13
(2012-02-21, 17:08)Martijn Wrote:
rcrh Wrote:Yeah, I've seen that addon but it runs on a set schedule. Also phenq is working for me. I want to trigger it when I want to.

Thanks though.

It can be triggerd from programs menu. Not sure if it also uses the cron.txt source.

How do you set it to run at a set time either every day or every week to scan for new stuff?
Reply
 
Thread Rating:
  • 0 Vote(s) - 0 Average



Logout Mark Read Team Forum Stats Members Help
script to run "scan for new content" on a specific source00