Exemple #1
0
 def __init__(self):
     try:
         self.wd = xbmcgui.DialogBusy()
         self.wd.create()
         self.update(0)
     except BaseException:
         execute('ActivateWindow(busydialog)')
Exemple #2
0
 def __init__(self):
     try:
         self.wd = xbmcgui.DialogBusy()
         self.wd.create()
         self.update(0)
     except:
         xbmc.executebuiltin('ActivateWindow(busydialog)')
Exemple #3
0
def busyDialog(percent=0, control=None):
    if percent == 0 and not control:
        control = xbmcgui.DialogBusy()
        control.create()
    elif percent == 100 and control: return control.close()
    elif control: control.update(percent)
    return control
Exemple #4
0
def busyDialog(percent=0, control=None):
    if percent == 0 and control is None:
        control = xbmcgui.DialogBusy()
        control.create()
        control.update(percent)
    if control is not None:
        if control.iscanceled: return control.close()
        elif percent == 100: return control.close()
        else: control.update(percent)
    return control
 def __init__(self):
     try:
         if self.kv < 18:
             self.wd = xbmcgui.DialogBusy()
             self.wd.create()
             self.update(0)
         else:
             xbmc.executebuiltin('ActivateWindow(busydialognocancel)')
     except:
         if self.kv < 18:
             xbmc.executebuiltin('ActivateWindow(busydialog)')
         else:
             xbmc.executebuiltin('ActivateWindow(busydialognocancel)')
Exemple #6
0
    def _install_widevine_x86(self):
        """Install Widevine CDM on x86 based architectures."""
        dialog = xbmcgui.Dialog()
        cdm_version = self._latest_widevine_version()
        if self._legacy(
        ):  # google has a different naming scheme on older widevine versions
            cdm_version = cdm_version.split('.')[-1]
        cdm_os = config.WIDEVINE_OS_MAP[self._os()]
        cdm_arch = config.WIDEVINE_ARCH_MAP_X86[self._arch()]
        self._url = config.WIDEVINE_DOWNLOAD_URL.format(
            cdm_version, cdm_os, cdm_arch)

        downloaded = self._http_request(download=True)
        if downloaded:
            busy_dialog = xbmcgui.DialogBusy()
            busy_dialog.create()
            self._unzip(self._addon_cdm_path())
            if self._widevine_eula():
                self._install_cdm()
                self._cleanup()
            else:
                self._cleanup()
                return False

            if self._has_widevine():
                if os.path.lexists(self._widevine_config_path()):
                    os.remove(self._widevine_config_path())
                os.rename(
                    os.path.join(self._addon_cdm_path(),
                                 config.WIDEVINE_MANIFEST_FILE),
                    self._widevine_config_path())
                wv_check = self._check_widevine()
                if wv_check:
                    dialog.notification(LANGUAGE(30037), LANGUAGE(30003))
                    busy_dialog.close()
                return wv_check
            else:
                busy_dialog.close()
                dialog.ok(LANGUAGE(30004), LANGUAGE(30005))

        return False
Exemple #7
0
    langString = xbmcaddon.Addon().getLocalizedString

    endDirectory = xbmcplugin.endOfDirectory

    content = xbmcplugin.setContent

    execute = xbmc.executebuiltin

    getSetting = xbmcaddon.Addon().getSetting

    setSetting = xbmcaddon.Addon().setSetting

    showDialog = xbmcgui.Dialog()

    busyDialog = xbmcgui.DialogBusy()

    progressDialog = xbmcgui.DialogProgress()

    resolvedUrl = xbmcplugin.setResolvedUrl

    showKeyboard = xbmc.Keyboard

    fileBrowser = showDialog.browse

    sortMethod = xbmcplugin.addSortMethod

    playList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)

    player = xbmc.Player
