def __init__(self, id=ADDON_ID):  # pylint: disable=redefined-builtin
     ''' A stub constructor for the xbmcaddon Addon class '''
     self.id = id
     if id == ADDON_ID:
         self.settings = ADDON_SETTINGS
     else:
         self.settings = addon_settings(id)
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Dag Wieers (@dagwieers) <*****@*****.**>
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
''' This file implements the Kodi xbmcaddon module, either using stubs or alternative functionality '''

from __future__ import absolute_import, division, print_function, unicode_literals
import json
from xbmcextra import addon_settings, global_settings, import_language, read_addon_xml

GLOBAL_SETTINGS = global_settings()
ADDON_SETTINGS = addon_settings()
ADDON_INFO = read_addon_xml('addon.xml')
ADDON_ID = list(ADDON_INFO)[0]
PO = import_language(language=GLOBAL_SETTINGS.get('locale.language'))


class Addon:
    ''' A reimplementation of the xbmcaddon Addon class '''
    def __init__(self, id=ADDON_ID):  # pylint: disable=redefined-builtin
        ''' A stub constructor for the xbmcaddon Addon class '''
        self.id = id

    def getAddonInfo(self, key):
        ''' A working implementation for the xbmcaddon Addon class getAddonInfo() method '''
        STUB_INFO = dict(id=self.id,
                         name=self.id,
                         version='2.3.4',
                         type='kodi.inputstream',
                         profile='special://userdata')
        return ADDON_INFO.get(self.id, STUB_INFO).get(key)
 def __init__(self, id=ADDON_ID):  # pylint: disable=redefined-builtin
     """A stub constructor for the xbmcaddon Addon class"""
     self.id = id
     self.settings = addon_settings(id)