Kodi Community Forum
[Release] Backup (formerly XBMC Backup) - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+---- Forum: Program Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=151)
+---- Thread: [Release] Backup (formerly XBMC Backup) (/showthread.php?tid=129499)



RE: [Release] XBMC Backup - Samu-rai - 2014-05-01

OK, having looked into it a bit more I think I get the gist of it. I'll have another go when I get home.

I'm still not clear with regard to the "archive" parameter though. Is this just the name of the restore folder?


RE: [Release] XBMC Backup - robweber - 2014-05-01

(2014-04-30, 23:07)Samu-rai Wrote: I'm trying to write a script that will call a specific restore, and can see from the readme on github this is possible.

I'm very new to coding, and struggling to understand how to implement this.

Would you be so kind as to get me started?

Can I do this with python, or will I have to use JSON, and how do I locate the 'Archive' number?

Are you writing something that will run within XBMC or an external script? That will somewhat determine what methods might be available. The archive parameter is the name of the folder you wish to restore. The addon will still use your directory settings like normal, so you only need to pass in the folder name, not its full path. If within another XBMC addon on the same box as the one you want to restore to you can use the example as seen on the README:

Code:
import xbmc

xbmc.executeJSONRPC('{ "jsonrpc": "2.0", "method": "Addons.ExecuteAddon","params":{"addonid":"script.xbmcbackup","params":{"mode":"restore","archive":"201405010000"}}, "id": 1 }')

If you are trying to do this from an external script, or perhaps using a script on one xbmc instance to perform a restore on another you'll still need to use JSON, but you'll have to do a full request over http

Code:
import json
import urllib2
import base64

data = '{ "jsonrpc" : "2.0" , "method" : "Addons.ExecuteAddon" , "params" : {"addonid":"script.xbmcbackup","params":{"mode":"restore","archive":"201405010000"}}, "id":1 }'

clen = len(data)
        
hostdetails = "http://" +xbmc_address + ":" + json_port + "/jsonrpc"

req = urllib2.Request(hostdetails, data, {'Content-Type': 'application/json', 'Content-Length': clen})

#you only need this if you password protect your xbmc web server
if password != '':
   base64string = base64.encodestring('%s:%s' % (user, password))[:-1]
   authheader =  "Basic %s" % base64string
    req.add_header("Authorization", authheader)        

try:
    f = urllib2.urlopen(req)
    response = json.loads(f.read())
    f.close()

     if(response.has_key('result')):
          result = response['result']
except:
     pass

As far as getting a list of the archives, that will be a bit harder. It may be useful for me to just provide this as a "mode" that returns a list of archives. The only other way right now would be to poll the directory you are storing the backups in manually. The folder name is the backup archive.

In my SendTo addon I have some python classes I called the CommsManager that abstracts some of this for easy use. The idea is that there is a Local and Remote Comms manager that extend the same object. It's under an MIT license so grab whatever might help you out.

https://github.com/robweber/script.sendto/blob/master/resources/lib/commsmanager.py


RE: [Release] XBMC Backup - Samu-rai - 2014-05-01

Thanks Rob.

I'm running the script within XBMC, so have tried you use the example from the README, but it brings the mode GUI and goes no further, rather than just running the stated archive.

Is this because I'm running Frodo?


Re: RE: [Release] XBMC Backup - robweber - 2014-05-01

(2014-05-01, 20:34)Samu-rai Wrote: Thanks Rob.

I'm running the script within XBMC, so have tried you use the example from the README, but it brings the mode GUI and goes no further, rather than just running the stated archive.

Is this because I'm running Frodo?

Oh yea, that would do it. The archive arg is Gotham only. Just checked the frodo code to confirm.


RE: [Release] XBMC Backup - Samu-rai - 2014-05-01

Oh OK.

Nevermind then. I'll have to think of a 'hack' Smile

Thanks for your help.


RE: [Release] XBMC Backup - kodaxx - 2014-05-02

(2014-04-28, 15:51)robweber Wrote:
(2014-04-25, 18:48)kodaxx Wrote: Is this still alive? This is the most frustrating issue!!!
Not sure what you mean here. This addon is very much alive, are you referring to some issue in particular?

Sorry, I was referring to this pull request, as my current hardware running Android keep losing it's settings when it loses power. I was reading in the forum of a conversation between you and the PR author and I was curious if you know what was going on with it. Sorry if I wasn't specific, I was using my phone and I tend to get lazy (horrible excuse, I know.)


RE: [Release] XBMC Backup - Samu-rai - 2014-05-04

Sorry to bombard you with more questions.

I've managed to get my 'hack' to work on Frodo (at least 90% of the time anyway), but the addon isn't behaving as I was expecting.

It was my understating that while it will not change existing files which are no present in the restore back up, it will replace that already present if there is.

Is this not the case?


RE: [Release] XBMC Backup - Samu-rai - 2014-05-05

Having tested it a bit more, I think I may have this all wrong.

I just did a full restore, and the only files that appear to of been replaced/restored are the system files (advancedsettings, favorites etc).

