[Release] XBMC Backup

  Thread Rating:
  • 3 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
robweber Offline
Fan
Posts: 599
Joined: Sep 2009
Reputation: 15
Post: #11
(2012-04-26 04:08)paddycarey Wrote:  comparepathlists isn't quite finished yet, it's intended to be a function to use to compare the contents of two directories. so one list of files that exist in both lists, one list of files that exists only in the first list but not the second list and vice versa.

The results could then be used to perform a sort of one way sync, copying any new files, skipping any common files and removing any deleted files.

Not sure of any way to get a timestamp from a remote file though so you can't be sure which file is newer.

I think you're right, I saw in another thread once that someone was using the JSON-RPC functions for file operations and they were having the same issue. Might be something to add to XBMC's JSON functionality so it can be exposed for stuff like this.
find quote
e2zippo Offline
Senior Member
Posts: 196
Joined: Dec 2010
Reputation: 0
Post: #12
This looks great, thanks a lot!
find quote
klunde Offline
Junior Member
Posts: 3
Joined: Dec 2008
Reputation: 0
Post: #13
Just downloaded and testet it - it didn't work

Code:
12:02:56 T:10624  NOTICE: -->Python Interpreter Initialized<--
12:02:56 T:10624  NOTICE: script.xbmcbackup: Starting
12:02:56 T:10624  NOTICE: script.xbmcbackup: Local Dir: C:\Users\moluo\AppData\Roaming\XBMC\
12:02:56 T:10624  NOTICE: script.xbmcbackup: Remote Dir: C:\Data\Backup\xbmc_backup/
12:02:56 T:10624  NOTICE: script.xbmcbackup: Remote Path exists - may have old files in it!
12:02:56 T:10624   ERROR: Error Type: <type 'exceptions.UnicodeEncodeError'>
12:02:56 T:10624   ERROR: Error Contents: 'ascii' codec can't encode character u'\xc2' in position 59: ordinal not in range(128)
12:02:56 T:10624   ERROR: Traceback (most recent call last):
                                              File "C:\Users\moluo\AppData\Roaming\XBMC\addons\script.xbmcbackup\default.py", line 188, in <module>
                                                backup.run()
                                              File "C:\Users\moluo\AppData\Roaming\XBMC\addons\script.xbmcbackup\default.py", line 119, in run
                                                self.syncFiles()
                                              File "C:\Users\moluo\AppData\Roaming\XBMC\addons\script.xbmcbackup\default.py", line 132, in syncFiles
                                                self.fileManager.createFileList(self.Addon)
                                              File "C:\Users\moluo\AppData\Roaming\XBMC\addons\script.xbmcbackup\default.py", line 26, in createFileList
                                                self.walkTree(self.walk_path + "addons/")
                                              File "C:\Users\moluo\AppData\Roaming\XBMC\addons\script.xbmcbackup\default.py", line 65, in walkTree
                                                self.addFile(filePath)
                                              File "C:\Users\moluo\AppData\Roaming\XBMC\addons\script.xbmcbackup\default.py", line 70, in addFile
                                                self.fHandle.write(str(filename) + "\n")
                                            UnicodeEncodeError: 'ascii' codec can't encode character u'\xc2' in position 59: ordinal not in range(128)
find quote
robweber Offline
Fan
Posts: 599
Joined: Sep 2009
Reputation: 15
Post: #14
From the error it looks like there was a character in one of you filenames that couldn't be encoded to ASCII (for writing the copy list). I'm curious as to what the filename was but it doesn't look like we're going to get that info from this log file. If you could add the following line after line 69 in the default.py file it should print out the filename to the log right before it calls the function that seems to cause the error. Make sure it is on the same indent line as the next line and it should run. Please post your results back here.

Code:
xbmc.log(str(filename))
find quote
Bond13579 Offline
Junior Member
Posts: 34
Joined: Feb 2012
Reputation: 0
Post: #15
I'll post the logs with that line of code since I'm having the same issue. Looks like it doesn't like the dash, '-'.


14:58:42 T:3808 NOTICE: addons\skin.aeonmq.3\media\flags\music\recordlabel\Republic.png
14:58:42 T:3808 NOTICE: addons\skin.aeonmq.3\media\flags\music\recordlabel\Rhino.png
14:58:42 T:3808 NOTICE: addons\skin.aeonmq.3\media\flags\music\recordlabel\Roadrunner.png
14:58:42 T:3808 NOTICE: addons\skin.aeonmq.3\media\flags\music\recordlabel\Roc-A-Fella.png
14:58:42 T:3808 ERROR: Error Type: <type 'exceptions.UnicodeEncodeError'>
14:58:42 T:3808 ERROR: Error Contents: 'ascii' codec can't encode character u'\u201d' in position 58: ordinal not in range(128)
14:58:42 T:3808 ERROR: Traceback (most recent call last):
File "C:\Users\Parnell\AppData\Roaming\XBMC\addons\script.xbmcbackup\default.py", line 189, in <module>
backup.run()
File "C:\Users\Parnell\AppData\Roaming\XBMC\addons\script.xbmcbackup\default.py", line 120, in run
self.syncFiles()
File "C:\Users\Parnell\AppData\Roaming\XBMC\addons\script.xbmcbackup\default.py", line 133, in syncFiles
self.fileManager.createFileList(self.Addon)
File "C:\Users\Parnell\AppData\Roaming\XBMC\addons\script.xbmcbackup\default.py", line 26, in createFileList
self.walkTree(self.walk_path + "addons/")
File "C:\Users\Parnell\AppData\Roaming\XBMC\addons\script.xbmcbackup\default.py", line 65, in walkTree
self.addFile(filePath)
File "C:\Users\Parnell\AppData\Roaming\XBMC\addons\script.xbmcbackup\default.py", line 68, in addFile
xbmc.log(str(filename))
UnicodeEncodeError: 'ascii' codec can't encode character u'\u201d' in position 58: ordinal not in range(128)
find quote
robweber Offline
Fan
Posts: 599
Joined: Sep 2009
Reputation: 15
Post: #16
Thanks for posting the log. I think you're right about the dash, however I know for a fact that dashes will work since I use them to designate directory vs file when writing the restore.txt document. I'm going to get the skin you're trying to backup and see if I can recreate the error. I'll report back what I find.
find quote
Bond13579 Offline
Junior Member
Posts: 34
Joined: Feb 2012
Reputation: 0
Post: #17
I'm not sure anymore cause I just did a lookup of Unicode \u201d and it's a double quotation mark.
find quote
e2zippo Offline
Senior Member
Posts: 196
Joined: Dec 2010
Reputation: 0
Post: #18
Just tried it on both my XBMC installs and the script fails, I'm running Aeon Nox Beta 3.0.0
(This post was last modified: 2012-05-07 17:47 by e2zippo.)
find quote
robweber Offline
Fan
Posts: 599
Joined: Sep 2009
Reputation: 15
Post: #19
I'm having a hard time reproducing this (ie, I can't!). The skin may or may not be relevant, although I've tried the ones listed above with no issues on my end. It may be another addon or file path altogether.

