Example #1
0
 def __init__(self):
     Handle.__init__(self,
                     id=self.Id,
                     name=self.Name,
                     abbreviation=self.Abbreviation)
     self.mService = debrid.Premiumize()
     self.mServices = None
Example #2
0
    def __init__(self):
        self.orion = orionoid.Orionoid()

        self.pack = False  # Checked by provider.py
        self.priority = 0
        self.language = ['un']

        self.base_link = self.orion.link()
        self.domains = [network.Networker.linkDomain(self.base_link)]

        enabledPremiumize = debrid.Premiumize().accountValid() and (
            tools.Settings.getBoolean('streaming.torrent.premiumize.enabled')
            or
            tools.Settings.getBoolean('streaming.usenet.premiumize.enabled'))
        enabledOffCloud = debrid.OffCloud().accountValid() and (
            tools.Settings.getBoolean('streaming.torrent.offcloud.enabled')
            or tools.Settings.getBoolean('streaming.usenet.offcloud.enabled'))
        enabledRealDebrid = debrid.RealDebrid().accountValid(
        ) and tools.Settings.getBoolean('streaming.torrent.realdebrid.enabled')
        self.cache = tools.Settings.getBoolean('scraping.cache.enabled') and (
            (enabledPremiumize
             and tools.Settings.getBoolean('scraping.cache.premiumize')) or
            (enabledOffCloud
             and tools.Settings.getBoolean('scraping.cache.offcloud')) or
            (enabledRealDebrid
             and tools.Settings.getBoolean('scraping.cache.realdebrid')))
Example #3
0
def credentials():
    premiumize = debridx.Premiumize()
    offcloud = debridx.OffCloud()
    realdebrid = debridx.RealDebrid()
    alldebrid = debridx.AllDebrid()
    rapidpremium = debridx.RapidPremium()
    return {
        'premiumize': {
            'enabled': premiumize.accountEnabled(),
            'user': premiumize.accountUsername(),
            'pass': premiumize.accountPassword(),
        },
        'offcloud': {
            'enabled': offcloud.accountEnabled(),
            'api': offcloud.accountApi(),
        },
        'realdebrid': {
            'enabled': realdebrid.accountEnabled(),
            'id': realdebrid.accountId(),
            'secret': realdebrid.accountSecret(),
            'token': realdebrid.accountToken(),
            'refresh': realdebrid.accountRefresh(),
        },
        'alldebrid': {
            'enabled': alldebrid.accountEnabled(),
            'user': alldebrid.accountUsername(),
            'pass': alldebrid.accountPassword(),
        },
        'rapidpremium': {
            'enabled': rapidpremium.accountEnabled(),
            'user': rapidpremium.accountUsername(),
            'api': rapidpremium.accountApi(),
        }
    }
Example #4
0
def servicesPremiumize():
    try:
        premiumize = debridx.Premiumize()
        if premiumize.accountEnabled() and premiumize.accountValid():
            return premiumize.servicesList(onlyEnabled=True)
    except:
        pass
    return []
Example #5
0
	def handlesSingleHoster(self):
		global HandlesHoster
		if HandlesHoster == None:
			HandlesHoster = 0
			services = [debrid.Premiumize(), debrid.OffCloud(), debrid.RealDebrid(), debrid.AllDebrid(), debrid.RapidPremium()]
			for service in services:
				if service.accountValid():
					HandlesHoster += 1
		return HandlesHoster <= 1
Example #6
0
	def handlesSingleCache(self):
		global HandlesCache
		if HandlesCache == None:
			HandlesCache = 0
			services = [debrid.Premiumize(), debrid.OffCloud(), debrid.RealDebrid()]
			for service in services:
				if service.accountValid():
					HandlesCache += 1
		return HandlesCache <= 1
Example #7
0
    def _debridClear(self):
        if self.handle:
            if not isinstance(self.handle, basestring):
                self.handle = self.handle.id()
            self.handle = self.handle.lower()

            if self.handle == handler.HandlePremiumize().id():
                debrid.Premiumize().deletePlayback()
            elif self.handle == handler.HandleRealDebrid().id():
                debrid.RealDebrid().deletePlayback()
