How do I automate library export?
#16
One option is to create an autoexec.py file. This is a script that XBMC executes whenever it starts, so if you put code to export the database in this file it will export the database every time XBMC starts.

Assuming you're using Windows, press Windows-R and in the Run dialog type:

notepad "%appdata%\xbmc\userdata\autoexec.py"

and click OK. If you're asked to create a new file answer Yes. When Notepad opens copy and paste the following:

Code:
import xbmc

xbmc.executebuiltin('exportlibrary(video,true,true,true,true)')

Close Notepad and save the changes. Now start XBMC and you should see the export run. I've tested this on my PC and it works, though if the export takes more than a few seconds it's a bit intrusive. It would annoy me.

Another option is to run the script manually, though I'd guess from the context this isn't appropriate. Alternatively you could create a batch file that you run from the Task Scheduler. However note that XBMC has to be running when the scheduled task runs because the scheduled task can't export the library directly. It has to ask XBMC to do the export. Note also that when the scheduled task runs the user will see the "Export in progress" message appear while XBMC does the export.

JR
Reply
#17
J, I could kiss you, but I'll give you a gold star, a merit badge, and a bottle of port instead. This is exactly the kind of helpful, complete and succinct answer I was hoping to get. Thankyou!!

I already have the machine set up to auto-restart during the wee hours just before dawn (so that any Windows updates are cleared & ready to go, and re-settle the machine after the scheduled auto-defrag that happens after midnight) so this will fit in nicely -- all the automation of scanning for changes, updating the library, and exporting metadata are done and out of the way before the user gets up in the morning to check the weather.

(Message to the rest of you hapless geeks, pay attention, take notes, and follow this example of excellent assistance!)
Reply
#18
Hyram Wrote:(Message to the rest of you hapless geeks, pay attention, take notes, and follow this example of excellent assistance!)

With this attitude no-one will help you!
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
#19
And your attitude, young man, is exemplary of everything that is wrong with the open-source community of today. Notice that key word, commuity -- a group of people with the same interests and beliefs who work together to sustain and improve the community as a whole.

JR is a good example of the right way to behave in a community such as this one -- by openly sharing his knowledge and communicating effectively, the people he helps can help others, and everybody benefits. Never assume people know half as much as you do, they usually know a lot less (but have a wealth of knowledge in other areas).
Reply
#20
Hyram Wrote:(Message to the rest of you hapless geeks, pay attention, take notes, and follow this example of excellent assistance!)

Not a necessary comment

Most people offer an idea before they waste their time giving a full explanation

You would be better off using

Code:
import xbmc

xbmc.executebuiltin('exportlibrary(video,true,true,false,true)')

Using the above should only export movies with missing items no point exporting everything if its already been exported
Current HTPC Lian-Li PC-C37 • Gigabyte GA-E7AUM-DS2H • Intel C2D E8400 E0 Stepping • OCZ Vertex SSD • 4GB Corsair TwinX XMS2 DDR2 • Corsair HX650W Modular PSU (Free Upgrade) • LG CH08LS10 Blu-Ray Drive • Scythe Big Shuriken • Acousti DustPROOF 70mm Fan
Reply
#21
>>X<<' Wrote:Not a necessary comment. Most people offer an idea before they waste their time giving a full explanation.

I disagree completely. Rather than throwing fishbait, the sensible approach is to get further clarification of the assistance required by asking questions. Any responses will give the supporter a better idea of the level of understanding the questioner has -- they can then use this to formulate an answer with an appropriate level of detail that the questioner can comprehend, as JC did with me.

If it takes being blunt to the point of rudeness to swift-arse-kick most OSS people into understanding this basic concept of communication and community, then that's what I'll do, and hang the consequences -- it's for the community's own good.

Quote:Using the above should only export movies with missing items no point exporting everything if its already been exported

