示例#1
0
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals

import os
import pyqrcode

from PIL import Image, ImageDraw, ImageFont, ImageColor

from resources.lib import settings
from resources.lib import tools

_addon_path = tools.translate_path(settings.get_addon_info("path"))
_font = os.path.join(_addon_path, "resources", "fonts", "DankMono-Regular.ttf")

_fg_color = ImageColor.getrgb("#efefefff")
_bg_color = ImageColor.getrgb("#222222ff")


def _center_coords(image_width, image_height, coord_width, coord_height):
    return (
        (image_width // 2) - (coord_width // 2),
        (image_height // 2) - (coord_height // 2),
    )


def generate_qr(content, path, filename):
    if not os.path.exists(path):
        os.makedirs(path)

    qr_file = os.path.join(path, filename)
    qr = pyqrcode.create(content)
示例#2
0
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals

import xbmc
import xbmcgui

import getpass
import os
import requests

from resources.lib import qr
from resources.lib import settings
from resources.lib import tools

_addon_id = settings.get_addon_info("id")
_addon_version = settings.get_addon_info("version")
_addon_data = tools.translate_path(settings.get_addon_info("profile"))

_log_location = tools.translate_path("special://logpath")

_paste_url = "https://paste.kodi.tv/"
_github_token = settings.get_setting_string("github.token")

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


def _get_log_files():
    files = []
    if not os.path.exists(_log_location):
        return
示例#3
0
import os
import requests
import time

from resources.lib import color
from resources.lib.github_api import GithubAPI
from resources.lib import raise_issue
from resources.lib import settings
from resources.lib.thread_pool import ThreadPool
from resources.lib import tools
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")
示例#4
0
import xbmcgui

from resources.lib import settings

_addon_name = settings.get_addon_info("name")
_color = settings.get_setting_string("general.color")

_color_chart = [
    "black",
    "white",
    "whitesmoke",
    "gainsboro",
    "lightgray",
    "silver",
    "darkgray",
    "gray",
    "dimgray",
    "snow",
    "floralwhite",
    "ivory",
    "beige",
    "cornsilk",
    "antiquewhite",
    "bisque",
    "blanchedalmond",
    "burlywood",
    "darkgoldenrod",
    "ghostwhite",
    "azure",
    "aliveblue",
    "lightsaltegray",