Example #8
0
 def _verifyAccountsPremiumize(self, checkDisabled=True):
     name = 'Premiumize'
     if self.__done(name): return
     try:
         if not checkDisabled or self.__enabled(
                 'accounts.debrid.premiumize.enabled'):
             old = debrid.Premiumize().accountVerifyOld()
             new = debrid.Premiumize().accountVerifyNew()
             if old and new:
                 status = self.StatusOperational
             elif not old and not new:
                 status = self.StatusFailure
             else:
                 status = self.StatusLimited
         else:
             status = self.StatusDisabled
     except:
         status = self.StatusFailure
     return self.__append(name=name, status=status)
Example #9
0
 def _verifyAccountsPremiumize(self, checkDisabled=True):
     name = 'Premiumize'
     if self.__done(name): return
     try:
         if not checkDisabled or self.__enabled(
                 'accounts.debrid.premiumize.enabled'):
             if debrid.Premiumize().accountVerify():
                 status = Verification.StatusOperational
             else:
                 status = Verification.StatusFailure
         else:
             status = Verification.StatusDisabled
     except:
         status = Verification.StatusFailure
     return self.__append(name=name, status=status)
Example #10
0
 def _item(self, id, season, episode):
     item = debrid.Premiumize().item(id=id,
                                     transfer=False,
                                     content=True,
                                     season=season,
                                     episode=episode)
     try:
         self.mutex.acquire()
     except:
         pass
     if item: self.items.append(item)
     try:
         self.mutex.release()
     except:
         pass
Example #11
0
	def _debridClear(self):
		if self.handle:
			if not isinstance(self.handle, basestring):
				self.handle = self.handle.id()
			self.handle = self.handle.lower()
			source = self.source['source']
			try: id = self.source['stream']['id']
			except: id = self.url
			try: handle = self.source['stream']['handle']
			except: handle = None
			if handle == handler.HandlePremiumize.Id and debrid.Premiumize.deletePossible(source):
				pack = self.source['pack'] if 'pack' in self.source else None
				debrid.Premiumize().deletePlayback(id, pack)
			elif handle == handler.HandleOffCloud.Id and debrid.OffCloud.deletePossible(source):
				try: category = self.source['stream']['category']
				except: category = None
				pack = self.source['pack'] if 'pack' in self.source else None
				debrid.OffCloud().deletePlayback(id, pack, category)
			elif handle == handler.HandleRealDebrid.Id and debrid.RealDebrid.deletePossible(source):
				debrid.RealDebrid().deletePlayback(id)
Example #12
0
 def _showPremiumize(self):
     choice = self._option(33939, 33897, 33898)
     if choice == self.ChoiceLeft: return self.OptionCancelStep
     choice = self._option(33940, 33899, 33900)
     if choice == self.ChoiceLeft:
         tools.System.openLink(
             tools.Settings.getString('link.premiumize', raw=True))
         choice = self._option(33986, 33743, 33898)
         if choice == self.ChoiceLeft: return self._cancel()
     user = userOriginal = tools.Settings.getString(
         'accounts.debrid.premiumize.user')
     pin = pinOriginal = tools.Settings.getString(
         'accounts.debrid.premiumize.pin')
     while True:
         choice = self._option(33941, 33743, 33903)
         if choice == self.ChoiceLeft: return self._cancel()
         user = self._input(default=user)
         choice = self._option(33942, 33743, 33904)
         if choice == self.ChoiceLeft: return self._cancel()
         pin = self._input(default=pin)
         interface.Loader.show()
         tools.Settings.set('accounts.debrid.premiumize.enabled', True)
         tools.Settings.set('accounts.debrid.premiumize.user', user)
         tools.Settings.set('accounts.debrid.premiumize.pin', pin)
         valid = debrid.Premiumize().accountVerify()
         interface.Loader.hide()
         if valid:
             tools.Settings.set(
                 'providers.universal.premium.member.premiumize', True)
             choice = self._option(33944, 33743, 33821)
             if choice == self.ChoiceLeft: return self._cancel()
             return self.OptionContinue
         else:
             tools.Settings.set('accounts.debrid.premiumize.enabled', False)
             tools.Settings.set('accounts.debrid.premiumize.user',
                                userOriginal)
             tools.Settings.set('accounts.debrid.premiumize.pin',
                                pinOriginal)
             choice = self._option(33989, 33743, 33902)
             if choice == self.ChoiceLeft: return self._cancel()
     return self.OptionContinue
