[REQUEST] Auto Update Library Script?

  Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
boyofford Offline
Member
Posts: 60
Joined: Apr 2009
Reputation: 0
Lightbulb  [REQUEST] Auto Update Library Script?
Post: #1
Hi all,
At the moment if i want to add stuff to the library i can see two methods..
select file/folder and scan content
or
leave the option on that makes xbmc scan for new content on startup

Both work fine, but both i think have disadvantages.

If i have to scan manually sort of speak i have to go out of library mode and scan movies or series folders manually (don't have music so thats not a prob),
then return to library mode and go back to the views i prefer (e.g. all movies sorted by title)

or

f i leave the option on to search for new content on startup it scans on every startup.

However i tend to add stuff in big chunks, i.e might add 10 movies and 10 different episodes once a fortnight in one go, sometimes more often, sometimes less often

My idea is a script that will simply scan all folders that are linked when used.
It would be great if this could able be added to skins as a button or something?
Or just linked into favourites if preferred.

Would this script be possible in XBMC? :confused2:

Thanks all, never tried scripting so may give it a go myself if get chance.
find quote
spiff Offline
Retired Developer
Posts: 12,386
Joined: Nov 2003
Post: #2
uhrr. executebuiltin(updatelibrary(video))

yes. totally doable.
find quote
boyofford Offline
Member
Posts: 60
Joined: Apr 2009
Reputation: 0
Post: #3
spiff Wrote:uhrr. executebuiltin(updatelibrary(video))

yes. totally doable.

Thanks, i'm gona have a go at writing this i think.
Looks just the right size of project for my first go at scriptingBig Grin
find quote
rwparris2 Offline
Team-XBMC Python Developer
Posts: 1,333
Joined: Jan 2008
Reputation: 2
Location: US
Post: #4
Quote:If i have to scan manually sort of speak i have to go out of library mode and scan movies or series folders manually (don't have music so thats not a prob),
then return to library mode and go back to the views i prefer (e.g. all movies sorted by title)

You don't really have to leave the library to do this.
Inside the library in any view>context menu>update library.

In any case unless you want it to be smarter about when it scans, scripting is unnecessary.

Always read the XBMC online-manual, FAQ and search and search the forum before posting.
For troubleshooting and bug reporting please read how to submit a proper bug report.

If you're interested in writing addons for xbmc, read docs and how-to for plugins and scripts ||| http://code.google.com/p/xbmc-addons/
find quote
boyofford Offline
Member
Posts: 60
Joined: Apr 2009
Reputation: 0
Post: #5
rwparris2 Wrote:You don't really have to leave the library to do this.
Inside the library in any view>context menu>update library.

In any case unless you want it to be smarter about when it scans, scripting is unnecessary.


Your right! problem solved, not spotted that.
Would be good to just update everything from home screen/fav screen, but won't bug me as much now!
find quote
tetodbs Offline
Junior Member
Posts: 47
Joined: Jan 2010
Reputation: 0
Post: #6
Hi to all,

I've upgraded my xbmc to latest svn, before that I've used two scripts to auto update my library but now seems not to work.

The scripts are in "C:\Program Files (x86)\XBMC\scripts" folder and are the following:

autoexec.py
Code:
import xbmc, xbmcgui

xbmc.executebuiltin('XBMC.AlarmClock( VideoLibraryUpdater, XBMC.RunScript(special://home/scripts/VideoLibraryUpdater.py),45,true)')

VideoLibraryUpdater.py
Code:
import xbmc, xbmcgui
xbmc.executebuiltin('XBMC.UpdateLibrary(video)')
xbmc.executebuiltin('XBMC.AlarmClock( VideoLibraryUpdater, XBMC.RunScript(special://home/scripts/VideoLibraryUpdater.py),45,true)')

I found the scripts in this post, how can I make these to work with the new addon system?

Thanks and sorry for my englishRolleyes
find quote
Ilia Offline
Fan
Posts: 317
Joined: Dec 2008
Reputation: 0
Post: #7
I am interested in this as well,

I have put all that in a skin.autoupdater format with addon.xml, but unsure how special:// path relates to it or if can be made auto-executable?

Cheers,
find quote
TerranQ Offline
Senior Member
Posts: 297
Joined: Oct 2008
Reputation: 1
Post: #8
I'm just taking a guess here, but they should be in a script.autoupdater folder (I believe), and the name should be changed to default.py (again, I believe). Someone with some knowledge should be able to tell you for sure though.
find quote
Ilia Offline
Fan
Posts: 317
Joined: Dec 2008
Reputation: 0
Post: #9
Yep, had changed it into the script.* standard and have addon.xml file too.

I have 2 issues;

1. what will the new path be from "special://home/scripts/VideoLibraryUpdater.py"
2. how can I make the script auto-execute as before. making it default.py means i have to start it every time - deal breaker.

Thanks
find quote
Ilia Offline
Fan
Posts: 317
Joined: Dec 2008
Reputation: 0
Post: #10
anyone? I doubt I am the only user that wants an automatic way of updating the library.. Rolleyes
find quote
tetodbs Offline
Junior Member
Posts: 47
Joined: Jan 2010
Reputation: 0
Post: #11
Ilia Wrote:anyone? I doubt I am the only user that wants an automatic way of updating the library.. Rolleyes

No, you're not the only, please help us!!!Confused
find quote
TerranQ Offline
Senior Member
Posts: 297
Joined: Oct 2008
Reputation: 1
Post: #12
I'm an idiot at this stuff, but I don't think you need the special://path anymore. So

Code:
XBMC.RunScript(special://home/scripts/VideoLibraryUpdater.py)

is now just

XBMC.RunScript(script.foo), or something similar to that I think
find quote
Ilia Offline
Fan
Posts: 317
Joined: Dec 2008
Reputation: 0
Post: #13
Big Grin I got it working, here are the steps:

1. create a file called autoexec.py under xbmc/scripts/

PHP Code:
import timeos

time
.sleep(5)
xbmc.executebuiltin("XBMC.RunScript(%s/default.py,-startup)" % ( os.path.joinos.getcwd(), "../addons/script.au/" ))) 

2. create 3 files with this content under xbmc/addons/script.au (au = autoupdate)

addon.xml
PHP Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.au"
       name="Auto Updater"
       version="1.0"
       provider-name="forum">
  <requires>
    <import addon="xbmc.python" version="1.0"/>
  </requires>
  <extension point="xbmc.python.script"
             library="default.py" />
  <extension point="xbmc.addon.metadata">
    <summary lang="en">Auto Updater script</summary>
    <description lang="en">Auto Updater script</description>
    <platform>all</platform>
  </extension>
</addon> 

default.py
PHP Code:
import xbmcxbmcguios

command 
"XBMC.RunScript(%s)" % ( os.path.joinos.getcwd(), "VideoLibraryUpdater.py" ) )
xbmc.executebuiltin"AlarmClock(VideoLibraryUpdater,%s,45,true)" % ( command ) ) 

