Compare commits

...

4 Commits

Author SHA1 Message Date
Rob Weber cdd8faf990 use with syntax for file IO 2026-04-01 08:16:23 -05:00
robweber 71285a7c7e 1.7.3 version 2026-03-30 09:22:09 -05:00
Rob Weber 4efe5a75f4 version bump 2026-03-06 10:44:02 -06:00
Rob Weber 475a0372be part of #251 - modify previous strptime patch 2026-03-06 10:41:22 -06:00
3 changed files with 21 additions and 19 deletions
+3 -4
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.xbmcbackup"
name="Backup" version="1.7.2" provider-name="robweber">
name="Backup" version="1.7.3" provider-name="robweber">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
<import addon="script.module.dateutil" version="2.8.0" />
@@ -24,9 +24,8 @@
<screenshot>resources/images/screenshot3.jpg</screenshot>
<screenshot>resources/images/screenshot4.jpg</screenshot>
</assets>
<news>Version 1.7.2
Fix bug with gui settings restore
strptime Python bugfix
<news>Version 1.7.3
additional strptime modifications to fix scheduler behavior
</news>
<summary lang="ar_SA">إنسخ إحتياطياً قاعده بيانات إكس بى إم سى وملفات اﻹعدادات فى حاله وقوع إنهيار مع إمكانيه اﻹسترجاع</summary>
<summary lang="bg_BG">Добавката може да създава резервни копия и възстановява базата данни и настройките на Kodi, в случай на срив или повреда на файловете.</summary>
+10
View File
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
## [Version 1.7.3](https://github.com/robweber/xbmcbackup/compare/matrix-1.7.1...robweber:matrix-1.7.3)
### Fixed
- fixed issue with Scheduler running in a loop (#251). Issue stemmed from previous strptime fix affecting correct calculation of cron values
### Changed
- changed previous strptime bug fix by applying specific patch to authorizers file where this bug was initially seen
## [Version 1.7.2](https://github.com/robweber/xbmcbackup/compare/matrix-1.7.1...robweber:matrix-1.7.2)
### Fixed
+8 -15
View File
@@ -15,13 +15,9 @@ except ImportError:
pass
# fix for datetime.strptime bug https://kodi.wiki/view/Python_Problems#datetime.strptime
class proxydt(datetime.datetime):
def patch_strptime(date_string, format):
return datetime.datetime(*(time.strptime(date_string, format)[:6]))
@classmethod
def strptime(cls, date_string, format):
return datetime.datetime(*(time.strptime(date_string, format)[:6]))
datetime.datetime = proxydt
class QRCode(xbmcgui.WindowXMLDialog):
def __init__(self, *args, **kwargs):
@@ -139,24 +135,21 @@ class DropboxAuthorizer:
def _setToken(self, token):
# write the token files
token_file = open(xbmcvfs.translatePath(utils.data_dir() + self.TOKEN_FILE), 'w')
token_file.write(json.dumps({"access_token": token.access_token, "refresh_token": token.refresh_token, "expiration": str(token.expires_at)}))
token_file.close()
with open(xbmcvfs.translatePath(utils.data_dir() + self.TOKEN_FILE), 'w') as token_file:
token_file.write(json.dumps({"access_token": token.access_token, "refresh_token": token.refresh_token, "expiration": str(token.expires_at)}))
def _getToken(self):
result = {}
# get token, if it exists
if(xbmcvfs.exists(xbmcvfs.translatePath(utils.data_dir() + self.TOKEN_FILE))):
token_file = open(xbmcvfs.translatePath(utils.data_dir() + self.TOKEN_FILE))
token = token_file.read()
token = ""
with open(xbmcvfs.translatePath(utils.data_dir() + self.TOKEN_FILE), 'r') as token_file:
token = token_file.read()
if(token.strip() != ""):
result = json.loads(token)
# convert expiration back to a datetime object
result['expiration'] = datetime.datetime.strptime(result['expiration'], "%Y-%m-%d %H:%M:%S.%f")
token_file.close()
result['expiration'] = patch_strptime(result['expiration'], "%Y-%m-%d %H:%M:%S.%f")
return result