Example #13
0
	def popup(self, time = 2000, wait = True):
		try:
			from resources.lib.extensions import debrid

			versionCurrent = tools.System.version()
			version = tools.Settings.getString('general.launch.splash.previous')
			tools.Settings.set('general.launch.splash.previous', versionCurrent)

			# Popup on every minor version update, if and only if the user has now premiumi account already.
			special = not versionCurrent == version and versionCurrent.endswith('.0')
			special = special and not debrid.Premiumize().accountValid()
			special = special and not debrid.RealDebrid().accountValid()
			special = special and not debrid.EasyNews().accountValid()

			if version == None or version == '' or special:
				self.popupFull(wait = wait)
				return True
			elif tools.Settings.getBoolean('general.launch.splash'):
				self.popupMini(time = time) # Do not wait on the mini splash.
				return True
		except:
			pass
		return False
Example #14
0
	def _showPremiumize(self):
		choice = self._option(33939, 33897, 33898)
		if choice == Wizard.ChoiceLeft: return Wizard.OptionCancelStep
		choice = self._option(33940, 33899, 33900)
		if choice == Wizard.ChoiceLeft:
			tools.System.openLink(tools.Settings.getString('link.premiumize', raw = True))
			choice = self._option(33986, 33743, 33898)
			if choice == Wizard.ChoiceLeft: return self._cancel()
		while True:
			tools.Settings.set('accounts.debrid.premiumize.enabled', True)
			debrid.PremiumizeInterface().accountAuthentication(openSettings = False)
			interface.Loader.show()
			valid = debrid.Premiumize().accountVerify()
			interface.Loader.hide()
			if valid:
				tools.Settings.set('providers.universal.premium.member.premiumize', True)
				choice = self._option(33944, 33743, 33821)
				if choice == Wizard.ChoiceLeft: return self._cancel()
				return Wizard.OptionContinue
			else:
				tools.Settings.set('accounts.debrid.premiumize.enabled', False)
				choice = self._option(33989, 33743, 33902)
				if choice == Wizard.ChoiceLeft: return self._cancel()
		return Wizard.OptionContinue
Example #15
0
def resolver(url, debrid, title = None, season = None, episode = None, close = True, source = None):
	try: debrid = debrid.lower()
	except: pass

	url = url.replace('filefactory.com/stream/', 'filefactory.com/file/')

	# Always try Premiumize first.
	try:
		if not debrid == 'premiumize' and not debrid == True: raise Exception()
		if not debridx.Premiumize().accountValid(): raise Exception()
		return debridx.PremiumizeInterface().add(link = url, title = title, season = season, episode = episode, close = close, source = source)
	except:
		pass

	try:
		if not debrid == 'realdebrid' and not debrid == True: raise Exception()
		if not debridx.RealDebrid().accountValid(): raise Exception()
		return debridx.RealDebridInterface().add(link = url, title = title, season = season, episode = episode, close = close, source = source)
	except:
		pass

	try:
		if not debrid == 'alldebrid' and not debrid == True: raise Exception()
		if not debridx.AllDebrid().accountValid(): raise Exception()
		return debridx.AllDebrid().add(link = url)
	except:
		pass

	try:
		if not debrid == 'rapidpremium' and not debrid == True: raise Exception()
		if not debridx.RapidPremium().accountValid(): raise Exception()
		return debridx.RapidPremium().add(link = url)
	except:
		pass

	return None
Example #16
0
def resolver(url,
             debrid,
             title=None,
             season=None,
             episode=None,
             close=True,
             source=None,
             pack=False,
             cached=False,
             hash=None,
             select=False,
             cloud=False):
    try:
        debrid = debrid.lower()
    except:
        pass

    url = url.replace('filefactory.com/stream/', 'filefactory.com/file/')

    if select:
        pack = True  # Even non-season-pack archives should be selectable.

    # Always try Premiumize first.
    try:
        if not debrid == 'premiumize' and not debrid == True: raise Exception()
        if not debridx.Premiumize().accountValid(): raise Exception()
        return debridx.PremiumizeInterface().add(link=url,
                                                 title=title,
                                                 season=season,
                                                 episode=episode,
                                                 pack=pack,
                                                 close=close,
                                                 source=source,
                                                 cached=cached,
                                                 select=select,
                                                 cloud=cloud)
    except:
        pass

    try:
        if not debrid == 'offcloud' and not debrid == True: raise Exception()
        if not debridx.OffCloud().accountValid(): raise Exception()
        return debridx.OffCloudInterface().add(link=url,
                                               title=title,
                                               season=season,
                                               episode=episode,
                                               pack=pack,
                                               close=close,
                                               source=source,
                                               cached=cached,
                                               select=select)
    except:
        pass

    try:
        if not debrid == 'realdebrid' and not debrid == True: raise Exception()
        if not debridx.RealDebrid().accountValid(): raise Exception()
        return debridx.RealDebridInterface().add(link=url,
                                                 title=title,
                                                 season=season,
                                                 episode=episode,
                                                 pack=pack,
                                                 close=close,
                                                 source=source,
                                                 cached=cached,
                                                 select=select)
    except:
        pass

    try:
        if not debrid == 'alldebrid' and not debrid == True: raise Exception()
        if not debridx.AllDebrid().accountValid(): raise Exception()
        return debridx.AllDebrid().add(link=url)
    except:
        pass

    try:
        if not debrid == 'rapidpremium' and not debrid == True:
            raise Exception()
        if not debridx.RapidPremium().accountValid(): raise Exception()
        return debridx.RapidPremium().add(link=url)
    except:
        pass

    return None
