robweber / xbmcbackup

Backup Addon for Kodi
MIT License
112 stars 48 forks source link

Use script.module.dropbox to avoid duplicate code #151

Closed SchapplM closed 5 years ago

SchapplM commented 5 years ago

There is an addon called script.module.dropbox, which contains the Dropbox API and is part of the official Kodi Addon repository. To avoid duplicate code and to simplify future API changes from Dropbox, it would be good to use this as a dependency and remove the directory "/resources/lib/dropbox" in this addon. The files seem to be identical despite of a few minor changes to dropbox.py, oauth.py, session.py, stone_serializers.py and stone_validators.py. The changes are mostly entitled "#fix for python 2.6". You can use the dependency with "\<import addon="script.module.dropbox" version="8.4.0"/>" in the addons.xml.

robweber commented 5 years ago

Thanks for the reminder, I'll be honest I kind of forgot about that module. As soon as I read your comments I recalled having this same discussion a while back: https://github.com/micahg/script.module.dropbox/issues/5

I'll work on doing this as I refactor things for Python 3.

SchapplM commented 5 years ago

Actually, I also forgot about our discussion two years ago and stumbled upon your code by accident :-)

robweber commented 5 years ago

I tried stripping out my Dropbox code and importing the script.modul.dropbox library. I noticed an error right away on Kodi Leia regarding the import of a pkg_resources file within the Dropbox library. It looks like I had fixed this error within my own addon by including a pkg_resources file. Not sure if this is a windows only thing but I've started a pull request for the script.module.dropbox module that will fix this.

One that error was fixed I was able to run everything from authorization through to doing a complete backup so I think as a drop-in replacement this will work great.