VideoLibraryUpdater.py
PHP Code:
import xbmcxbmcguios

xbmc
.executebuiltin('XBMC.UpdateLibrary(video)')
command "XBMC.RunScript(%s)" % ( os.path.joinos.getcwd(), "VideoLibraryUpdater.py" ) )
xbmc.executebuiltin"AlarmClock(VideoLibraryUpdater,%s,45,true)" % ( command ) ) 

Restart/Start xbmc and you should see Auto Updater in your list of addons/scripts - the script will also start on xbmc boot. Thats it.

Now the reason I created a "proper" script is that you can cancel the AlarmClock when you go to the addons/script and select the Auto Updater in xbmc.

Now,since I am a noob at python and xbmc scripting in general - I would love this to be cleaned up (possibly providing some settings screen) built into xbmc like recentlyupdated script for movies, so users can auto update they library!

enjoy!
Ilia
find quote
tetodbs Offline
Junior Member
Posts: 47
Joined: Jan 2010
Reputation: 0
Post: #14
Great Ilia, I'll try it asap.

Thanks for your support Big Grin
(This post was last modified: 2010-09-18 14:07 by sho.)
find quote
tetodbs Offline
Junior Member
Posts: 47
Joined: Jan 2010
Reputation: 0
Post: #15
Ok, I created the folder scripts inside xbmc install folder ("C:\Program Files (x86)\XBMC\scripts") and putted inside the autoexec.py, I created the folder script.au inside the addon folder and putted inside the other two files, but seems that the autoexec.py isn't starting, if I manully start the script the library is updating, if not nothing happens!!!

Any ideaConfused

Thanks
(This post was last modified: 2010-09-18 14:08 by sho.)
find quote
Post Reply