Example #17
0
    def sources(self, url, hostDict, hostprDict):
        sources = []
        try:
            if url == None:
                raise Exception()

            premiumize = debrid.Premiumize()

            if not premiumize.accountValid():
                raise Exception()

            data = urlparse.parse_qs(url)
            data = dict([(i, data[i][0]) if data[i] else (i, '')
                         for i in data])

            title = data['tvshowtitle'] if 'tvshowtitle' in data else data[
                'title']
            year = int(
                data['year']
            ) if 'year' in data and not data['year'] == None else None
            season = int(
                data['season']
            ) if 'season' in data and not data['season'] == None else None
            episode = int(
                data['episode']
            ) if 'episode' in data and not data['episode'] == None else None
            pack = data['pack'] if 'pack' in data else False

            timerEnd = tools.Settings.getInteger(
                'scraping.providers.timeout') - 3
            timer = tools.Time(start=True)

            threads = []
            ids = []
            items = premiumize._itemsTransfer()
            for item in items:
                if item['transfer']['progress']['completed'][
                        'value'] == 1:  # Only finished downloads.
                    id = item['id']
                    if not id in ids:
                        meta = metadata.Metadata(name=item['name'],
                                                 title=title,
                                                 year=year,
                                                 season=season,
                                                 episode=episode,
                                                 pack=pack)
                        if not meta.ignore(size=False):
                            ids.append(id)
                            threads.append(
                                threading.Thread(target=self._item,
                                                 args=(id, season, episode)))

            [thread.start() for thread in threads]

            while True:
                if timer.elapsed() > timerEnd:
                    break
                if all([not thread.is_alive() for thread in threads]):
                    break
                time.sleep(0.5)

            try:
                self.mutex.acquire()
            except:
                pass
            items = self.items
            try:
                self.mutex.release()
            except:
                pass

            for item in items:
                jsonName = item['video']['name']
                jsonLink = item['video']['link']
                jsonSize = item['video']['size']['bytes']

                # RAR Files
                if jsonLink.lower().endswith('.rar'):
                    continue

                # Metadata
                meta = metadata.Metadata(name=jsonName,
                                         title=title,
                                         year=year,
                                         season=season,
                                         episode=episode,
                                         size=jsonSize)

                # Add
                sources.append({
                    'url': jsonLink,
                    'premium': True,
                    'debridonly': True,
                    'direct': True,
                    'memberonly': True,
                    'source': 'Premiumize',
                    'language': self.language[0],
                    'quality': meta.videoQuality(),
                    'info': meta.information(),
                    'file': jsonName
                })

            return sources
        except:
            return sources
