Пример #1
0
def play(url, name, icon, description, pdialogue=None):
    from resources.root import resolvers
    import xbmcgui

    url = url.strip()

    url = resolvers.resolve(url)

    liz = xbmcgui.ListItem(name, iconImage=iconimage, thumbnailImage=iconimage)
    liz.setInfo(type='Video', infoLabels={'Title': name})
    liz.setProperty("IsPlayable", "true")
    liz.setPath(url)

    from resources.modules import control

    if url.endswith('.ts') or url.endswith('.f4m'):
        playf4m(url, 'TEST')
    else:
        item = control.item(path=url, iconImage=icon, thumbnailImage=icon)
        try:
            item.setArt({'icon': icon})
        except:
            pass
        item.setInfo(type='Video', infoLabels='')
        control.player.play(url, item)
        control.resolve(int(sys.argv[1]), True, item)

        for i in range(0, 240):
            if xbmc.Player().isPlayingVideo(): break
            control.sleep(1000)
        while xbmc.Player().isPlayingVideo():
            control.sleep(2000)
Пример #2
0
def play(url,name,icon,description,pdialogue=None):
		from resources.root import resolvers
		import xbmcgui
		
		url = url.strip()

		url = resolvers.resolve(url,description)

		liz = xbmcgui.ListItem(name, iconImage=iconimage, thumbnailImage=iconimage)
		liz.setInfo(type='Video', infoLabels={'Title':name})
		liz.setProperty("IsPlayable","true")
		liz.setPath(url)

		from resources.modules import control

		if url.endswith('.ts') or url.endswith('.f4m'):
			playf4m(url,'TEST')
		else:
			item = control.item(path=url, iconImage=icon, thumbnailImage=icon)
			try: item.setArt({'icon': icon})
			except: pass
			item.setInfo(type='Video', infoLabels = '')
			control.player.play(url, item)
			control.resolve(int(sys.argv[1]), True, item)

			for i in range(0, 240):
				if xbmc.Player().isPlayingVideo(): break
				control.sleep(1000)
			while xbmc.Player().isPlayingVideo():
					control.sleep(2000)
			control.sleep(5000)
Пример #3
0
def playf4m(url, name):
    from resources.modules import control

    f4m(url, name)
    for i in range(0, 240):
        if xbmc.Player().isPlayingVideo(): break
        control.sleep(1000)
    while xbmc.Player().isPlayingVideo():
        control.sleep(2000)
    control.sleep(5000)
Пример #4
0
def playf4m(url,name):
		from resources.modules import control
		
		f4m(url,name)
		for i in range(0, 240):
				if xbmc.Player().isPlayingVideo(): break
				control.sleep(1000)
		while xbmc.Player().isPlayingVideo():
				control.sleep(2000)
		control.sleep(5000)