Is that right?


RE: [Release] XBMC Backup - robweber - 2014-05-05

(2014-05-02, 04:32)kodaxx Wrote:
(2014-04-28, 15:51)robweber Wrote:
(2014-04-25, 18:48)kodaxx Wrote: Is this still alive? This is the most frustrating issue!!!
Not sure what you mean here. This addon is very much alive, are you referring to some issue in particular?

Sorry, I was referring to this pull request, as my current hardware running Android keep losing it's settings when it loses power. I was reading in the forum of a conversation between you and the PR author and I was curious if you know what was going on with it. Sorry if I wasn't specific, I was using my phone and I tend to get lazy (horrible excuse, I know.)

I honestly don't know the status of that pull request. Looks like there hasn't been any activity there in some time. As you've probably guessed it didn't make it into Gotham. Perhaps now that it is out we'll see some action on this.

(2014-05-04, 22:30)Samu-rai Wrote: Sorry to bombard you with more questions.

I've managed to get my 'hack' to work on Frodo (at least 90% of the time anyway), but the addon isn't behaving as I was expecting.

It was my understating that while it will not change existing files which are no present in the restore back up, it will replace that already present if there is.

Is this not the case?

You're correct, that is not the way the addon works. It does not check if files exist, or any sort of timestamp information when doing a restore. The basic idea is that if a file exists in the restore archive, it is copied to the original location. If there is already a file there it is overwritten.

You can cherry pick things by category, to an extent. For example, in the addon settings if you have only Database and Config Files selected, then only those types of files will be transferred from the backup archive during a restore. Any files within these categories will be transferred however.

The reason for this behavior is that if you were to install XBMC from scratch you'd have a lot of files already existing by default. This includes database files, certain config files, etc, etc. If the addon was to ignore existing files you'd end up missing a lot of the data in your archive during a restore.


RE: [Release] XBMC Backup - Samu-rai - 2014-05-05

Thanks Rob.

I'm slighlty confussed then, because it doesn't appear that the addon is working as it should on my system.

As above, I did a full restore of an entire system, and according to the date stamp shown, nothing was replaced other than the system/config files.

I've also been trying to get 2 specific python scripts to install, and whether I try and overwrite them, or delete them both prior to commencing the restore, neither will. Confused


RE: [Release] XBMC Backup - Samu-rai - 2014-05-05

OK so I've worked out what it is.

I am trying to restore from a path of 'special:\\home\addons\myaddon' but XBMC backup doesn't like this, and wont restore any files in either the addons or addon_data folders.

However, if I change this to an absolute path, then it will. Smile


Cross Platform support - msfarrar - 2014-05-15

I'm running xbmc on several platforms including android tablet, windows 7, xbmcbuntu , rpi

Basically Im using the rpi as a samba share and then wirelessly accessing smb files on the tablets and netbooks
Also i have a second copy of all the media on a win7 HTPC which i use for recording (WMC) and playback (XBMC) in family room.

the question is this.. can I restore to all these platforms from a single backup
( I know that I would have to edit the video node source to reflect whether its E:\Movies or smb:\\rpi\devices\Movies etc )

It would life easier to know that I do not have to backup xbmc on ALL platforms

BTW. Great Add-on !! Its the only one I use Smile


RE: [Release] XBMC Backup - DARKFiB3R - 2014-05-15

Script failed, plz help.

http://xbmclogs.com/show.php?id=201876

Thanks Smile


RE: [Release] XBMC Backup - robweber - 2014-05-15

(2014-05-15, 05:57)msfarrar Wrote: I'm running xbmc on several platforms including android tablet, windows 7, xbmcbuntu , rpi

Basically Im using the rpi as a samba share and then wirelessly accessing smb files on the tablets and netbooks
Also i have a second copy of all the media on a win7 HTPC which i use for recording (WMC) and playback (XBMC) in family room.

the question is this.. can I restore to all these platforms from a single backup
( I know that I would have to edit the video node source to reflect whether its E:\Movies or smb:\\rpi\devices\Movies etc )

It would life easier to know that I do not have to backup xbmc on ALL platforms

BTW. Great Add-on !! Its the only one I use Smile

You can restore to all the different platforms from a different backup, the files being backed up are not specific to any one platform. As you said though, you may want to be careful if these locations are pointing to different media locations. Restoring databases or sources files will quickly screw things up if you expect them to point somewhere else. Generally I only recommend this if all your devices are sharing the same source paths. If you aren't backing up the databases though everything else should be fine.

(2014-05-15, 11:24)DARKFiB3R Wrote: Script failed, plz help.

http://xbmclogs.com/show.php?id=201876

Thanks Smile

Looks like you've hit the famous Unicode error. This thing rears it's ugly head from time to time. Does the remote path you are trying to use contain any non-ascii characters?


RE: [Release] XBMC Backup - method115 - 2014-05-15

How do we start a backup? I've configured everything and I just want to go ahead and do a manual backup right now.