Example #18
0
	def sources(self, url, hostDict, hostprDict):
		sources = []
		try:
			debridHas = False
			if not debridHas:
				premiumize = debrid.Premiumize()
				debridHas = premiumize.accountEnabled() and premiumize.accountValid()
				if not debridHas:
					offcloud = debrid.OffCloud()
					debridHas = offcloud.accountEnabled() and offcloud.accountValid()
					if not debridHas:
						realdebrid = debrid.RealDebrid()
						debridHas = realdebrid.accountEnabled() and realdebrid.accountValid()
						if not debridHas:
							alldebrid = debrid.AllDebrid()
							debridHas = alldebrid.accountEnabled() and alldebrid.accountValid()
							if not debrid:
								rapidpremium = debrid.RapidPremium()
								debridHas = rapidpremium.accountEnabled() and rapidpremium.accountValid()

			data = urlparse.parse_qs(url)
			data = dict([(i, data[i][0]) if data[i] else (i, '') for i in data])

			movie = False if 'tvshowtitle' in data else True
			title = data['tvshowtitle'] if 'tvshowtitle' in data else data['title']
			year = str(data['year']) if 'year' in data and not data['year'] == None else ''
			season = str(data['season']) if 'season' in data and not data['season'] == None else ''
			episode = str(data['episode']) if 'episode' in data and not data['episode'] == None else ''
			imdb = data['imdb'] if 'imdb' in data else ''
			tvdb = data['tvdb'] if 'tvdb' in data else ''

			scraper = nanscrapers.relevant_scrapers(names_list = self.name.lower(), include_disabled = True, exclude = None)[0]()
			if self.base_link and not self.base_link == '': scraper.base_link = self.base_link
			if movie:
				result = scraper.scrape_movie(title = title, year = year, imdb = imdb, debrid = debridHas)
			else:
				showYear = year
				try:
					if 'premiered' in data and not data['premiered'] == None and not data['premiered'] == '':
						for format in ['%Y-%m-%d', '%Y-%d-%m', '%d-%m-%Y', '%m-%d-%Y']:
							try:
								showYear = str(int(convert.ConverterTime(value = data['premiered'], format = format).string(format = '%Y')))
								if len(showYear) == 4: break
							except:
								pass
				except:
					pass
				result = scraper.scrape_episode(title = title, year = year, show_year = showYear, season = season, episode = episode, imdb = imdb, tvdb = tvdb, debrid = debridHas)

			if result:
				for item in result:
					item['external'] = True
					item['language']= self.language[0]
					item['debridonly'] = False
					item['url'] = item['url'].replace('http:http:', 'http:').replace('https:https:', 'https:').replace('http:https:', 'https:').replace('https:http:', 'http:') # Some of the links start with a double http.

					# External providers (eg: "Get Out"), sometimes has weird characters in the URL.
					# Ignore the links that have non-printable ASCII or UTF8 characters.
					try: item['url'].decode('utf-8')
					except: continue

					source = item['source'].lower().replace(' ', '')
					if source == 'direct' or source == 'directlink':
						source = urlparse.urlsplit(item['url'])[1].split(':')[0]
						if network.Networker.ipIs(source):
							source = 'Anonymous'
						else:
							split = source.split('.')
							for i in split:
								i = i.lower()
								if i in ['www', 'ftp']: continue
								source = i
								break
						item['source'] = source
					sources.append(item)

			return sources
		except:
			tools.Logger.error()
			return sources
