Backing up movie db


6 posts
by crysis24 » Sun Feb 10, 2013 5:39 pm
hi all

sorry if this is a repost but im new and i need abit of help.

i have just scraped all my info for my movies and tv series, how do i save this so called xbmc/userdata/database file and how do i access it?

can i put the sd card back into my laptop to access it and make a backup or not?

any help is appreciated

thanks
Posts: 5
Joined: Fri Jan 25, 2013 3:20 am
by DBryant » Sun Feb 10, 2013 6:19 pm
The database is an sqlite3 file, and you can simply copy these files to another location. Be sure that there is no activity on the file when you do this, for example don't do a library clean and then prompty copy the file.

I have a script on my remote system that uses:
scp -r pi@raspbmc.local/:home/.xbmc ./rasppi

at its core i.e. it copies the .xbmc directory and all its content to a local folder. I've restored the data many timewithout any ill-effect!

There is a program add-on that will copy the usrdata but I can't recommend it at all. Totally trashed my own set-up, at least in my mind it did, so I'd be careful with it.

You can also look at the database using the sqlite3 tool. Try for example:
sqlite3 .xbmc/userdata/Database/MyMusic32.db

You will have a new "sqlite>" prompt and can manage the database. Some examples:
.tables ... will list tables in the database
select * from artist; ... list all database entries. Note these is a closing ; on these lines
select count(*) from artist; ... count the number of artists
.exit .. .to exit

The database queries are standard SQL, so there are plenty of tutorials concenring usage.
The point is there are .dump and .backup commands. I'd suggest Googling sqlite3 on how these might be used, then ask further questions on this forum.

You can remove the SD and carry out a bye-by-byte clone of it to some different media. Since the OS on the SD is not active, this is quite a robust backup procedure i.e. files are not open and can be copied with confidence. You will want to investigate the dd command (on Linux); MacOS and Windows have simialr utilities. Try searching this forum for backup, there are plenty of entries.

Hope this helps, and gets you up and running.

Dave
Posts: 279
Joined: Sat Feb 02, 2013 12:41 pm
Location: Berkshire, UK
by crysis24 » Sun Feb 10, 2013 6:41 pm
thanks for the reply Dave.

unfortunately i havent got a clue what you were talking about no offence, you know a lot more than i do.
all i know how to do is install xbmc, plug the sd card into my pi, sort the settings out within xbmc and scrape my media from my nas and thats it, when it comes to this whole linux and typing code to do things i unfortunately just get hopelessly lost and confused.

but thanks for the reply.
glen
Posts: 5
Joined: Fri Jan 25, 2013 3:20 am
by DBryant » Sun Feb 10, 2013 7:14 pm
Bit of reading to do then!

I assume you've installed something like Raspbmc? You need to quote this for folk to have some clue where you're coming from . Scraping is not a term I'd come across myself but was 'introduced' to it ia XBMC, so I'm adding 2 + 2 and may getting 5?

The data within the database is accessed via the Library tab within the XBMC environment. It hass simply stored details about your movies and tv shows in the database (a single file in this case) so that you, the user, can query it to provide some valued added experience, searching out a series, for a given date and so on.

The 'so-called database' is a true database with quite a long pedigree. Databases of this type use the Structure Query Language (SQL) to return searches to the user; in the simplest case someone's written some software that will ask you for the name of something (say) and then return details about it to you in the form of lists from which you can make selections to play etc. However users can also access databases themselves directly; system admin. people do it all the time to backup data and the like. They uses tools like sqlite3 to do this and most of the time they do it from the command line.

You have a Pi and what other system(s)? Windows?

What are your aspirations with the Pi? Its possible you may just want to install something like XBMC and have your own medai server. So you only want to backup data to ensure that you can recover a 'lost' system. Or you may want to get into Linux, learn to programme, play with databases or more advanced stuff. Your exposure to the command line will vary greatly depending upon your answers, however you be prepared for quite a learning curve.
Posts: 279
Joined: Sat Feb 02, 2013 12:41 pm
Location: Berkshire, UK
by crysis24 » Sun Feb 10, 2013 7:29 pm
thanks dave

i used raspbmc via my windows laptop to install xbmc onto my sd card.
i mainly use my pi as a media server which in turn looks to my nas box. the whole process of actually using the pi and "scraping" or "fetching" the media info from the net using the universal scraper is what i meant and this process was really easy for me to do.

the only reason i ask about the whole database backup is so that every time a new build of xbmc is released i have have to reinstall xbmc i dont then have to sit and wait for it to add all the covers and fan art back to the pi.

i have found this "xbmc backup" you mentioned and have done a backup to my nas which i currently around 400mb in size, so i will get a another sd card tomorrow and do a fresh install of xbmc on it and then try and do a restore and see how it goes from there.

thanks again for your reply
glen
Posts: 5
Joined: Fri Jan 25, 2013 3:20 am
by DBryant » Sun Feb 10, 2013 7:54 pm
You will probably want to investigate WinSCP which allow you to drop into the command line on the PI vi ssh (secure shell). This where Linux folk do their business.

As I said, to create a backup of your existing, running system, remove the SD and clone it on your windows system; Google how do do this. Remember Google is your friend.

You have to be wary installing a new raspbmc and then copying the database alone. The database may change its structure (by software design) across different releases and so the restore won 't function. Usually this would be handled by the sofware developer, who will provide an upgrade path from one release of their software to another. In your proposed work flow there is a possibility that the new system would not run; depends how often the database structure (aka schema) changes. Could be fine for months and then suddenly 'crunch'.

Good luck
Posts: 279
Joined: Sat Feb 02, 2013 12:41 pm
Location: Berkshire, UK