# -*- coding: utf-8 -*-
"""
	My Accounts
"""

from datetime import datetime
import inspect
import xbmc
from myaccounts.modules import control
from myaccounts.modules import py_tools

LOGDEBUG = xbmc.LOGDEBUG  #0
LOGINFO = xbmc.LOGINFO  #1
LOGNOTICE = xbmc.LOGNOTICE if control.getKodiVersion(
) < 19 else xbmc.LOGINFO  #(2 in 18, deprecated in 19 use LOGINFO(1))
LOGWARNING = xbmc.LOGWARNING  #(3 in 18, 2 in 19)
LOGERROR = xbmc.LOGERROR  #(4 in 18, 3 in 19)
LOGSEVERE = xbmc.LOGSEVERE if control.getKodiVersion(
) < 19 else xbmc.LOGFATAL  #(5 in 18, deprecated in 19 use LOGFATAL(4))
LOGFATAL = xbmc.LOGFATAL  #(6 in 18, 4 in 19)
LOGNONE = xbmc.LOGNONE  #(7 in 18, 5 in 19)
if py_tools.isPY2:
    debug_list = [
        'DEBUG', 'INFO', 'NOTICE', 'WARNING', 'ERROR', 'SEVERE', 'FATAL'
    ]
else:
    debug_list = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'FATAL']
DEBUGPREFIX = '[COLOR red][ My Accounts %s ][/COLOR]'
LOGPATH = control.transPath('special://logpath/')

Example #2
0
# -*- coding: utf-8 -*-
'''
	My Accounts
'''

from myaccounts.modules import control
from myaccounts.modules import log_utils
import _strptime
import xbmc
LOGNOTICE = xbmc.LOGNOTICE if control.getKodiVersion(
) < 19 else xbmc.LOGINFO  # (2 in 18, deprecated in 19 use LOGINFO(1))


class AddonCheckUpdate:
    def run(self):
        xbmc.log(
            '[ script.module.myaccounts ]  Addon checking available updates',
            LOGNOTICE)
        try:
            import re
            import requests
            repo_xml = requests.get(
                'https://raw.githubusercontent.com/a4k-openproject/repository.myaccounts/master/zips/addons.xml'
            )
            if repo_xml.status_code != 200:
                return xbmc.log(
                    '[ script.module.myaccounts ]  Could not connect to remote repo XML: status code = %s'
                    % repo_xml.status_code, LOGNOTICE)
            repo_version = re.findall(
                r'<addon id=\"script.module.myaccounts\".*version=\"(\d*.\d*.\d*.\d*)\"',
                repo_xml.text)[0]