Example #19
0
	def _showAccounts(self, first = True):
		if first:
			choice = self._option(35288, 33743, 33821)
			if choice == Wizard.ChoiceLeft: return self._cancel()

		orion = orionoid.Orionoid()
		enabled = interface.Format.fontBold(interface.Format.fontColor(interface.Translation.string(32301), interface.Format.ColorExcellent))
		disabled = interface.Format.fontBold(interface.Format.fontColor(interface.Translation.string(32302), interface.Format.ColorBad))
		special = interface.Translation.string(33105)
		premium = interface.Translation.string(33768)
		provider = interface.Translation.string(33681)
		general = interface.Translation.string(32310)

		items = [
			interface.Format.fontBold(interface.Translation.string(33821)),
			interface.Format.fontBold('[' + special + '] ' + interface.Translation.string(35400) + ': ') + (enabled if orion.accountValid() else disabled),
			interface.Format.fontBold('[' + general + '] ' + interface.Translation.string(32315) + ': ') + (enabled if tools.Settings.getBoolean('accounts.informants.trakt.enabled') else disabled),
			interface.Format.fontBold('[' + general + '] ' + interface.Translation.string(32034) + ': ') + (enabled if tools.Settings.getBoolean('accounts.informants.imdb.enabled') else disabled),
			interface.Format.fontBold('[' + general + '] ' + interface.Translation.string(35260) + ': ') + (enabled if tools.Settings.getBoolean('accounts.artwork.fanart.enabled') else disabled),
			interface.Format.fontBold('[' + premium + '] ' + interface.Translation.string(33566) + ': ') + (enabled if debrid.Premiumize().accountValid() else disabled),
			interface.Format.fontBold('[' + premium + '] ' + interface.Translation.string(35200) + ': ') + (enabled if debrid.OffCloud().accountValid() else disabled),
			interface.Format.fontBold('[' + premium + '] ' + interface.Translation.string(33567) + ': ') + (enabled if debrid.RealDebrid().accountValid() else disabled),
			interface.Format.fontBold('[' + premium + '] ' + interface.Translation.string(33794) + ': ') + (enabled if debrid.EasyNews().accountValid() else disabled),
			interface.Format.fontBold('[' + premium + '] ' + interface.Translation.string(33568) + ': ') + (enabled if debrid.AllDebrid().accountValid() else disabled),
			interface.Format.fontBold('[' + premium + '] ' + interface.Translation.string(33569) + ': ') + (enabled if debrid.RapidPremium().accountValid() else disabled),
		]

		choice = interface.Dialog.options(title = 32346, items = items)
		if choice < 0: return self._cancel()

		if choice == 0:
			return Wizard.OptionContinue
		elif choice == 1:
			if self._showOrion() == Wizard.OptionCancelWizard: return Wizard.OptionCancelWizard
		elif choice == 2:
			if self._showTrakt() == Wizard.OptionCancelWizard: return Wizard.OptionCancelWizard
		elif choice == 3:
			if self._showImdb() == Wizard.OptionCancelWizard: return Wizard.OptionCancelWizard
		elif choice == 4:
			if self._showFanart() == Wizard.OptionCancelWizard: return Wizard.OptionCancelWizard
		elif choice == 5:
			if self._showPremiumize() == Wizard.OptionCancelWizard: return Wizard.OptionCancelWizard
		elif choice == 6:
			if self._showOffCloud() == Wizard.OptionCancelWizard: return Wizard.OptionCancelWizard
		elif choice == 7:
			if self._showRealDebrid() == Wizard.OptionCancelWizard: return Wizard.OptionCancelWizard
		elif choice == 8:
			if self._showEasyNews() == Wizard.OptionCancelWizard: return Wizard.OptionCancelWizard
		elif choice == 9:
			if self._showAllDebrid() == Wizard.OptionCancelWizard: return Wizard.OptionCancelWizard
		elif choice == 10:
			if self._showRapidPremium() == Wizard.OptionCancelWizard: return Wizard.OptionCancelWizard

		return self._showAccounts(first = False)
Example #20
0
 def instanceEnabled(self):
     premiumize = debrid.Premiumize()
     return premiumize.accountEnabled() and premiumize.accountValid()
Example #21
0
	def __init__(self):
		Handle.__init__(self, id = HandlePremiumize.Id, name = HandlePremiumize.Name, abbreviation = HandlePremiumize.Abbreviation, debrid = True)
		self.mService = debrid.Premiumize()
		self.mServices = None
