2014-11-14, 20:48
(2014-11-12, 20:22)andisa Wrote: Does XBMC Backup work for anyone with Kodi 14.0 beta1&2?
I've not tested this on Helix yet myself. If you have any feedback in this area please let me know. I did read something about paths needing to end in a slash when using the xbmcvfs.exists() function in Helix but haven't tested that yet.
(2014-11-13, 21:02)jenoyend Wrote: Hello, I succeed in what I wanted to do, run a script during the backup and the restore part.
I had an issue because the script were on my Hard drive.
Even with a chmod 777, I was not able to run it.
So I first copy the script in a temp folder, then run it and delete the temp folder.
I succeed to run a shell script but not a python script.
Glad you were able to get everything working to your satisfaction. I did have a few comments/questions:
1) If you want a temp directory you can use the special://temp directory, this is where xbmc would normally put temporary files. You can use xbmc.translatePath('special://temp') to get it's exact location on each system.
2) Not that it matters much but by using the xbmcvfs instead of shutil and os classes you'd probably get some better cross-platform support. If you're just running this on a few local boxes it probably isn't a big deal.
3) Why the many dialog prompts? If the user has already setup the scripts to run in the settings is it worth sitting on an OK dialog until someone hits a button to run it? I'm just thinking of instances where you might schedule a backup and there isn't someone sitting at the screen to hit the OK prompts. The system might sit there waiting for hours/days.
4) If you want to run a python script this is doable, but you need to pass some other parameters to the subprocess function. If you know the python binary is in the system path you could do subprocess.call(["python",temp_script_path], shell=True) - this would call >python path_top_file.py at a command prompt. You'd probably want some additional logic to test the extension of the script to know if it needed to be launched as a batch/shell script or a python file. I suppose you could also just write a batch file that calls "python file.py" as well.