A valid point; I'll test both, but I think I'll end up going with JC's and do a dump-everything as it guarantees that all parallel metadata is no more than 24 hours older than what's in the database.
Reply
#22
Hyram Wrote:(Message to the rest of you hapless geeks, pay attention, take notes, and follow this example of excellent assistance!)

Most users (even Mac) try to meet us half way. You know they ask a question, we post a solution. If it's complicated they state they need a little help on it.

But because it was outside your comfort zone, you completely tossed out the suggestions.

A lot of open source software that needs to be modified for an individuals use takes you out of that comfort zone.

An easy to use text editor (perfect for Batch, Python, XML, and HTML) is Notepad ++ this will help for any file creation.

You called us hapless, but we gave you help and you spat in our faces because it required work on your end. Put some more effort than ask on the forums, and wait for the complete solution. By learning to do a little research you may be able to help others, than be a hapless ingrate.
Image
Reply
#23
For the record, I'm not keen on my friends being called hapless geeks.

JR
Reply
#24
is there a way to export only the data for movies and not for TV-Shows? I dont like all the extra *.nfo and *.tbn files in the flolder of one season.
Reply
#25
Raphy Wrote:is there a way to export only the data for movies and not for TV-Shows? I dont like all the extra *.nfo and *.tbn files in the flolder of one season.

No but you could export to single file to a path of your choice then you wouldn't have any local files in with your media I guess it depends on your reason for exporting your library if its purely as a backup then it should matter what method you use

If its for any other reason then I would use a media manager and then your have much more control as TV and Movie scraping can be set up separately plus its much faster and artwork is of higher quality when you export your library the artwork is the size its cached at
Current HTPC Lian-Li PC-C37 • Gigabyte GA-E7AUM-DS2H • Intel C2D E8400 E0 Stepping • OCZ Vertex SSD • 4GB Corsair TwinX XMS2 DDR2 • Corsair HX650W Modular PSU (Free Upgrade) • LG CH08LS10 Blu-Ray Drive • Scythe Big Shuriken • Acousti DustPROOF 70mm Fan
Reply
#26
Thank You for awesome idea.
Can it execute at shutdown?
Reply
#27
wmzyk Wrote:Thank You for awesome idea.
Can it execute at shutdown?

I don't think XBMC has an option to run a script at shutdown, so I guess the answer is no.

JR
Reply
#28
I think i found workaround
I can execute this script with onclick of shutdown or exit in power menu
Just need to dig through confluence xml's Smile
Reply
#29
jhsrennie Wrote:One option is to create an autoexec.py file. This is a script that XBMC executes whenever it starts, so if you put code to export the database in this file it will export the database every time XBMC starts.

Assuming you're using Windows, press Windows-R and in the Run dialog type:

notepad "%appdata%\xbmc\userdata\autoexec.py"

and click OK. If you're asked to create a new file answer Yes. When Notepad opens copy and paste the following:

Code:
import xbmc

xbmc.executebuiltin('exportlibrary(video,true,true,true,true)')

Close Notepad and save the changes. Now start XBMC and you should see the export run. I've tested this on my PC and it works, though if the export takes more than a few seconds it's a bit intrusive. It would annoy me.

Another option is to run the script manually, though I'd guess from the context this isn't appropriate. Alternatively you could create a batch file that you run from the Task Scheduler. However note that XBMC has to be running when the scheduled task runs because the scheduled task can't export the library directly. It has to ask XBMC to do the export. Note also that when the scheduled task runs the user will see the "Export in progress" message appear while XBMC does the export.

JR

Thank you very much. This is perfect!
TV: VIZIO E-Series 43”
HTPC: Raspberry Pi 3
STORAGE: Windows 8 Server with DrivePool (Currently with 24TB)
Reply
#30
Hi Everyone,

I tried the 'autoexec.py' solution, which worked like a dream, but I can't seem to find where XBMC writes the export to.

Would someone kindly be able to point me in the right direction.

Thanks in advance.

Regards,

Phil.
Reply

Logout Mark Read Team Forum Stats Members Help
How do I automate library export?0