Example #22
0
	def _initialize(self, type):
		if type == None:
			return

		try:
			direct = 'direct' in type and type['direct']
			type = type['source'].lower()
		except:
			type = type.lower()
			direct = type == Handler.TypeDirect

		if not type == Handler.TypeTorrent and not type == Handler.TypeUsenet:
			if direct: type = Handler.TypeDirect
			else: type = Handler.TypeHoster
		if type == self.mType:
			return

		self.mType = type
		self.mServices = []
		self.mDefault = None

		global HandlerServicesDirect
		global HandlerServicesTorrent
		global HandlerServicesUsenet
		global HandlerServicesHoster

		global HandlerDefaultDirect
		global HandlerDefaultTorrent
		global HandlerDefaultUsenet
		global HandlerDefaultHoster

		if type == Handler.TypeDirect:
			if HandlerServicesDirect == None:
				HandlerServicesDirect = []
				if tools.Settings.getBoolean('streaming.direct.enabled'):
					handle = HandleDirect()
					HandlerServicesDirect.append(handle)
					HandlerDefaultDirect = handle
					self.mServices = HandlerServicesDirect
					self.mDefault = HandlerDefaultDirect
			else:
				self.mServices = HandlerServicesDirect
				self.mDefault = HandlerDefaultDirect
		elif type == Handler.TypeTorrent:
			if HandlerServicesTorrent == None:
				HandlerServicesTorrent = []
				if tools.Settings.getBoolean('streaming.torrent.enabled'):
					premiumize = debrid.Premiumize()
					offcloud = debrid.OffCloud()
					realdebrid = debrid.RealDebrid()
					default = tools.Settings.getInteger('streaming.torrent.default')
					if premiumize.accountValid() and premiumize.streamingTorrent():
						handle = HandlePremiumize()
						HandlerServicesTorrent.append(handle)
						if default == 1: HandlerDefaultTorrent = handle
					if offcloud.accountValid() and offcloud.streamingTorrent():
						handle = HandleOffCloud()
						HandlerServicesTorrent.append(handle)
						if default == 2: HandlerDefaultTorrent = handle
					if realdebrid.accountValid() and realdebrid.streamingTorrent():
						handle = HandleRealDebrid()
						HandlerServicesTorrent.append(handle)
						if default == 3: HandlerDefaultTorrent = handle
					if tools.Settings.getBoolean('streaming.torrent.elementum.enabled') and tools.Settings.getBoolean('streaming.torrent.elementum.connected'):
						handle = HandleElementum()
						HandlerServicesTorrent.append(handle)
						if default == 4: HandlerDefaultTorrent = handle
					if tools.Settings.getBoolean('streaming.torrent.quasar.enabled') and tools.Settings.getBoolean('streaming.torrent.quasar.connected'):
						handle = HandleQuasar()
						HandlerServicesTorrent.append(handle)
						if default == 5: HandlerDefaultTorrent = handle
					self.mServices = HandlerServicesTorrent
					self.mDefault = HandlerDefaultTorrent
			else:
				self.mServices = HandlerServicesTorrent
				self.mDefault = HandlerDefaultTorrent
		elif type == Handler.TypeUsenet:
			if HandlerServicesUsenet == None:
				HandlerServicesUsenet = []
				if tools.Settings.getBoolean('streaming.usenet.enabled'):
					premiumize = debrid.Premiumize()
					offcloud = debrid.OffCloud()
					default = tools.Settings.getInteger('streaming.usenet.default')
					if premiumize.accountValid() and premiumize.streamingUsenet():
						handle = HandlePremiumize()
						HandlerServicesUsenet.append(handle)
						if default == 1: HandlerDefaultUsenet = handle
					if offcloud.accountValid() and offcloud.streamingUsenet():
						handle = HandleOffCloud()
						HandlerServicesUsenet.append(handle)
						if default == 2: HandlerDefaultUsenet = handle
					self.mServices = HandlerServicesUsenet
					self.mDefault = HandlerDefaultUsenet
			else:
				self.mServices = HandlerServicesUsenet
				self.mDefault = HandlerDefaultUsenet
		elif type == Handler.TypeHoster:
			if HandlerServicesHoster == None:
				HandlerServicesHoster = []
				if tools.Settings.getBoolean('streaming.hoster.enabled'):
					premiumize = debrid.Premiumize()
					offcloud = debrid.OffCloud()
					realdebrid = debrid.RealDebrid()
					alldebrid = debrid.AllDebrid()
					rapidpremium = debrid.RapidPremium()
					default = tools.Settings.getInteger('streaming.hoster.default')
					if premiumize.accountValid() and premiumize.streamingHoster():
						handle = HandlePremiumize()
						HandlerServicesHoster.append(handle)
						if default == 1: HandlerDefaultHoster = handle
					if offcloud.accountValid() and offcloud.streamingHoster():
						handle = HandleOffCloud()
						HandlerServicesHoster.append(handle)
						if default == 2: HandlerDefaultHoster = handle
					if realdebrid.accountValid() and realdebrid.streamingHoster():
						handle = HandleRealDebrid()
						HandlerServicesHoster.append(handle)
						if default == 3: HandlerDefaultHoster = handle
					if alldebrid.accountValid() and alldebrid.streamingHoster():
						handle = HandleAllDebrid()
						HandlerServicesHoster.append(handle)
						if default == 4: HandlerDefaultHoster = handle
					if rapidpremium.accountValid() and rapidpremium.streamingHoster():
						handle = HandleRapidPremium()
						HandlerServicesHoster.append(handle)
						if default == 5: HandlerDefaultHoster = handle
					if tools.Settings.getBoolean('streaming.hoster.resolveurl.enabled'):
						handle = HandleResolveUrl()
						HandlerServicesHoster.append(handle)
						if default == 6: HandlerDefaultHoster = handle
					if tools.Settings.getBoolean('streaming.hoster.urlresolver.enabled'):
						handle = HandleUrlResolver()
						HandlerServicesHoster.append(handle)
						if default == 7: HandlerDefaultHoster = handle
					self.mServices = HandlerServicesHoster
					self.mDefault = HandlerDefaultHoster
			else:
				self.mServices = HandlerServicesHoster
				self.mDefault = HandlerDefaultHoster
