diff --git a/.travis.yml b/.travis.yml index 7651c98..7484677 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,5 +10,5 @@ before_script: # command to run our tests script: - - flake8 ./ --statistics --show-source --ignore=E501,E722 --exclude=croniter.py,relativedelta.py,*/dropbox/* # check python structure against flake8 tests, ignore long lines + - flake8 ./ --statistics --show-source --builtins=sys --ignore=E501,E722 --exclude=croniter.py,relativedelta.py,*/dropbox/* # check python structure against flake8 tests, ignore long lines - kodi-addon-checker --branch=matrix --allow-folder-id-mismatch \ No newline at end of file diff --git a/addon.xml b/addon.xml index 74d199d..52be839 100644 --- a/addon.xml +++ b/addon.xml @@ -80,12 +80,10 @@ Už ste niekedy poškodili konfiguráciu Kodi a priali si mať zálohu? Teraz môžete - na jeden klik. Môžete exportovať Vašu databázu, playlist, náhľady, doplnky a konfigurácie na ktorýkoľvek zdroj zapisovateľný Kodi. Zálohy môžu byť púšťané na požiadanie alebo plánovačom. Har du någonsin tappat bort din Kodi konfiguration och önskat att du hade en backup? Nu kan du enkelt med ett klick. Du kan exportera din databas, spellista, minityrer, tillägg och andra konfigurationsdetaljer till valfri källa som är skrivbar för Kodi. Backupper kan köras på begäran eller via scheman. 你是否经常折腾你的 Kodi,因而希望能够有个备份?你可以把资料库、播放列表、缩略图、插件和其他配置细节导出到 Kodi 可以写入的任意位置。备份可以按需运行或通过计划任务执行。 - all - The MIT License + MIT https://forum.kodi.tv/showthread.php?tid=129499 https://github.com/robweber/xbmcbackup - resources/images/icon.png resources/images/screenshot1.png diff --git a/default.py b/default.py index a79c28f..d1a7267 100644 --- a/default.py +++ b/default.py @@ -1,4 +1,3 @@ -import sys import xbmc import xbmcgui import resources.lib.utils as utils diff --git a/resources/__init__.py b/resources/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/resources/lib/__init__.py b/resources/lib/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/resources/lib/advanced_editor.py b/resources/lib/advanced_editor.py index 6332278..31acc7a 100644 --- a/resources/lib/advanced_editor.py +++ b/resources/lib/advanced_editor.py @@ -2,6 +2,7 @@ import json import xbmc import xbmcgui import xbmcvfs +import os.path from . import utils as utils @@ -180,14 +181,14 @@ class AdvancedBackupEditor: while(exitCondition != -1): # load the custom paths listItem = xbmcgui.ListItem(utils.getString(30126), '') - listItem.setArt({'icon': utils.addon_dir() + 'resources/images/plus-icon.png'}) + listItem.setArt({'icon': os.path.join(utils.addon_dir(), 'resources', 'images', 'plus-icon.png')}) options = [listItem] for index in range(0, len(customPaths.getSets())): aSet = customPaths.getSet(index) listItem = xbmcgui.ListItem(aSet['name'], utils.getString(30121) + ': ' + aSet['set']['root']) - listItem.setArt({'icon': utils.addon_dir() + 'resources/images/folder-icon.png'}) + listItem.setArt({'icon': os.path.join(utils.addon_dir(), 'resources', 'images', 'folder-icon.png')}) options.append(listItem) # show the gui @@ -226,7 +227,7 @@ class AdvancedBackupEditor: shouldContinue = self.dialog.yesno(utils.getString(30139), utils.getString(30140), utils.getString(30141)) if(shouldContinue): - source = xbmc.translatePath(utils.addon_dir() + "/resources/data/default_files.json") - dest = xbmc.translatePath(utils.data_dir() + "/custom_paths.json") + source = xbmc.translatePath(os.path.join(utils.addon_dir(), 'resources', 'data', 'default_files.json')) + dest = xbmc.translatePath(os.path.join(utils.data_dir(), 'custom_paths.json')) xbmcvfs.copy(source, dest) diff --git a/resources/lib/backup.py b/resources/lib/backup.py index e2d5869..14fe804 100644 --- a/resources/lib/backup.py +++ b/resources/lib/backup.py @@ -524,14 +524,12 @@ class XbmcBackup: return result def _createResumeBackupFile(self): - rFile = xbmcvfs.File(xbmc.translatePath(utils.data_dir() + "resume.txt"), 'w') - rFile.write(self.restore_point) - rFile.close() + with xbmcvfs.File(xbmc.translatePath(utils.data_dir() + "resume.txt"), 'w') as f: + f.write(self.restore_point) def _readBackupConfig(self, aFile): - jFile = xbmcvfs.File(xbmc.translatePath(aFile), 'r') - jsonString = jFile.read() - jFile.close() + with xbmcvfs.File(xbmc.translatePath(aFile), 'r') as f: + jsonString = f.read() return json.loads(jsonString) diff --git a/resources/lib/tinyurl.py b/resources/lib/tinyurl.py index 7f82053..efb769d 100644 --- a/resources/lib/tinyurl.py +++ b/resources/lib/tinyurl.py @@ -9,4 +9,4 @@ def shorten(aUrl): data = req.read() # should be a tiny url - return str(data) + return data