Exemple #8
0
    def _install_widevine_arm(self):
        """Installs Widevine CDM on ARM-based architectures."""
        root_cmds = ['mount', 'umount', 'losetup', 'modprobe']
        cos_config = self._chromeos_config()
        device = [
            x for x in cos_config if config.CHROMEOS_ARM_HWID in x['hwidmatch']
        ][0]
        required_diskspace = int(device['filesize']) + int(
            device['zipfilesize'])
        dialog = xbmcgui.Dialog()
        if dialog.yesno(
                LANGUAGE(30001),
                LANGUAGE(30006).format(self._sizeof_fmt(
                    required_diskspace))) and self._widevine_eula():
            if self._os() != 'Linux':
                dialog.ok(LANGUAGE(30004), LANGUAGE(30019).format(self._os()))
                return False
            if required_diskspace >= self._diskspace():
                dialog.ok(
                    LANGUAGE(30004),
                    LANGUAGE(30018).format(
                        self._sizeof_fmt(required_diskspace)))
                return False
            if not self._cmd_exists('fdisk') and not self._cmd_exists(
                    'parted'):
                dialog.ok(LANGUAGE(30004),
                          LANGUAGE(30020).format('fdisk', 'parted'))
                return False
            if not self._cmd_exists('mount'):
                dialog.ok(LANGUAGE(30004), LANGUAGE(30021).format('mount'))
                return False
            if not self._cmd_exists('losetup'):
                dialog.ok(LANGUAGE(30004), LANGUAGE(30021).format('losetup'))
                return False
            if os.getuid() != 0:  # ask for permissions to run cmds as root
                if not dialog.yesno(LANGUAGE(30001),
                                    LANGUAGE(30030).format(
                                        ', '.join(root_cmds)),
                                    yeslabel=LANGUAGE(30027),
                                    nolabel=LANGUAGE(30028)):
                    return False

            self._url = device['url']
            downloaded = self._http_request(download=True,
                                            message=LANGUAGE(30022))
            if downloaded:
                dialog.ok(LANGUAGE(30023), LANGUAGE(30024))
                busy_dialog = xbmcgui.DialogBusy()
                busy_dialog.create()
                bin_filename = self._url.split('/')[-1].replace('.zip', '')
                bin_path = os.path.join(self._temp_path(), bin_filename)

                success = [
                    self._unzip(self._temp_path(), bin_filename),
                    self._check_loop(),
                    self._set_loop_dev(),
                    self._losetup(bin_path),
                    self._mnt_loop_dev()
                ]
                if all(success):
                    self._extract_widevine_from_img()
                    self._install_cdm()
                    self._cleanup()
                    if self._has_widevine():
                        with open(self._widevine_config_path(),
                                  'w') as config_file:
                            config_file.write(json.dumps(cos_config, indent=4))
                        dialog.notification(LANGUAGE(30037), LANGUAGE(30003))
                        busy_dialog.close()
                        wv_check = self._check_widevine()
                        if wv_check:
                            dialog.notification(LANGUAGE(30037),
                                                LANGUAGE(30003))
                            busy_dialog.close()
                        return wv_check
                    else:
                        busy_dialog.close()
                        dialog.ok(LANGUAGE(30004), LANGUAGE(30005))
                else:
                    self._cleanup()
                    busy_dialog.close()
                    dialog.ok(LANGUAGE(30004), LANGUAGE(30005))

        return False
Exemple #9
0
#######################################[F**K YOU GRUPETA]############################################################################
 def __init__(self, *args, **kwargs):
     self.busy = 0
     self.enabled = True
     self.dialog = xbmcgui.DialogBusy()