Пример #5
0
    def run(self, query=None):

        if not 'Greek' in str(langs).split(','):
            control.directory(syshandle)
            control.infoDialog(control.lang(32002).encode('utf-8'))
            return

        if query is None:
            if control.condVisibility('Player.HasVideo'):
                title = control.infoLabel('VideoPlayer.Title')

                if re.search(r'[^\x00-\x7F]+', title) is not None:
                    title = control.infoLabel('VideoPlayer.OriginalTitle')
                year = control.infoLabel('VideoPlayer.Year')

                tvshowtitle = control.infoLabel('VideoPlayer.TVshowtitle')

                season = control.infoLabel('VideoPlayer.Season')

                episode = control.infoLabel('VideoPlayer.Episode')
                try:
                    imdb = control.infoLabel('VideoPlayer.IMDBNumber')
                    if not imdb:
                        imdb = '0'
                except BaseException:
                    imdb = '0'
            else:
                title = xbmc.getInfoLabel("ListItem.OriginalTitle")
                year = xbmc.getInfoLabel("ListItem.Year")
                tvshowtitle = xbmc.getInfoLabel("ListItem.TVShowTitle")
                season = xbmc.getInfoLabel("ListItem.Season")
                episode = xbmc.getInfoLabel("ListItem.Episode")
                #labelType = xbmc.getInfoLabel("ListItem.DBTYPE")
                try:
                    imdb = control.infoLabel('ListItem.IMDBNumber')
                    if not imdb:
                        imdb = '0'
                except BaseException:
                    imdb = '0'

            if 's' in episode.lower():
                season, episode = '0', episode[-1:]

            if not tvshowtitle == '':  # episode
                query = '%s S%02dE%02d/imdb=%s' % (tvshowtitle, int(season),
                                                   int(episode), str(imdb))

            elif not year == '':  # movie
                query = '%s (%s)/imdb=%s' % (title, year, str(imdb))

            elif '(S' in title:
                query = '%s/imdb=%s' % (title, str(imdb))

            else:  # file
                query, year = getCleanMovieTitle(title)
                if not year == '':
                    query = '%s (%s)/imdb=%s' % (query, year, str(imdb))
            #xbmc.log('$#$QUERY-NONE-FINAL: %s' % query, xbmc.LOGNOTICE)

        else:
            query = '%s/imdb=0' % re.sub('[\(|\)]', '', query)
            #xbmc.log('$#$QUERY: %s' % query, xbmc.LOGNOTICE)

        self.query = query
        #xbmc.log('$#$QUERY: %s' % query, xbmc.LOGNOTICE)

        threads = []

        threads.append(workers.Thread(self.subztv))
        threads.append(workers.Thread(self.s4f))
        threads.append(workers.Thread(self.yifi))

        [i.start() for i in threads]

        for i in range(0, 10 * 2):
            try:
                is_alive = [x.is_alive() for x in threads]
                if all(x is False for x in is_alive):
                    break
                if control.aborted is True:
                    break
                control.sleep(500)
            except BaseException:
                pass

        if len(self.list) == 0:
            control.directory(syshandle)
            return

        f = []

        f += [i for i in self.list if i['source'] == 'subztv']
        f += [i for i in self.list if i['source'] == 's4f']
        f += [i for i in self.list if i['source'] == 'yifi']

        self.list = sorted(f, key=lambda k: k['rating'], reverse=True)

        for i in self.list:

            try:

                if i['source'] == 'subztv':
                    i['name'] = '[subztv] %s' % i['name']

                elif i['source'] == 's4f':
                    i['name'] = '[S4F] %s' % i['name']

                elif i['source'] == 'yifi':
                    i['name'] = '[yifi] %s' % i['name']
            except BaseException:
                pass

        for i in self.list:

            try:
                name, url, source, rating = i['name'], i['url'], i[
                    'source'], i['rating']

                u = {'action': 'download', 'url': url, 'source': source}
                u = '%s?%s' % (sysaddon, urllib.urlencode(u))

                item = control.item(label='Greek',
                                    label2=name,
                                    iconImage=str(rating),
                                    thumbnailImage='el')
                item.setProperty('sync', 'false')
                item.setProperty('hearing_imp', 'false')

                control.addItem(handle=syshandle,
                                url=u,
                                listitem=item,
                                isFolder=False)
            except BaseException:
                pass

        control.directory(syshandle)