@Bond13579 - could you post a full debug log to the xbmc pastebin site? Start with turning on XBMC, then run the backup addon until it errors and post everything. I'm trying to narrow down exactly what addons and settings are being used so I can recreate them. Also, what options are you using - Addons, Addon Data, thumbnails etc.

Thanks.
find quote
lifenoobie Offline
Junior Member
Posts: 1
Joined: May 2012
Reputation: 0
Post: #20
@robweber: I have the same problem as e2zippo. Was having problems with sound after adding addons. Luckily I backed up xbmc prior to the additions. Although I was getting the script error message described above. After fruitless attempts, I uninstalled xbmc, and reinstalled. I added "xbmc backup" and I'm not able to restore my previous settings. I'm getting the same script error. I tried debugging, but I don't actually see where the "xbmc.log" is stored. Below is the log file. Any ideas what I'm doing wrong? Thanks for the help!

20:24:29 T:5068 NOTICE: script.xbmcbackup: Starting
20:24:29 T:5068 NOTICE: script.xbmcbackup: Local Dir: C:\Users\media center\AppData\Roaming\XBMC\
20:24:29 T:5068 NOTICE: script.xbmcbackup: Remote Dir: smb://FREENAS/media_drive/downloads/xbmc_backup/xbmc_backup/
20:24:29 T:5068 INFO: Loading skin file: DialogProgress.xml
20:24:29 T:5068 DEBUG: DialogProgress::StartModal called
20:24:29 T:5068 DEBUG: ------ Window Init (DialogProgress.xml) ------
20:24:29 T:5068 DEBUG: JSONRPC: Incoming request: { "jsonrpc" : "2.0" , "method" : "Files.GetDirectory" , "params" : { "directory" : "smb://FREENAS/media_drive/downloads/xbmc_backup/xbmc_backup/addons/" , "sort" : { "method" : "file" } } , "id" : 1 }
20:24:29 T:5068 DEBUG: JSONRPC: Calling files.getdirectory
20:24:29 T:5068 DEBUG: CUtil::GetMatchingSource: no matching source found for [smb://FREENAS/media_drive/downloads/xbmc_backup/xbmc_backup/addons/]
20:24:29 T:5068 DEBUG: Previous line repeats 4 times.
20:24:29 T:5068 ERROR: XFILE::CDirectory::GetDirectory - Error getting smb://FREENAS/media_drive/downloads/xbmc_backup/xbmc_backup/addons/
20:24:29 T:5068 INFO: -->Python script returned the following error<--
20:24:29 T:5068 ERROR: Error Type: <type 'exceptions.KeyError'>
20:24:29 T:5068 ERROR: Error Contents: 'result'
20:24:29 T:5068 ERROR: Traceback (most recent call last):
File "C:\Users\media center\AppData\Roaming\XBMC\addons\script.xbmcbackup\default.py", line 188, in <module>
backup.run()
File "C:\Users\media center\AppData\Roaming\XBMC\addons\script.xbmcbackup\default.py", line 122, in run
self.restoreFiles()
File "C:\Users\media center\AppData\Roaming\XBMC\addons\script.xbmcbackup\default.py", line 140, in restoreFiles
self.fileManager.createFileList(self.Addon)
File "C:\Users\media center\AppData\Roaming\XBMC\addons\script.xbmcbackup\default.py", line 26, in createFileList
self.walkTree(self.walk_path + "addons/")
File "C:\Users\media center\AppData\Roaming\XBMC\addons\script.xbmcbackup\default.py", line 57, in walkTree
for (path, dirs, files) in vfs.walk(directory):
File "C:\Users\media center\AppData\Roaming\XBMC\addons\script.xbmcbackup\resources\lib\vfs.py", line 50, in walk
for x in listdir(current_path, extra_metadata=True):
File "C:\Users\media center\AppData\Roaming\XBMC\addons\script.xbmcbackup\resources\lib\vfs.py", line 100, in listdir
if jsonobject['result']['files']:
KeyError: 'result'
20:24:29 T:5068 INFO: -->End of Python script error report<--
20:24:29 T:5068 INFO: Python script stopped

[Image: screenshot001.png]
(This post was last modified: 2012-05-14 02:42 by lifenoobie.)
find quote
Post Reply