def handle_unresolved_url(data, action):
    url = urllib.unquote(data)
    if not utils.kodi_is_playing():
        if KODI_VERSION <= 16:
            dialog = xbmcgui.DialogProgress()
            dialog.create("YATSE", "%s %s" % (action, url))
        else:
            dialog = xbmcgui.DialogBusy()
            dialog.create()
        dialog.update(-1)
    else:
        dialog = None
    if have_youtube_dl:
        logger.info(u'Trying to resolve with YoutubeDL: %s' % url)
        youtube_dl_resolver = youtube_dl.YoutubeDL({
            'format': 'best',
            'no_color': 'true',
            'ignoreerrors': 'true'
        })
        youtube_dl_resolver.add_default_info_extractors()
        try:
            result = youtube_dl_resolver.extract_info(url, download=False)
        except Exception as e:
            logger.error(u'Error with YoutubeDL: %s' % e)
            result = {}
        if result is not None and 'entries' in result:
            logger.info(u'Playlist resolved by YoutubeDL: %s items' %
                        len(result['entries']))
            item_list = []
            if result is not None:
                for entry in result['entries']:
                    if entry is not None and 'url' in entry:
                        item_list.append(entry)
                        logger.info(u'Media found: %s' % entry['url'])
            if len(item_list) > 0:
                utils.play_items(item_list, action)
                if dialog is not None:
                    dialog.close()
                return
            else:
                logger.info(u'No playable urls in the playlist')
        if result is not None and 'url' in result:
            logger.info(u'Url resolved by YoutubeDL: %s' % result['url'])
            utils.play_url(result['url'], action, result)
            if dialog is not None:
                dialog.close()
            return
        logger.error(u'Url not resolved by YoutubeDL: %s' % url)

    logger.info(u'Trying to resolve with urlResolver: %s' % url)
    stream_url = urlresolver.HostedMediaFile(url=url).resolve()
    if stream_url:
        logger.info(u'Url resolved by urlResolver: %s' % stream_url)
        utils.play_url(stream_url, action)
        if dialog is not None:
            dialog.close()
        return

    logger.info(u'Trying to play as basic url: %s' % url)
    utils.play_url(url, action)
    if dialog is not None:
        dialog.close()
Exemple #12
0
        MyFont.addFont("PseudoTv14", "Lato-Regular.ttf", "33")
    else:
        MyFont.addFont("PseudoTv10", "Lato-Regular.ttf", "14")
        MyFont.addFont("PseudoTv12", "Lato-Regular.ttf", "16")
        MyFont.addFont("PseudoTv13", "Lato-Regular.ttf", "20")
        MyFont.addFont("PseudoTv14", "Lato-Regular.ttf", "22")

from xml.dom.minidom import parse, parseString
from Globals import *
from ChannelList import ChannelList
from AdvancedConfig import AdvancedConfig
from FileAccess import FileAccess
from Migrate import Migrate

NUMBER_CHANNEL_TYPES = 8
BUSY = xbmcgui.DialogBusy()


class ConfigWindow(xbmcgui.WindowXMLDialog):
    def __init__(self, *args, **kwargs):
        self.log("__init__")
        xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs)
        self.madeChanges = 0
        self.showingList = True
        self.channel = 0
        self.channel_type = 9999
        self.setting1 = ''
        self.setting2 = ''
        self.savedRules = False

        if CHANNEL_SHARING:
Exemple #13
0
    def __init__(self, rank=default_view, page=1, parent=None):
        self.active = True
        self.running = True

        self.t = threading.Thread(target=self.heartbeat)
        self.t.start()

        self.skip = False
        if parent is not None:
            self.parent = parent
            self.is_loading = False
            self.ignore = []
            self.start = page
            self.order = rank
            self.skip = True
            parent.active = False
        else:
            self.is_loading = False
            dialog = xbmcgui.DialogBusy()
            dialog.create()
            self.start = 1
            self.order = default_view
            self.ignore = []

        watching = self.getAllWatching()

        if self.order == "favourites":
            if not watching:
                dialog = xbmcgui.Dialog()
                ret = dialog.ok(
                    "Coin Market - View Error",
                    "You currently have no favourites setup.",
                    "To use this view you must have at least one favourited currency. Please change your default view and add some currencies to your favourites."
                )
                exit()
            #https://api.coinmarketcap.com/v2/ticker/1/?convert=btc
            toReturn = {}
            toReturn['data'] = {}
            for ids in watching:
                cmc = json.loads(
                    self.get("https://api.coinmarketcap.com/v2/ticker/" +
                             str(ids) + "?convert=" +
                             default_currency).decode('utf-8'),
                    parse_float=str)
                toReturn['data'][int(ids)] = cmc["data"]
            toReturn['data'] = OrderedDict(
                sorted(toReturn['data'].items(), key=lambda (x, y): y['rank']))

            cmc = toReturn
        else:
            cmc = json.loads(
                self.get("https://api.coinmarketcap.com/v2/ticker/?start=" +
                         str(self.start) + "&limit=10&sort=" +
                         str(self.order) + "&convert=" +
                         default_currency).decode('utf-8'),
                object_pairs_hook=OrderedDict,
                parse_float=str)
        #xbmc.log(str(cmc), xbmc.LOGERROR)
        self.setCoordinateResolution(0)

        self.background = xbmcgui.ControlImage(
            0, 0, 1920, 1080,
            os.path.join(home, 'resources/images', 'fanart.jpg'))
        self.addControl(self.background)
        if not self.skip:
            self.background.setAnimations([(
                'WindowOpen',
                'effect=slide start=0,-1080 end=0,0 time=1500 condition=true tween=bounce',
            )])

        self.footer = xbmcgui.ControlImage(
            0, 1000, 1920, 80,
            os.path.join(home, 'resources/images', 'main_footer.png'))
        self.addControl(self.footer)
        if not self.skip:
            self.footer.setAnimations([(
                'WindowOpen',
                'effect=slide start=0,80 end=0,0 delay=1500 time=1000 condition=true tween=bounce',
            )])

        self.prev = xbmcgui.ControlButton(
            1740,
            1020,
            45,
            43,
            '',
            font='font10',
            noFocusTexture=os.path.join(home, 'resources/images',
                                        'prev_page_normal.png'),
            focusTexture=os.path.join(home, 'resources/images',
                                      'prev_page_hover.png'))
        self.addControl(self.prev)
        if not self.skip:
            self.prev.setAnimations([(
                'WindowOpen',
                'effect=slide start=0,80 end=0,0 delay=1500 time=1000 condition=true tween=bounce',
            )])

        self.next = xbmcgui.ControlButton(
            1840,
            1020,
            45,
            43,
            '',
            font='font10',
            noFocusTexture=os.path.join(home, 'resources/images',
                                        'next_page_normal.png'),
            focusTexture=os.path.join(home, 'resources/images',
                                      'next_page_hover.png'))
        self.addControl(self.next)
        if not self.skip:
            self.next.setAnimations([(
                'WindowOpen',
                'effect=slide start=0,80 end=0,0 delay=1500 time=1000 condition=true tween=bounce',
            )])

        self.fave = xbmcgui.ControlButton(
            1640,
            1020,
            45,
            45,
            '',
            font='font10',
            noFocusTexture=os.path.join(home, 'resources/images',
                                        'fave_page_normal.png'),
            focusTexture=os.path.join(home, 'resources/images',
                                      'fave_page_hover.png'))
        self.addControl(self.fave)
        if not self.skip:
            self.fave.setAnimations([(
                'WindowOpen',
                'effect=slide start=0,80 end=0,0 delay=1500 time=1000 condition=true tween=bounce',
            )])

        self.header = xbmcgui.ControlImage(
            0, 0, 1920, 100,
            os.path.join(home, 'resources/images', 'main_header.png'))
        self.addControl(self.header)
        if not self.skip:
            self.header.setAnimations([(
                'WindowOpen',
                'effect=fade start=0 end=100 time=200 condition=true delay=1500',
            )])
        self.info = {}
        self.like = {}

        for count in range(0, len(cmc['data'])):
            self.info[str(count)] = xbmcgui.ControlButton(
                0,
                100 + ((count) * 90),
                1920,
                90,
                '',
                font='font10',
                focusTexture=os.path.join(home, 'resources/images',
                                          'main_hover.png'),
                noFocusTexture=os.path.join(home, 'resources/images',
                                            'line' + str(count + 1) + '.png'))
            self.addControl(self.info[str(count)])
            if not self.skip:
                self.info[str(count)].setAnimations([
                    (
                        'WindowOpen',
                        'effect=slide start=1920 end=0 time=300 condition=true delay='
                        + str(1500 + (count * 100)),
                    ),
                ])

        for count in range(0, 10):
            try:
                self.info[str(count)].controlDown(self.info[str(count + 1)])
            except:
                pass
            try:
                self.info[str(count)].controlUp(self.info[str(count - 1)])
            except:
                pass

        if rank is not "favourites":
            self.b1 = xbmcgui.ControlButton(
                1680,
                0,
                240,
                100,
                '',
                font='font10',
                noFocusTexture=os.path.join(home, 'resources/images',
                                            'clear_button.png'),
                focusTexture=os.path.join(home, 'resources/images',
                                          'button_hover1.png'))
            self.addControl(self.b1)
            if not self.skip:
                self.b1.setAnimations([
                    (
                        'WindowOpen',
                        'effect=fade start=0 end=100 time=300 condition=true delay=1500',
                    ),
                ])
            self.b2 = xbmcgui.ControlButton(
                1100,
                0,
                274,
                100,
                '',
                font='font10',
                noFocusTexture=os.path.join(home, 'resources/images',
                                            'clear_button.png'),
                focusTexture=os.path.join(home, 'resources/images',
                                          'button_hover2.png'))
            self.addControl(self.b2)
            if not self.skip:
                self.b2.setAnimations([
                    (
                        'WindowOpen',
                        'effect=fade start=0 end=100 time=300 condition=true delay=1500',
                    ),
                ])

            self.b3 = xbmcgui.ControlButton(
                0,
                0,
                100,
                100,
                '',
                font='font10',
                noFocusTexture=os.path.join(home, 'resources/images',
                                            'clear_button.png'),
                focusTexture=os.path.join(home, 'resources/images',
                                          'button_hover3.png'))
            self.addControl(self.b3)
            if not self.skip:
                self.b3.setAnimations([
                    (
                        'WindowOpen',
                        'effect=fade start=0 end=100 time=300 condition=true delay=1500',
                    ),
                ])

            self.info[str(0)].controlUp(self.b3)

            self.b3.controlDown(self.info[str(0)])
            self.b3.controlRight(self.b2)
            self.b3.controlLeft(self.b1)

            self.b2.controlDown(self.info[str(0)])
            self.b2.controlRight(self.b1)
            self.b2.controlLeft(self.b3)

            self.b1.controlDown(self.info[str(0)])
            self.b1.controlRight(self.b3)
            self.b1.controlLeft(self.b2)

        self.info[str(len(cmc['data']) - 1)].controlDown(self.fave)
        self.prev.controlRight(self.next)
        self.prev.controlLeft(self.fave)
        self.next.controlRight(self.fave)
        self.next.controlLeft(self.prev)
        self.prev.controlUp(self.info[str(len(cmc['data']) - 1)])
        self.next.controlUp(self.info[str(len(cmc['data']) - 1)])

        self.fave.controlRight(self.prev)
        self.fave.controlLeft(self.next)
        self.fave.controlUp(self.info[str(len(cmc['data']) - 1)])

        if rank is not "favourites":
            self.ignore.append(self.b1.getId())
            self.ignore.append(self.b2.getId())
            self.ignore.append(self.b3.getId())
            self.ignore.append(self.prev.getId())
            self.ignore.append(self.next.getId())
            self.ignore.append(self.fave.getId())

        self.label = {}
        self.logo = {}
        self.realID = []
        #for i in range (1, 11):
        count = 0
        sleep(1.5)
        for word in cmc['data']:
            try:
                self.realID.append(cmc['data'][word]['id'])

                self.like[str(count)] = xbmcgui.ControlImage(
                    1840, 110 + (count * 90), 70, 70,
                    os.path.join(home, 'resources/images', 'fave2.png'))
                self.addControl(self.like[str(count)])
                if not self.skip:
                    self.like[str(count)].setAnimations([
                        ('WindowOpen',
                         'effect=slide start=1920 end=0 time=300 condition=true delay='
                         + str(1500 + (count * 100))),
                    ])

                if cmc['data'][word]['id'] not in watching:
                    self.like[str(count)].setVisible(False)

                self.logo[str(count)] = xbmcgui.ControlImage(
                    125, 113 + ((count) * 90), 64, 64,
                    "https://s2.coinmarketcap.com/static/img/coins/64x64/" +
                    str(cmc['data'][word]['id']) + ".png")

                self.label[str(count) + "1"] = xbmcgui.ControlLabel(
                    50,
                    129 + (count * 90),
                    800,
                    20,
                    str(cmc['data'][word]['rank']),
                    font="font10",
                    textColor="0xFF141414")

                self.label[str(count) + "2"] = xbmcgui.ControlLabel(
                    220,
                    129 + (count * 90),
                    800,
                    20,
                    str(cmc['data'][word]['name']),
                    font="font10",
                    textColor="0xFF141414")

                try:
                    val = cmc['data'][word]['quotes'][default_currency][
                        'market_cap'].split(".")
                    val = str('{:,}'.format(int(val[0])))

                    self.label[str(count) + "3"] = xbmcgui.ControlLabel(
                        573,
                        129 + (count * 90),
                        274,
                        20,
                        self.printCurrency(val),
                        font="font10",
                        textColor="0xFF141414")
                except:
                    pass

                try:
                    val = cmc['data'][word]['quotes'][default_currency][
                        'price']
                    self.label[str(count) + "4"] = xbmcgui.ControlLabel(
                        847,
                        129 + (count * 90),
                        274,
                        20,
                        self.printCurrency(val),
                        font="font10",
                        textColor="0xFF141414")
                except:
                    pass

                try:
                    val = cmc['data'][word]['quotes'][default_currency][
                        'volume_24h'].split(".")
                    val = str('{:,}'.format(int(val[0])))

                    self.label[str(count) + "5"] = xbmcgui.ControlLabel(
                        1121,
                        129 + (count * 90),
                        274,
                        20,
                        self.printCurrency(val),
                        font="font10",
                        textColor="0xFF141414")
                except:
                    pass

                try:
                    val = cmc['data'][word]['circulating_supply'].split(".")
                    val = str('{:,}'.format(int(val[0])))

                    self.label[str(count) + "6"] = xbmcgui.ControlLabel(
                        1395,
                        129 + (count * 90),
                        274,
                        20,
                        val + " " + cmc['data'][word]['symbol'],
                        font="font10",
                        textColor="0xFF141414")
                except:
                    pass

                try:
                    val = "{:.2f}".format(
                        float(cmc['data'][word]['quotes'][default_currency]
                              ['percent_change_24h']))

                    if float(val) > 0:
                        self.label[str(count) + "7"] = xbmcgui.ControlLabel(
                            1703,
                            129 + (count * 90),
                            274,
                            20,
                            val + "%",
                            font="font10",
                            textColor="0xff104000")
                    else:
                        self.label[str(count) + "7"] = xbmcgui.ControlLabel(
                            1703,
                            129 + (count * 90),
                            274,
                            20,
                            val + "%",
                            font="font10",
                            textColor="0xFFD90000")
                except:
                    pass
                count = count + 1
            except:
                break

        for count in range(0, 10):
            try:
                self.addControl(self.logo[str(count)])
                if not self.skip:
                    self.logo[str(count)].setAnimations([
                        ('WindowOpen',
                         'effect=slide start=1920 end=0 time=300 condition=true delay='
                         + str(1500 + (count * 100))),
                        ('VisibleChange',
                         'effect=slide start=0 end=100 time=300 condition=true'
                         )
                    ])
                for i in range(1, 8):
                    try:
                        self.addControl(self.label[str(count) + str(i)])
                        if not self.skip:
                            self.label[str(count) + str(i)].setAnimations([
                                ('WindowOpen',
                                 'effect=slide start=1920 end=0 time=300 condition=true delay='
                                 + str(1500 + (count * 100))),
                                ('VisibleChange',
                                 'effect=slide start=0 end=100 time=300 condition=true'
                                 ),
                            ])
                    except:
                        pass
            except:
                pass
        self.loading = xbmcgui.ControlImage(
            14, 1008, 64, 64,
            os.path.join(home, 'resources/images', 'loading.gif'))

        self.addControl(self.loading)
        self.loading.setVisible(False)
        self.setFocus(self.info['0'])
        try:
            dialog.close()
        except:
            self.loading.setVisible(False)
            self.setFocus(self.next)
            self.parent.loading.setVisible(False)