Пример #6
0
    def run(self, query=None):

        if not 'Greek' in str(langs).split(','):
            control.directory(syshandle)
            control.infoDialog(control.lang(32002).encode('utf-8'))
            return

        if control.kodi_version() >= 18.0 and not\
                control.conditional_visibility('System.HasAddon(vfs.libarchive)')\
                and not (control.condVisibility('System.Platform.Linux')):
            control.execute('InstallAddon(vfs.libarchive)')

        if not control.conditional_visibility(
                'System.HasAddon(script.module.futures)') and six.PY2:
            if 17.0 <= control.kodi_version() <= 18.9:
                control.execute('InstallAddon(script.module.futures)')
                control.sleep(1500)

        if query:
            query = '{}/imdb=0'.format(re.sub(r'[\(|\)]', '', query))
            # xbmc.log('$#$QUERY-ELSE: %s' % query, xbmc.LOGINFO)
        else:
            if control.condVisibility('Player.HasVideo'):
                title = control.infoLabel('VideoPlayer.Title')

                if re.search(r'[^\x00-\x7F]+', title) is not None:
                    title = control.infoLabel('VideoPlayer.OriginalTitle')
                year = control.infoLabel('VideoPlayer.Year')

                tvshowtitle = control.infoLabel('VideoPlayer.TVshowtitle')

                season = control.infoLabel('VideoPlayer.Season')

                episode = control.infoLabel('VideoPlayer.Episode')
                try:
                    imdb = control.infoLabel('VideoPlayer.IMDBNumber')
                    if not imdb:
                        imdb = '0'
                except BaseException:
                    imdb = '0'
            else:
                title = xbmc.getInfoLabel("ListItem.OriginalTitle")
                year = xbmc.getInfoLabel("ListItem.Year")
                tvshowtitle = xbmc.getInfoLabel("ListItem.TVShowTitle")
                season = xbmc.getInfoLabel("ListItem.Season")
                episode = xbmc.getInfoLabel("ListItem.Episode")
                #labelType = xbmc.getInfoLabel("ListItem.DBTYPE")
                try:
                    imdb = control.infoLabel('ListItem.IMDBNumber')
                    # xbmc.log('$#$QUERY-NONE-IMDB: %s' % imdb, xbmc.LOGNOTICE)
                    if not imdb:
                        imdb = '0'
                except BaseException:
                    imdb = '0'

            if 's' in episode.lower():
                season, episode = '0', episode[-1:]

            if not tvshowtitle == '':  # episode
                query = '%s S%02dE%02d/imdb=%s' % (tvshowtitle, int(season),
                                                   int(episode), str(imdb))

            elif not year == '':  # movie
                query = '%s (%s)/imdb=%s' % (title, year, str(imdb))

            elif '(S' in title:
                query = '%s/imdb=%s' % (title, str(imdb))

            else:  # file
                query, year = getCleanMovieTitle(title)
                if not year == '':
                    query = '{} ({})/imdb={}'.format(query, year, str(imdb))

        self.query = six.ensure_str(query, encoding='utf-8')

        with concurrent.futures.ThreadPoolExecutor(5) as executor:
            query = self.query
            threads = [
                executor.submit(self.subztv, query),
                executor.submit(self.s4f, query),
                executor.submit(self.yifi, query)
            ]

            for future in concurrent.futures.as_completed(threads):

                item = future.result()

                if not item:
                    continue

                self.list.extend(item)
        # threads = []
        # if control.setting('provider.subztv.club'):
        #     threads.append(workers.Thread(self.subztv))
        # xbmc.log('$#$THREAD1: %s' % threads)
        # if control.setting('provider.s4f'):
        #     threads.append(workers.Thread(self.s4f))
        # xbmc.log('$#$THREAD2: %s' % threads)
        # if control.setting('provider.yifi'):
        #     threads.append(workers.Thread(self.yifi))
        # xbmc.log('$#$THREAD3: %s' % threads)
        #
        # [i.start() for i in threads]
        # [i.join() for i in threads]
        self.list = [i for i in self.list if i]

        f = []

        f += [i for i in self.list if i['source'] == 'subztv']

        f += [i for i in self.list if i['source'] == 's4f']

        f += [i for i in self.list if i['source'] == 'yifi']

        self.list = sorted(f, key=lambda k: k['rating'], reverse=True)
        for i in self.list:
            try:

                if i['source'] == 'subztv':
                    i['name'] = u'[SUBZ] {0}'.format(i['name'])

                elif i['source'] == 's4f':
                    i['name'] = u'[S4F] {0}'.format(i['name'])

                elif i['source'] == 'yifi':
                    i['name'] = u'[YIFI] {0}'.format(i['name'])
            except BaseException:
                pass

        for i in self.list:
            try:
                u = {
                    'action': 'download',
                    'url': i['url'],
                    'source': i['source']
                }
                u = '{0}?{1}'.format(sysaddon, urlencode(u))
                item = control.item(label='Greek', label2=i['name'])
                item.setArt({'icon': str(i['rating'])[:1], 'thumb': 'el'})
                item.setProperty('hearing_imp', 'false')
                control.addItem(handle=syshandle,
                                url=u,
                                listitem=item,
                                isFolder=False)
            except BaseException:
                pass

        control.directory(syshandle)