コード例 #1
0
 def __init__(self):
     super(GithubAPI, self).__init__()
     self.access_token = settings.get_setting_string("github.token")
     self.client_id = settings.get_setting_string("github.client_id")
     self.headers.update(
         {
             "Authorization": "Bearer {}".format(self.access_token),
             "Accept": "application/vnd.github.v3+json",
         }
     )
     self.base_url = "https://api.github.com/"
     self.auth_url = "https://github.com/login/"
コード例 #2
0
def color_picker():
    select_list = []
    dialog = xbmcgui.Dialog()
    current_color = settings.get_setting_string("general.color")
    for i in _color_chart:
        select_list.append(color_string(i, i))
    color = dialog.select(
        "{}: {}".format(_addon_name, settings.get_localized_string(30036)),
        select_list,
        preselect=_color_chart.index(current_color),
    )
    if color > -1:
        settings.set_setting_string(
            "general.display_color",
            color_string(_color_chart[color], _color_chart[color]),
        )
        settings.set_setting_string("general.color", _color_chart[color])
コード例 #3
0
 def _update_token(self):
     token = settings.get_setting_string("github.token")
     self.access_token = token
     self.headers.update({"Authorization": "Bearer {}".format(self.access_token)})
コード例 #4
0
from resources.lib import update_addon

API = GithubAPI()

_addons = os.path.join(tools.translate_path("special://home"), "addons")
_addon_path = tools.translate_path(settings.get_addon_info("path"))
_addon_data = tools.translate_path(settings.get_addon_info("profile"))

_builtin_json_path = os.path.join(_addon_path, "resources", "json")
_json_path = os.path.join(_addon_data, "json")
_media_path = os.path.join(_addon_path, "resources", "media")

_addon_id = settings.get_addon_info("id")
_addon_name = settings.get_addon_info("name")

_user = settings.get_setting_string("github.username")
_compact = settings.get_setting_boolean("general.compact")
_collaborator = settings.get_setting_boolean("github.collaborator_repos")
_organization = settings.get_setting_boolean("github.organization_repos")
_show_bundled_repos = settings.get_setting_boolean(
    "general.show_bundled_repos")
_sort_repos = settings.get_setting_int("general.sort_repos")

_extensions = {
    "xbmc.gui.skin":
    "skin",  # https://github.com/xbmc/xbmc/blob/master/addons/xbmc.gui/skin.xsd
    "xbmc.webinterface":
    "web interface",  # https://github.com/xbmc/xbmc/blob/master/addons/xbmc.webinterface/webinterface.xsd
    "xbmc.addon.repository":
    "repository",  # https://github.com/xbmc/xbmc/blob/master/addons/xbmc.addon/repository.xsd
    "xbmc.service":
コード例 #5
0
import os
import time

from resources.lib import color
from resources.lib.github_api import GithubAPI
from resources.lib import qr
from resources.lib import settings
from resources.lib import tools

API = GithubAPI()

_addon_id = settings.get_addon_info("id")
_addon_name = settings.get_addon_info("name")
_addon_data = tools.translate_path(settings.get_addon_info("profile"))

_access_token = settings.get_setting_string("github.token")
_auth_url = "https://github.com/settings/connections/applications/"

_color = settings.get_setting_string("general.color")


def force_auth():
    dialog = xbmcgui.Dialog()
    if not _access_token:
        if dialog.yesno(_addon_name, settings.get_localized_string(30005)):
            authorize(True)
    del dialog


def check_auth():
    if not _access_token:
コード例 #6
0
import os
import requests

from resources.lib import logging
from resources.lib import qr
from resources.lib import settings
from resources.lib import tools
from resources.lib.github_api import GithubAPI

API = GithubAPI()

_addon_name = settings.get_addon_info("name")
_addon_data = tools.translate_path(settings.get_addon_info("profile"))

_color = settings.get_setting_string("general.color")


def raise_issue(repo):
    dialog = xbmcgui.Dialog()
    title = dialog.input(settings.get_localized_string(30006))
    if title:
        description = dialog.input(settings.get_localized_string(30007))
        log_key = None
        response, log_key = logging.upload_log()

        if response:
            try:
                resp = API.raise_issue(
                    repo["user"],
                    repo["repo"],