Example #23
0
    def sources(self, url, hostDict, hostprDict):
        self.items = [
        ]  # NB: The same object of the provider is used for both normal episodes and season packs. Make sure it is cleared from the previous run.
        sources = []
        try:
            if url == None:
                raise Exception()

            premiumize = debrid.Premiumize()

            if not premiumize.accountValid():
                raise Exception()

            data = urlparse.parse_qs(url)
            data = dict([(i, data[i][0]) if data[i] else (i, '')
                         for i in data])

            if 'exact' in data and data['exact']:
                title = data['tvshowtitle'] if 'tvshowtitle' in data else data[
                    'title']
                year = None
                season = None
                episode = None
                pack = False
            else:
                title = data['tvshowtitle'] if 'tvshowtitle' in data else data[
                    'title']
                year = int(
                    data['year']
                ) if 'year' in data and not data['year'] == None else None
                season = int(
                    data['season']
                ) if 'season' in data and not data['season'] == None else None
                episode = int(
                    data['episode']) if 'episode' in data and not data[
                        'episode'] == None else None
                pack = data['pack'] if 'pack' in data else False

            timerEnd = tools.Settings.getInteger(
                'scraping.providers.timeout') - 3
            timer = tools.Time(start=True)

            threads = []
            ids = []
            items = premiumize._items()
            for item in items:
                id = item['id']
                if not id in ids:
                    meta = metadata.Metadata(name=item['name'],
                                             title=title,
                                             year=year,
                                             season=season,
                                             episode=episode,
                                             pack=pack)
                    if not meta.ignore(size=False):
                        if item['type'] == 'file':
                            item['video'] = item
                            self.items.append(item)
                        else:
                            threads.append(
                                threading.Thread(target=self._item,
                                                 args=(item['id'], None,
                                                       season, episode)))

            [thread.start() for thread in threads]

            while True:
                if timer.elapsed() > timerEnd:
                    break
                if all([not thread.is_alive() for thread in threads]):
                    break
                time.sleep(0.5)

            try:
                self.mutex.acquire()
            except:
                pass
            items = self.items
            try:
                self.mutex.release()
            except:
                pass

            for item in items:
                try:
                    jsonName = item['video']['name']
                    try:
                        if not item['name'] == jsonName and not item[
                                'name'] == 'root':
                            jsonName = item[
                                'name'] + ' - ' + jsonName  # Sometimes metadata, like quality, is only in the folder name, not the file name.
                    except:
                        pass

                    jsonLink = item['video']['link']
                    jsonSize = item['video']['size']['bytes']

                    # RAR Files
                    if jsonLink.lower().endswith('.rar'):
                        continue

                    # Metadata
                    meta = metadata.Metadata(name=jsonName,
                                             title=title,
                                             year=year,
                                             season=season,
                                             episode=episode,
                                             size=jsonSize,
                                             pack=pack)

                    # Add
                    sources.append({
                        'url': jsonLink,
                        'premium': True,
                        'debridonly': True,
                        'direct': True,
                        'memberonly': True,
                        'source': 'Premiumize',
                        'language': self.language[0],
                        'quality': meta.videoQuality(),
                        'metadata': meta,
                        'file': jsonName
                    })
                except:
                    pass
            return sources
        except:
            return sources
Example #24
0
elif action == 'premiumizeList':
	from resources.lib.extensions import interface
	interface.Dialog.confirm(title = 'Planned Feature', message = 'This feature is planned for a future release. It will allow users to fully utilize Premiumize functionality, such as manually adding downloads, deleting and moving files, and downloading files to local storage.')

elif action == 'premiumizeInformation':
	from resources.lib.extensions import debrid
	debrid.PremiumizeInterface().downloadInformation()

elif action == 'premiumizeAccount':
	from resources.lib.extensions import debrid
	debrid.PremiumizeInterface().account()

elif action == 'premiumizeWebsite':
	from resources.lib.extensions import debrid
	debrid.Premiumize().website(open = True)

elif action == 'premiumizeVpn':
	from resources.lib.extensions import debrid
	debrid.Premiumize().vpn(open = True)

elif action == 'premiumizeClear':
	from resources.lib.extensions import debrid
	debrid.PremiumizeInterface().clear()

elif action == 'premiumizeSettings':
	from resources.lib.extensions import tools
	tools.Settings.launch(category = tools.Settings.CategoryAccounts)

####################################################
# REALDEBRID
Example #25
0
 def __init__(self):
     Handle.__init__(self, 'Premiumize')
     self.mService = debrid.Premiumize()
     self.mServices = None