Esempio n. 1
0
def ice_films_tv(name,movie_title):
    try:
        title = movie_title[:-7]
        movie_year = movie_title[-6:]
        year = movie_year.replace('(','').replace(')','')
        video_type = 'shows'
        # print title
        # print year

        show_url = search(video_type,title,year)
        for e in show_url:
                url = e['url']
                #TV MAIN URL RETURNED HERE
                newseas=re.compile('S(.+?)E(.+?)  (?P<name>[A-Za-z\t .]+)').findall(name)
                for sea,epi,epi_title in newseas:
                    # print sea,epi
                    # print url
                    video = make_vid_params('Episode',title,year,sea,epi,epi_title,'')
                    #print video
                    ep_url = _get_episode_url(url, video,sea,epi)
                    #print "HERE IS END" +ep_url
                    hosters=get_sources(ep_url)

                    hosters = main_scrape.apply_urlresolver(hosters)
                    return hosters

    except Exception as e:
        hosters =[]
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='Ice Films',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)
        return hosters
Esempio n. 2
0
def ninemovies(name):
    try:
        title = name[:-7]
        movie_year = name[-6:]
        year = movie_year.replace('(', '').replace(')', '')
        video_type = 'movies'
        source = search(video_type, title, year)
        #print source
        for e in source:
            # print e
            url = e['url']
            year = e['year']
            name = e['title']
            # print "SUF URL IS = "+url
            srcurl = base_url + url
            hosters = get_sources(srcurl)
            hosters = main_scrape.apply_urlresolver(hosters)
            return hosters
    except Exception as e:
        hosters = []
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='Nine Movies',
                        msg='(error) %s  %s' % (str(e), ''),
                        duration=5000,
                        sound=None)
        return hosters
Esempio n. 3
0
def afdah(name):
    try:
        title = name[:-7]
        movie_year = name[-6:]
        year = movie_year.replace('(','').replace(')','')
        video_type = 'movies'
        search_url = urlparse.urljoin(base_url, '/wp-content/themes/afdah/ajax-search.php')
        data = {'search': title, 'type': 'title'}
        html = OPEN_URL(search_url, data=data, cache_limit=1)
        pattern = '<li>.*?href="([^"]+)">([^<]+)\s+\((\d{4})\)'
        results = []
        for match in re.finditer(pattern, html, re.DOTALL | re.I):
            url, title, match_year = match.groups('')
            if not year or not match_year or year == match_year:
                result = {'url': _pathify_url(url), 'title': title, 'year': year}
                results.append(result)
        for e in results:

            url = e['url']
            year = e['year']
            name = e['title']
            # print year
            # print name
            # print url
            # srcurl = base_url+url
            # link = OPEN_URL_REG(srcurl)
            hosters=get_sources(url)
            # print hosters
            return hosters
    except Exception as e:
        hosters =[]
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='Afdah',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)
        return hosters
Esempio n. 4
0
def tmovies_tv(name,movie_title):

    try:
        sources = []
        searchUrl = base_url+'watch_episode/'
        # if 'House' in movie_title:
        #     movie_title = movie_title.replace('House','DR House')
        movie_name = movie_title[:-6]
        movie_name_short = movie_title[:-7]
        movie_year = movie_title[-6:]
        movie_year = movie_year.replace('(','').replace(')','')
        movie_match =movie_name.replace(" ","_").replace(":","").replace("-","")
        year_movie_match = movie_match+movie_year
        direct_movie_match = movie_match[:-1]
        seasons=re.compile('S(.+?)E(.+?) ').findall(name)
        for sea,epi in seasons:
            tmurl = searchUrl+direct_movie_match+'/'+sea+'/'+epi+'/'
            link = OPEN_URLTM(tmurl)
            names = dom_parser.parse_dom(link, 'a',{'class':"norm vlink"})
            urls = dom_parser.parse_dom(link, 'a',{'class':"norm vlink"}, ret='href')
            for host, url in zip(names, urls):
                host = host.replace('www.','')
                #host = tools.get_hostname(host)
                source = {'url': url, 'host':host,'direct':False}
                sources.append(source)
            sources = main_scrape.apply_urlresolver(sources)
            return sources
    except Exception as e:
        hosters =[]
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='TwoMovies',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)
        return hosters
Esempio n. 5
0
def OPEN_URLTM(url):

    try:
        req = urllib2.Request(url)
        req.add_header(
            'User-Agent',
            'Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36'
        )
        req.add_header('Content-Type', 'application/x-www-form-urlencoded')
        req.add_header('Host', host_url)
        req.add_header('Referer', '')
        req.add_header('Connection', 'keep-alive')
        req.add_header(
            'Accept',
            'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8')
        response = urllib2.urlopen(req)
        link = response.read()
        cj.save(cookie_file, ignore_discard=True)
        response.close()
        return link
    except Exception as e:
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='TwoMovies',
                        msg='(error) %s  %s' % (str(e), ''),
                        duration=5000,
                        sound=None)
Esempio n. 6
0
def __get_links_from_xml(xml, video):
    sources = {}
    try:
        root = ET.fromstring(xml)
        for item in root.findall('.//item'):
            title = item.find('title').text
            for source in item.findall('{http://rss.jwpcdn.com/}source'):
                stream_url = source.get('file')
                label = source.get('label')
                if _get_direct_hostname(stream_url) == 'gvideo':
                    quality = _gv_get_quality(stream_url)
                elif label:
                    quality = _height_get_quality(label)
                else:
                    quality = _blog_get_quality(video, title, '')
                sources[stream_url] = {'quality': quality, 'direct': True}
                if kodi.get_setting('debug') == "true":
                    kodi.notify(header='ERROR',
                                msg='Adding stream: %s Quality: %s' %
                                (stream_url, quality),
                                duration=5000,
                                sound=None)
    except Exception as e:
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='ERROR',
                        msg='%s  %s' % (str(e), ''),
                        duration=5000,
                        sound=None)

    return sources
	def __init__(self, addon_id, url, full_name, destination, master=False, quiet=False):
		self.quiet = quiet
		if not self.quiet: kodi.open_busy_dialog()
		v = kodi.get_kodi_version()
		
		# Grab a list of KNOWN addons from the database. Unfortunately Jarvis requires direct database access for the installed flag
		if v >= 17:
			response = kodi.kodi_json_request("Addons.GetAddons", { "installed": False, "properties": ["path", "dependencies"]})
			for a in response['result']['addons']:
				self.available_addons += [a['addonid']]
				self.source_table[a['addonid']] = a['path']
		else:
			from sqlite3 import dbapi2
			dbf = kodi.vfs.join("special://profile/Database", "Addons20.db")
			with dbapi2.connect(dbf) as dbh:
				dbc = dbh.cursor()
				dbc.execute("SELECT addon.addonID, broken.addonID is Null AS enabled, addon.path FROM addon LEFT JOIN broken on addon.addonID=broken.addonID WHERE enabled=1")
				for a in dbc.fetchall():
					self.available_addons += [a[0]]
					self.source_table[a[0]] = a[2]
			dbh.close()
		self._addon_id = addon_id
		self._url = url
		self._full_name = full_name
		self._user, self.repo = full_name.split("/")
		self._master = master
		self._destination = destination
		
		# Add the final addon target to the sources list with type of zip
		# Initiate install routine
		self.install_addon(addon_id, url, full_name, master)

			
		completed = list(reversed(self.completed))
		if not quiet:
			pb = kodi.ProgressBar()
			pb.new('Enabling Addons', len(completed)+1)
			pb.update_subheading('Building Addon List')
		kodi.run_command("XBMC.UpdateLocalAddons()")
		kodi.sleep(500)	
		for addon_id in completed:
			if not quiet:
				#percent = 100* (completed.index(addon_id) / len(completed))
				#pb.update(percent, "Enabling Addons", addon_id, '')
				pb.next(addon_id)
				kodi.sleep(100)
			self.enable_addon(addon_id)
		
		if not quiet: pb.next("Looking for Updates", "")
		kodi.sleep(500)
		kodi.run_command('XBMC.UpdateAddonRepos')
		
		# Enable installed addons	
		if not self.quiet: 
			pb.close()
			kodi.close_busy_dialog()
			if self.install_error:
				kodi.notify("Install failed", self._addon_id)
			else:		
				kodi.notify("Install complete", self._addon_id)
Esempio n. 8
0
def get_tv_link(url,movie_title,thumb,media):
    hmf = urlresolver.HostedMediaFile(url)
    ##########################################
    if hmf:
        url = urlresolver.resolve(url)
    if not hmf:
        url = url
    try:
        params = {'url':url, 'name':media, 'thumb':thumb}
        addon.add_video_item(params, {'title':media}, img=thumb)
        liz=xbmcgui.ListItem(media, iconImage="DefaultFolder.png", thumbnailImage=thumb)
        xbmc.sleep(1000)
        liz.setPath(str(url))
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
        #xbmc.Player ().play(url, liz, False)
        movie_name = movie_title[:-6]
        movie_name = '"'+movie_name+'"'
        movie_year_full = movie_title[-6:]
        movie_year = movie_year_full.replace('(','').replace(')','')
        if kodi.get_setting('trakt_oauth_token'):
            xbmc.sleep(30000)
            log_utils.log("Velocity: TV Show Scrobble  Start")
            try:
                trakt_auth.start_tv_watch(movie_name,media)
            except Exception as e:
                    log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
                    if kodi.get_setting('error_notify') == "true":
                        kodi.notify(header='Scrobble not loggged', msg='%s  %s' % (str(e), ''), duration=5000, sound=None)
        xbmc.sleep(30000)
        if kodi.get_setting('trakt_oauth_token'):
            check_tv_player(movie_name,media)

    except Exception as e:
            log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
            kodi.notify(header='Try Another Source', msg='Link Removed or Failed', duration=4000, sound=None)
Esempio n. 9
0
def putlocker_tv(name, movie_title):
    try:
        title = movie_title[:-7]
        movie_year = movie_title[-6:]
        year = movie_year.replace('(', '').replace(')', '')
        video_type = 'shows'
        show_url = search(video_type, title, year)
        for e in show_url:
            url = e['url']
            newseas = re.compile(
                'S(.+?)E(.+?)  (?P<name>[A-Za-z\t .]+)').findall(name)
            print newseas
            for sea, epi, epi_title in newseas:
                video = make_vid_params('Episode', title, year, sea, epi,
                                        epi_title, '')
                ep_url = _get_episode_url(url, video, sea, epi)
                hosters = get_sources(ep_url)
                hosters = main_scrape.apply_urlresolver(hosters)
                return hosters
    except Exception as e:
        hosters = []
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='Putlocker TV',
                        msg='(error) %s  %s' % (str(e), ''),
                        duration=5000,
                        sound=None)
        return hosters
def update_addons(quiet=True):
	from distutils.version import LooseVersion
	if not quiet: kodi.open_busy_dialog()
	sources = DB.query("SELECT addon_id, source FROM install_history")
	update_count = 0
	for source in sources:
		addon_id = source[0]
		source = json.loads(source[1])
		if kodi.get_condition_visiblity("System.HasAddon(%s)" % addon_id):
			if source['type'] == SOURCES.ZIP:
				url, filename, full_name, version = github_api.find_zip(source['user'], addon_id)
				if LooseVersion(version) > LooseVersion(source['version']):
					GitHub_Installer(addon_id, url, full_name, kodi.vfs.join("special://home", "addons"), False, quiet)
					update_count += 1
			elif source['type'] == SOURCES.REPO:
				full_name = sources['user'] + '/' + sources['repo']
				xml_str = github_api.find_xml(full_name)
				xml = BeautifulSoup(xml_str)
				addon = xml.find('addon')
				if LooseVersion(addon['version']) > LooseVersion(source['version']):
					GitHub_Installer(addon_id, source['url'], full_name, kodi.vfs.join("special://home", "addons"), True, quiet)
					update_count += 1

	if not quiet: kodi.close_busy_dialog()
	if update_count > 0: 
		kodi.notify("Update complete",'Some addons may require restarting kodi.')
	else:
		kodi.notify("Update complete",'No updates found.')
Esempio n. 11
0
def update_addons(quiet=True):
    from distutils.version import LooseVersion
    if not quiet: kodi.open_busy_dialog()
    sources = DB.query("SELECT addon_id, source FROM install_history")
    update_count = 0
    for source in sources:
        addon_id = source[0]
        source = json.loads(source[1])
        if kodi.get_condition_visiblity("System.HasAddon(%s)" % addon_id):
            if source['type'] == SOURCES.ZIP:
                url, filename, full_name, version = github_api.find_zip(
                    source['user'], addon_id)
                if LooseVersion(version) > LooseVersion(source['version']):
                    GitHub_Installer(addon_id, url, full_name,
                                     kodi.vfs.join("special://home", "addons"),
                                     False, quiet)
                    update_count += 1
            elif source['type'] == SOURCES.REPO:
                full_name = sources['user'] + '/' + sources['repo']
                xml_str = github_api.find_xml(full_name)
                xml = BeautifulSoup(xml_str)
                addon = xml.find('addon')
                if LooseVersion(addon['version']) > LooseVersion(
                        source['version']):
                    GitHub_Installer(addon_id, source['url'], full_name,
                                     kodi.vfs.join("special://home", "addons"),
                                     True, quiet)
                    update_count += 1

    if not quiet: kodi.close_busy_dialog()
    if update_count > 0:
        kodi.notify("Update complete",
                    'Some addons may require restarting kodi.')
    else:
        kodi.notify("Update complete", 'No updates found.')
Esempio n. 12
0
def tmlinkpage(url,movie_title,thumb,media):

    try:
        if  "full" in url:
                link = OPEN_URL(url)
                if 'Before you start watching' in link:
                                                #print 'Confirmation Button '
                                                url = url
                                                header_dict = {}
                                                header_dict['Accept'] = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
                                                header_dict['Connection'] = 'keep-alive'
                                                header_dict['Content-Type'] = 'application/x-www-form-urlencoded'
                                                header_dict['Origin'] = host_url
                                                header_dict['Referer'] = url
                                                header_dict['User-Agent'] = 'Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36'
                                                form_data = {'confirm':'I understand, Let me watch the movie now!'}
                                                net.set_cookies(cookiejar)
                                                conbutton = net.http_POST(url, form_data=form_data,headers=header_dict)

                link=OPEN_URL(url)
                link=link.replace('\r','').replace('\n','').replace('\t','').replace(' ','')
                matchurl=re.compile('Sourcelink:<arel="nofollow"onlicktarget="_blank">(.+?)</').findall(link)
                for urls in matchurl:
                    urls = str(urls)
                    urls = urls.replace('&rel=nofollow','')
                    if media =='movies':
                        main_scrape.get_link(urls,movie_title,thumb,media)
                    else:
                        main_scrape.get_tv_link(urls,movie_title,thumb,media)
    except Exception as e:
            log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
            if kodi.get_setting('error_notify') == "true":
                kodi.notify(header='TwoMovies',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)
Esempio n. 13
0
def custom_list_view_tv(trakt_id,media):
	try:
		lists = trakt_api.get_special_list('kids',media)#is actually SLUG ID
		for e in lists:
			infoLabels = trakt_api.process_movie(e)
			infoLabels.update(make_infoLabels(e))
			menu_items=[]
			trakt_id = str(infoLabels['trakt_id'])
			trailer = infoLabels['trailer_url']
			year = str(infoLabels['year'])
			name = infoLabels['title'].encode('utf-8')
			thumb=infoLabels['cover_url']
			if thumb is None:
				thumb = ''
			menu_items.append(('[COLOR gold]Show Information[/COLOR]', 'XBMC.Action(Info)'))
			if trailer:
				utube = tools.make_trailer(trailer)
				menu_items.append(('[COLOR gold]Play Trailer[/COLOR]', 'PlayMedia('+utube+',xbmcgui.ListItem(title, iconImage=image, thumbnailImage=image))'))


			kodi.addDir(name+' ('+year+')','','find_season',thumb,name,5,trakt_id,'shows',meta_data=infoLabels,menu_items=menu_items,replace_menu=False)
			kodi.auto_view('tvshows')
	except Exception as e:
		log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
		if kodi.get_setting('error_notify') == "true":
			kodi.notify(header='Custom List Error',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)
Esempio n. 14
0
def add_to_queue(name,url,thumb,ext,media):
    try:
        try:
            conn.execute('''CREATE TABLE downloads(name text unique, url text, thumb text, ext text, media text)''')
        except:
            print "Velocity says: Downloads DB Table Already exists"

        # Insert a row of data or return already there
        try:
            #Quote Replacement
            name = name.replace("'", "''")
            media = media.replace("'", "''")
            #END Quote Replacement

            conn.execute("INSERT INTO downloads VALUES ('"+name+"','"+url+"','"+thumb+"','"+ext+"','"+media+"')")
            addon.show_small_popup(title='[COLOR gold]Item Added To Your Queue [/COLOR]', msg=name + ' Was Added To Your Download Queue', delay=int(5000), image=thumb)
        except Exception as e:
            addon.show_small_popup(title='[COLOR red]Item Already In Your Queue[/COLOR]', msg=name + ' Is Already In Your Download Queue', delay=int(5000), image=thumb)
            print 'Error [%s]  %s' % (str(e), '')
        # Save (commit) the changes
        conn.commit()
        # We can also close the connection if we are done with it.
        # Just be sure any changes have been committed or they will be lost.
        conn.close()
    except Exception as e:
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='Downloads',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)
Esempio n. 15
0
def __fix_bad_cookies():
    c = cj._cookies
    for domain in c:
        for path in c[domain]:
            for key in c[domain][path]:
                cookie = c[domain][path][key]
                if cookie.expires > sys.maxint:
                    if kodi.get_setting('debug') == "true":
                        kodi.notify(header='Cookie Fix', msg='Fixing cookie expiration for %s: was: %s now: %s' % (key, cookie.expires, sys.maxint), duration=5000, sound=None)
                        log_utils.log('Fixing cookie expiration for %s: was: %s now: %s' % (key, cookie.expires, sys.maxint), xbmc.LOGERROR)
                    cookie.expires = sys.maxint
Esempio n. 16
0
def merdb(name):
    try:
        sources = []
        searchUrl = base_url + '?search='
        movie_name = name[:-6]
        movie_name_short = name[:-7]
        movie_year = name[-6:]
        movie_year = movie_year.replace('(', '').replace(')', '')
        sname = movie_name.replace(" ", "+")
        mername = sname[:-1]
        movie_match = movie_name.replace(" ", "_") + movie_year
        surl = searchUrl + mername
        link = OPEN_URL(surl)
        #dp.update(80)
        match = re.compile(
            '<div class="main_list_box"><a href="(.+?)" title="(.+?)"><img'
        ).findall(link)
        for url, name in match:
            if movie_match in url or movie_name_short == name:
                link = OPEN_URL(base_url + url)
                vidlinks = dom_parser.parse_dom(
                    link, 'span', {'class': "movie_version_link"})
                linknames = dom_parser.parse_dom(link, 'span',
                                                 {'class': "version_host"})
                for name, vidlink in zip(linknames, vidlinks):
                    #dp.update(80)
                    match = re.compile('<a href="(.+?)"').findall(vidlink)
                    for linkurl in match:
                        if "ads.php" not in linkurl and "Sponsor" not in name and "Host" not in name:
                            url = base_url + linkurl
                            #print "URLS IS = " +url
                            host = name.replace("'", "")
                            #linkname = tools.get_hostname(name)
                            source = {
                                'hostname': 'MerDB',
                                'views': None,
                                'url': url,
                                'host': host,
                                'direct': False
                            }
                            sources.append(source)
        #dp.close()
        sources = main_scrape.apply_urlresolver(sources)
        return sources
    except Exception as e:
        hosters = []
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='MerDb',
                        msg='(error) %s  %s' % (str(e), ''),
                        duration=5000,
                        sound=None)
        return hosters
Esempio n. 17
0
def adjust_advancedSettings():
    XML_FILE = xbmc.translatePath(
        'special://home/userdata/advancedsettings.xml')
    MEM = kodi.get_info("System.Memory(total)")
    FREEMEM = kodi.get_info("System.FreeMemory")
    BUFFER_F = re.sub('[^0-9]', '', FREEMEM)
    BUFFER_F = int(BUFFER_F) / 3
    BUFFERSIZE = BUFFER_F * 1024 * 1024

    with open(XML_FILE, "w") as f:
        xml_data = xml_data_advSettings(str(BUFFERSIZE))
        f.write(xml_data)
    kodi.notify('Advanced Settings', 'Buffer set to: ' + size_format(BUFFER_F))
Esempio n. 18
0
def zmovies(name):
    try:
        sources = []
        movie_name = name[:-6]
        movie_name_short = name[:-7]
        movie_year = name[-6:]
        movie_year = movie_year.replace('(', '').replace(')', '')
        sname = movie_name.replace(" ", "+")
        movie_match = movie_name.replace(" ", "-").replace(":", "")
        year_movie_match = movie_match + movie_year
        direct_movie_match = movie_match[:-1]
        tmurl = base_url + 'movies/view/' + direct_movie_match
        ytmurl = base_url + 'movies/view/' + year_movie_match
        #dp.update(25)
        #For links that are direct
        link = OPEN_URL(tmurl)
        match = re.compile(
            'target="_blank"   href="(.+?)"> <b> Watch Full </b></a> </td>'
        ).findall(link)
        for url in match:
            hmf = urlresolver.HostedMediaFile(url)
            if hmf:

                #linkname= hmf.get_host()
                linkname = tools.get_hostname(url)
                host = linkname
                source = {'url': url, 'host': host, 'direct': False}
                sources.append(source)
        #Fro Links that need year added
        link = OPEN_URL(ytmurl)
        #dp.update(80)
        match = re.compile(
            'target="_blank"   href="(.+?)"> <b> Watch Full </b></a> </td>'
        ).findall(link)
        for url in match:
            linkname = tools.get_hostname(url)
            host = linkname
            source = {'url': url, 'host': host, 'direct': False}
            sources.append(source)
        #dp.close()
        sources = main_scrape.apply_urlresolver(sources)
        return sources
    except Exception as e:
        hosters = []
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='Zee Moviess',
                        msg='(error) %s  %s' % (str(e), ''),
                        duration=5000,
                        sound=None)
        return hosters
Esempio n. 19
0
def OPEN_URL(url):

  try:
      req=urllib2.Request(url)
      req.add_header('User-Agent', 'Mozilla/5.0 (Linux; U; Android 4.2.2; en-us; AFTB Build/JDQ39) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30')
      response=urllib2.urlopen(req)
      link=response.read()
      cj.save(cookie_file, ignore_discard=True)
      response.close()
      return link
  except Exception as e:
            log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
            if kodi.get_setting('error_notify') == "true":
                kodi.notify(header='TwoMovies',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)
Esempio n. 20
0
def tmovies(name):

    try:
        sources = []
        searchUrl = base_url + 'watch_movie/'
        movie_name = name[:-6]
        movie_name_short = name[:-7]
        movie_year = name[-6:]
        movie_year = movie_year.replace('(', '').replace(')', '')
        sname = movie_name.replace(" ", "+")
        movie_match = movie_name.replace(" ",
                                         "_").replace(":",
                                                      "").replace("-", "")
        year_movie_match = movie_match + movie_year
        direct_movie_match = movie_match[:-1]
        tmurl = base_url + 'watch_movie/' + direct_movie_match
        ytmurl = base_url + 'watch_movie/' + year_movie_match
        link = OPEN_URLTM(tmurl)
        names = dom_parser.parse_dom(link, 'a', {'class': "norm vlink"})
        urls = dom_parser.parse_dom(link,
                                    'a', {'class': "norm vlink"},
                                    ret='href')
        for host, url in zip(names, urls):
            host = host.replace('www.', '')
            #host = tools.get_hostname(host)
            source = {'url': url, 'host': host, 'direct': False}
            sources.append(source)
        link = OPEN_URLTM(ytmurl)
        names = dom_parser.parse_dom(link, 'a', {'class': "norm vlink"})
        urls = dom_parser.parse_dom(link,
                                    'a', {'class': "norm vlink"},
                                    ret='href')
        for host, url in zip(names, urls):
            host = host.replace('www.', '')
            #host = tools.get_hostname(host)
            source = {'url': url, 'host': host, 'direct': False}
            sources.append(source)
        sources = main_scrape.apply_urlresolver(sources)
        return sources
    except Exception as e:
        hosters = []
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='TwoMovies',
                        msg='(error) %s  %s' % (str(e), ''),
                        duration=5000,
                        sound=None)
        return hosters
Esempio n. 21
0
def tmlinkpage(url, movie_title, thumb, media):

    try:
        if "full" in url:
            link = OPEN_URL(url)
            if 'Before you start watching' in link:
                #print 'Confirmation Button '
                url = url
                header_dict = {}
                header_dict[
                    'Accept'] = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
                header_dict['Connection'] = 'keep-alive'
                header_dict[
                    'Content-Type'] = 'application/x-www-form-urlencoded'
                header_dict['Origin'] = host_url
                header_dict['Referer'] = url
                header_dict[
                    'User-Agent'] = 'Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36'
                form_data = {
                    'confirm': 'I understand, Let me watch the movie now!'
                }
                net.set_cookies(cookiejar)
                conbutton = net.http_POST(url,
                                          form_data=form_data,
                                          headers=header_dict)

            link = OPEN_URL(url)
            link = link.replace('\r',
                                '').replace('\n',
                                            '').replace('\t',
                                                        '').replace(' ', '')
            matchurl = re.compile(
                'Sourcelink:<arel="nofollow"onlicktarget="_blank">(.+?)</'
            ).findall(link)
            for urls in matchurl:
                urls = str(urls)
                urls = urls.replace('&rel=nofollow', '')
                if media == 'movies':
                    main_scrape.get_link(urls, movie_title, thumb, media)
                else:
                    main_scrape.get_tv_link(urls, movie_title, thumb, media)
    except Exception as e:
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='TwoMovies',
                        msg='(error) %s  %s' % (str(e), ''),
                        duration=5000,
                        sound=None)
Esempio n. 22
0
def primewire(name):
    try:
            sources = []
            searchUrl = base_url+'index.php?search_keywords='
            movie_name = name[:-6]
            movie_name_short = name[:-7]
            movie_year_full = name[-6:]
            movie_year = movie_year_full.replace('(','').replace(')','')
            sname = movie_name.replace(" ","+")
            primename = sname[:-1]
            movie_match =movie_name.replace(" ","_")+movie_year
            surl = searchUrl + primename
            link = OPEN_URL(surl)
            full_match  = movie_name+movie_year_full
            match=re.compile('<a href="/(.+?)" title="Watch (.+?)">').findall(link)
            for url, name in match:
                if full_match == name:
                    link = OPEN_URL(base_url+url)
                    container_pattern = r'<table[^>]+class="movie_version[ "][^>]*>(.*?)</table>'
                    item_pattern = (
                        r'quality_(?!sponsored|unknown)([^>]*)></span>.*?'
                        r'url=([^&]+)&(?:amp;)?domain=([^&]+)&(?:amp;)?(.*?)'
                        r'"version_veiws"> ([\d]+) views</')
                    max_index = 0
                    max_views = -1
                    for container in re.finditer(container_pattern, link, re.DOTALL | re.IGNORECASE):
                        for i, source in enumerate(re.finditer(item_pattern, container.group(1), re.DOTALL)):
                            qual, url, host, parts, views = source.groups()
                            if kodi.get_setting('debug') == "true":
                                print"PrimeWire Debug:"
                                print "Quality is " + qual
                                print "URL IS " + url.decode('base-64')
                                print "HOST IS  "+host.decode('base-64')
                                print "VIEWS ARE " +views
                            if host == 'ZnJhbWVndGZv': continue  # filter out promo hosts
                            #host = tools.get_hostname(host.decode('base-64'))
                            source = {'hostname':'PrimeWire','url': url.decode('base-64'), 'host': host.decode('base-64'),'views':views,'quality':qual,'direct':False}
                            sources.append(source)
            #print "MOVIE SOURCES ARE = "+str(sources)
            sources = main_scrape.apply_urlresolver(sources)
            return sources
    except Exception as e:
        sources =[]
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='PrimeWire',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)
        return sources
Esempio n. 23
0
def zmovies(name):
    try:
        sources = []
        movie_name = name[:-6]
        movie_name_short = name[:-7]
        movie_year = name[-6:]
        movie_year = movie_year.replace('(','').replace(')','')
        sname = movie_name.replace(" ","+")
        movie_match =movie_name.replace(" ","-").replace(":","")
        year_movie_match = movie_match+movie_year
        direct_movie_match = movie_match[:-1]
        tmurl = base_url+'movies/view/'+direct_movie_match
        ytmurl = base_url+'movies/view/'+year_movie_match
        #dp.update(25)
        #For links that are direct
        link = OPEN_URL(tmurl)
        match=re.compile('target="_blank"   href="(.+?)"> <b> Watch Full </b></a> </td>').findall(link)
        for url in match:
            hmf = urlresolver.HostedMediaFile(url)
            if hmf:

            #linkname= hmf.get_host()
                linkname = tools.get_hostname(url)
                host = linkname
                #source = {'hostname':'IceFilms','multi-part': False, 'quality': quality, 'label': label, 'rating': None, 'views': None, 'direct': False}
                source = {'hostname':'ZMovies','views':None, 'quality': None, 'rating': None,'url': url, 'host': host, 'direct':False}
                sources.append(source)
        #Fro Links that need year added
        link = OPEN_URL(ytmurl)
        #dp.update(80)
        match=re.compile('target="_blank"   href="(.+?)"> <b> Watch Full </b></a> </td>').findall(link)
        for url in match:
            linkname = tools.get_hostname(url)
            host = linkname
            source = {'hostname':'ZMovies','views':None, 'quality': None, 'rating': None,'url': url, 'host': host, 'direct':False}
            sources.append(source)
        #dp.close()
        sources = main_scrape.apply_urlresolver(sources)
        print sources
        return sources
    except Exception as e:
        hosters =[]
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='Zee Moviess',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)
        return hosters
Esempio n. 24
0
def find_episode(name,trakt_id,movie_title):

	try:
		media ='episode'
		season = name.replace('Season ','')
		#print "SHOW TRAKT IS : "+trakt_id
		link = trakt_api.get_show_episodes(trakt_id,season)
		for e in link:
			ep_trakt_id= e['ids']['trakt']
			#print "Episode TRAKT ID IS  : "+str(ep_trakt_id)
			infoLabels={}
			infoLabels.update(make_infoLabels(e))
			episode = infoLabels['episode']
			infoLabels = trakt_api.get_episode_details(trakt_id,season,episode)
			menu_items=[]
			trailer = infoLabels['trailer_url']
			year = str(infoLabels['year'])
			name = infoLabels['title'].encode('utf-8')
			thumb=infoLabels['cover_url']
			# ################
			was_watched=watched_cache.get_watched_cache(ep_trakt_id)
			if was_watched is not None:
				infoLabels['playcount'] = 1
			# ################
			if thumb is None:
				thumb = ''
			#print infoLabels['premiered'][:10]
			#if (episode['first_aired'] != None and utils2.iso_2_utc(episode['first_aired']) <= time.time()) or (include_unknown and episode['first_aired'] == None):
			d1 = str(infoLabels['premiered'])
			d2 = str(datetime.date.today())
			#print today - was_aired
			#if infoLabels['premiered'] =='':
			if d1 >= d2 or infoLabels['premiered'] == '':
				if name is not '':
					menu_items.append(('[COLOR gold]Show Information[/COLOR]', 'XBMC.Action(Info)'))
					kodi.addDir('[COLOR maroon]S'+str(season)+'E'+str(episode)+'  '+name+'[/COLOR]','','findsource',thumb,movie_title,5,'','shows',meta_data=infoLabels,menu_items=menu_items,replace_menu=True)
					#name = name+" [COLOR red]Coming Soon[/COLOR]"
			else:
				menu_items.append(('[COLOR gold]Show Information[/COLOR]', 'XBMC.Action(Info)'))
				kodi.addDir('S'+str(season)+'E'+str(episode)+'  '+name,'','findsource',thumb,movie_title,5,'','shows',meta_data=infoLabels,menu_items=menu_items,replace_menu=True)
			kodi.auto_view('episode')
	except Exception as e:
		log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
		if kodi.get_setting('error_notify') == "true":
			kodi.notify(header='Trakt Episodes',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)
Esempio n. 25
0
def get_tv_link(url, movie_title, thumb, media):
    hmf = urlresolver.HostedMediaFile(url)
    ##########################################
    if hmf:
        url = urlresolver.resolve(url)
    if not hmf:
        url = url
    try:

        params = {'url': url, 'title': media, 'thumb': thumb}
        listitem = xbmcgui.ListItem(path=url,
                                    iconImage=thumb,
                                    thumbnailImage=thumb)
        listitem.setProperty('fanart_image', fanart)
        listitem.setPath(url)
        listitem.setInfo('video', params)

        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listitem)
        movie_name = movie_title[:-6]
        movie_name = '"' + movie_name + '"'
        movie_year_full = movie_title[-6:]
        movie_year = movie_year_full.replace('(', '').replace(')', '')
        if kodi.get_setting('trakt_oauth_token'):
            xbmc.sleep(30000)
            log_utils.log("Velocity: TV Show Scrobble  Start")
            try:
                trakt_auth.start_tv_watch(movie_name, media)
            except Exception as e:
                log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
                if kodi.get_setting('error_notify') == "true":
                    kodi.notify(header='Scrobble not loggged',
                                msg='%s  %s' % (str(e), ''),
                                duration=5000,
                                sound=None)
        xbmc.sleep(30000)
        if kodi.get_setting('trakt_oauth_token'):
            check_tv_player(movie_name, media)

    except Exception as e:
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        kodi.notify(header='Try Another Source',
                    msg='Link Removed or Failed',
                    duration=4000,
                    sound=None)
Esempio n. 26
0
def __fix_bad_cookies():
    c = cj._cookies
    for domain in c:
        for path in c[domain]:
            for key in c[domain][path]:
                cookie = c[domain][path][key]
                if cookie.expires > sys.maxint:
                    if kodi.get_setting('debug') == "true":
                        kodi.notify(
                            header='Cookie Fix',
                            msg=
                            'Fixing cookie expiration for %s: was: %s now: %s'
                            % (key, cookie.expires, sys.maxint),
                            duration=5000,
                            sound=None)
                        log_utils.log(
                            'Fixing cookie expiration for %s: was: %s now: %s'
                            % (key, cookie.expires, sys.maxint), xbmc.LOGERROR)
                    cookie.expires = sys.maxint
Esempio n. 27
0
def custom_list_view(trakt_id, media):
    try:
        lists = trakt_api.get_special_list(trakt_id,
                                           media)  #is actually SLUG ID
        for e in lists:
            infoLabels = trakt_api.process_movie(e)
            infoLabels.update(make_infoLabels(e))
            menu_items = []
            trakt_id = str(infoLabels['trakt_id'])
            trailer = infoLabels['trailer_url']
            year = str(infoLabels['year'])
            name = infoLabels['title'].encode('utf-8')
            thumb = infoLabels['cover_url']
            if thumb is None:
                thumb = ''
            menu_items.append(
                ('[COLOR gold]Show Information[/COLOR]', 'XBMC.Action(Info)'))
            if trailer:
                utube = tools.make_trailer(trailer)
                menu_items.append((
                    '[COLOR gold]Play Trailer[/COLOR]', 'PlayMedia(' + utube +
                    ',xbmcgui.ListItem(title, iconImage=image, thumbnailImage=image))'
                ))

            kodi.addDir(name + ' (' + year + ')',
                        '',
                        'findsource',
                        thumb,
                        name,
                        5,
                        '',
                        'movies',
                        meta_data=infoLabels,
                        menu_items=menu_items,
                        replace_menu=False)
            kodi.auto_view('movies')
    except Exception as e:
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='Custom List Error',
                        msg='(error) %s  %s' % (str(e), ''),
                        duration=5000,
                        sound=None)
Esempio n. 28
0
def OPEN_URLTM(url):

        try:
            req=urllib2.Request(url)
            req.add_header('User-Agent', 'Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36')
            req.add_header('Content-Type','application/x-www-form-urlencoded')
            req.add_header('Host',host_url)
            req.add_header('Referer','')
            req.add_header('Connection','keep-alive')
            req.add_header('Accept','text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8')
            response=urllib2.urlopen(req)
            link=response.read()
            cj.save(cookie_file, ignore_discard=True)
            response.close()
            return link
        except Exception as e:
            log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
            if kodi.get_setting('error_notify') == "true":
                kodi.notify(header='TwoMovies',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)
Esempio n. 29
0
def putlocker_movies(movie_title):
    try:
        title = movie_title[:-7]
        movie_year = movie_title[-6:]
        year = movie_year.replace('(','').replace(')','')
        video_type = 'movies'
        show_url = search(video_type,title,year)
        for e in show_url:
                url = e['url']
                hosters=get_sources(url)
                print "HOSTERS ARE " + str(hosters)
                hosters = main_scrape.apply_urlresolver(hosters)
                return hosters
    except Exception as e:
        hosters =[]
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='Putlocker Movies',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)
        return hosters
Esempio n. 30
0
def afdah(name):
    try:
        title = name[:-7]
        movie_year = name[-6:]
        year = movie_year.replace('(', '').replace(')', '')
        video_type = 'movies'
        search_url = urlparse.urljoin(
            base_url, '/wp-content/themes/afdah/ajax-search.php')
        data = {'search': title, 'type': 'title'}
        html = OPEN_URL(search_url, data=data, cache_limit=1)
        pattern = '<li>.*?href="([^"]+)">([^<]+)\s+\((\d{4})\)'
        results = []
        for match in re.finditer(pattern, html, re.DOTALL | re.I):
            url, title, match_year = match.groups('')
            if not year or not match_year or year == match_year:
                result = {
                    'url': _pathify_url(url),
                    'title': title,
                    'year': year
                }
                results.append(result)
        for e in results:

            url = e['url']
            year = e['year']
            name = e['title']
            # print year
            # print name
            # print url
            # srcurl = base_url+url
            # link = OPEN_URL_REG(srcurl)
            hosters = get_sources(url)
            # print hosters
            return hosters
    except Exception as e:
        hosters = []
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='Afdah',
                        msg='(error) %s  %s' % (str(e), ''),
                        duration=5000,
                        sound=None)
        return hosters
Esempio n. 31
0
def OPEN_URL(url):

    try:
        req = urllib2.Request(url)
        req.add_header(
            'User-Agent',
            'Mozilla/5.0 (Linux; U; Android 4.2.2; en-us; AFTB Build/JDQ39) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30'
        )
        response = urllib2.urlopen(req)
        link = response.read()
        cj.save(cookie_file, ignore_discard=True)
        response.close()
        return link
    except Exception as e:
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='TwoMovies',
                        msg='(error) %s  %s' % (str(e), ''),
                        duration=5000,
                        sound=None)
Esempio n. 32
0
def ot3_movies(name):
    try:
        title = name[:-7]
        movie_year = name[-6:]
        year = movie_year.replace('(','').replace(')','')
        video_type = 'movies'
        source = search(video_type,title,year)
        for e in source:
                url = e['url']
                year = e['year']
                name = e['title']
                srcurl =base_url+url
                hosters=get_sources(srcurl,url)
                hosters = main_scrape.apply_urlresolver(hosters)
                return hosters
    except Exception as e:
        hosters =[]
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='123Movies',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)
        return hosters
Esempio n. 33
0
def merdb(name):
    try:
        sources = []
        searchUrl = base_url+'?search='
        movie_name = name[:-6]
        movie_name_short = name[:-7]
        movie_year = name[-6:]
        movie_year = movie_year.replace('(','').replace(')','')
        sname = movie_name.replace(" ","+")
        mername = sname[:-1]
        movie_match =movie_name.replace(" ","_")+movie_year
        surl = searchUrl + mername
        link = OPEN_URL(surl)
        #dp.update(80)
        match=re.compile('<div class="main_list_box"><a href="(.+?)" title="(.+?)"><img').findall(link)
        for url, name in match:
            if movie_match in url or movie_name_short == name:
                link = OPEN_URL(base_url+url)
                vidlinks=dom_parser.parse_dom(link, 'span',{'class':"movie_version_link"})
                linknames=dom_parser.parse_dom(link, 'span',{'class':"version_host"})
                for name, vidlink in zip(linknames, vidlinks):
                    #dp.update(80)
                    match=re.compile('<a href="(.+?)"').findall(vidlink)
                    for linkurl in match:
                        if "ads.php" not in linkurl and "Sponsor" not in name and "Host" not in name:
                            url = base_url+linkurl
                            #print "URLS IS = " +url
                            host = name.replace("'","")
                            #linkname = tools.get_hostname(name)
                            source = {'hostname':'MerDB','views':None,'url': url, 'host': host, 'direct':False}
                            sources.append(source)
        #dp.close()
        sources = main_scrape.apply_urlresolver(sources)
        return sources
    except Exception as e:
        hosters =[]
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='MerDb',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)
        return hosters
Esempio n. 34
0
def tmovies_tv(name, movie_title):

    try:
        sources = []
        searchUrl = base_url + 'watch_episode/'
        # if 'House' in movie_title:
        #     movie_title = movie_title.replace('House','DR House')
        movie_name = movie_title[:-6]
        movie_name_short = movie_title[:-7]
        movie_year = movie_title[-6:]
        movie_year = movie_year.replace('(', '').replace(')', '')
        movie_match = movie_name.replace(" ",
                                         "_").replace(":",
                                                      "").replace("-", "")
        year_movie_match = movie_match + movie_year
        direct_movie_match = movie_match[:-1]
        seasons = re.compile('S(.+?)E(.+?) ').findall(name)
        for sea, epi in seasons:
            tmurl = searchUrl + direct_movie_match + '/' + sea + '/' + epi + '/'
            link = OPEN_URLTM(tmurl)
            names = dom_parser.parse_dom(link, 'a', {'class': "norm vlink"})
            urls = dom_parser.parse_dom(link,
                                        'a', {'class': "norm vlink"},
                                        ret='href')
            for host, url in zip(names, urls):
                host = host.replace('www.', '')
                #host = tools.get_hostname(host)
                source = {'url': url, 'host': host, 'direct': False}
                sources.append(source)
            sources = main_scrape.apply_urlresolver(sources)
            return sources
    except Exception as e:
        hosters = []
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='TwoMovies',
                        msg='(error) %s  %s' % (str(e), ''),
                        duration=5000,
                        sound=None)
        return hosters
Esempio n. 35
0
def get_tv_link(url, movie_title, thumb, media):
    hmf = urlresolver.HostedMediaFile(url)
    ##########################################
    if hmf:
        url = urlresolver.resolve(url)
    if not hmf:
        url = url
    try:
        params = {'url': url, 'name': media, 'thumb': thumb}
        addon.add_video_item(params, {'title': media}, img=thumb)
        liz = xbmcgui.ListItem(media,
                               iconImage="DefaultFolder.png",
                               thumbnailImage=thumb)
        xbmc.sleep(1000)
        liz.setPath(str(url))
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
        # #xbmc.Player ().play(url, liz, False)
        # movie_name = movie_title[:-6]
        # movie_name = '"'+movie_name+'"'
        # movie_year_full = movie_title[-6:]
        # movie_year = movie_year_full.replace('(','').replace(')','')
        # if kodi.get_setting('trakt_oauth_token'):
        #     xbmc.sleep(30000)
        #     print "Velocity: TV Show Scrobble  Start"
        #     try:
        #         trakt_auth.start_tv_watch(movie_name,media)
        #     except Exception as e:
        #             log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        #             if kodi.get_setting('error_notify') == "true":
        #                 kodi.notify(header='Scrobble not loggged', msg='%s  %s' % (str(e), ''), duration=5000, sound=None)
        # xbmc.sleep(30000)
        # if kodi.get_setting('trakt_oauth_token'):
        #     check_tv_player(movie_name,media)

    except Exception as e:
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        kodi.notify(header='Try Another Source',
                    msg='Link Removed or Failed',
                    duration=4000,
                    sound=None)
Esempio n. 36
0
def putlocker_movies(movie_title):
    try:
        title = movie_title[:-7]
        movie_year = movie_title[-6:]
        year = movie_year.replace('(', '').replace(')', '')
        video_type = 'movies'
        show_url = search(video_type, title, year)
        for e in show_url:
            url = e['url']
            hosters = get_sources(url)
            print "HOSTERS ARE " + str(hosters)
            hosters = main_scrape.apply_urlresolver(hosters)
            return hosters
    except Exception as e:
        hosters = []
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='Putlocker Movies',
                        msg='(error) %s  %s' % (str(e), ''),
                        duration=5000,
                        sound=None)
        return hosters
Esempio n. 37
0
def tmovies(name):

    try:
        sources = []
        searchUrl = base_url+'watch_movie/'
        movie_name = name[:-6]
        movie_name_short = name[:-7]
        movie_year = name[-6:]
        movie_year = movie_year.replace('(','').replace(')','')
        sname = movie_name.replace(" ","+")
        movie_match =movie_name.replace(" ","_").replace(":","").replace("-","")
        year_movie_match = movie_match+movie_year
        direct_movie_match = movie_match[:-1]
        tmurl = base_url+'watch_movie/'+direct_movie_match
        ytmurl = base_url+'watch_movie/'+year_movie_match
        link = OPEN_URLTM(tmurl)
        names = dom_parser.parse_dom(link, 'a',{'class':"norm vlink"})
        urls = dom_parser.parse_dom(link, 'a',{'class':"norm vlink"}, ret='href')
        for host, url in zip(names, urls):
            host = host.replace('www.','')
            #host = tools.get_hostname(host)
            source = {'url': url, 'host':host,'direct':False}
            sources.append(source)
        link = OPEN_URLTM(ytmurl)
        names = dom_parser.parse_dom(link, 'a',{'class':"norm vlink"})
        urls = dom_parser.parse_dom(link, 'a',{'class':"norm vlink"}, ret='href')
        for host, url in zip(names, urls):
            host = host.replace('www.','')
            #host = tools.get_hostname(host)
            source = {'url': url, 'host':host,'direct':False}
            sources.append(source)
        sources = main_scrape.apply_urlresolver(sources)
        return sources
    except Exception as e:
        hosters =[]
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='TwoMovies',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)
        return hosters
Esempio n. 38
0
def find_season(name,trakt_id):

	try:
		media = 'shows'
		movie_title =name
		print "TRAKT ID IS : "+trakt_id
		link = trakt_api.get_show_seasons(trakt_id)
		for e in link:
					infoLabels = trakt_api.process_show(e)
					infoLabels.update(make_infoLabels(e))
					#trakt_id = str(infoLabels['trakt_id'])
					if infoLabels['cover_url'] == None:
						infoLabels['cover_url'] = artwork+'place_poster.png'
					menu_items=[]
					menu_items.append(('[COLOR gold]Show Information[/COLOR]', 'XBMC.Action(Info)'))
					#if kodi.get_setting('trakt_authorized') == 'true':
						#menu_items.append(('[COLOR gold]Mark as Watched[/COLOR]',      'RunPlugin(%s)' % addon.build_plugin_url({'trakt_id':trakt_id, 'mode':'add_watched_history', 'name':name, 'media':media})))
					kodi.addDir('Season '+str(infoLabels['number']),'','find_episode',infoLabels['cover_url'],movie_title,5,trakt_id,'shows',meta_data=infoLabels,menu_items=menu_items,replace_menu=True)
					kodi.auto_view('season')
	except Exception as e:
		log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
		if kodi.get_setting('error_notify') == "true":
			kodi.notify(header='Trakt Seasons',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)
Esempio n. 39
0
def __get_links_from_xml(xml, video):
    sources = {}
    try:
        root = ET.fromstring(xml)
        for item in root.findall('.//item'):
            title = item.find('title').text
            for source in item.findall('{http://rss.jwpcdn.com/}source'):
                stream_url = source.get('file')
                label = source.get('label')
                if _get_direct_hostname(stream_url) == 'gvideo':
                    quality = _gv_get_quality(stream_url)
                elif label:
                    quality = _height_get_quality(label)
                else:
                    quality = _blog_get_quality(video, title, '')
                sources[stream_url] = {'quality': quality, 'direct': True}
                if kodi.get_setting('debug') == "true":
                        kodi.notify(header='ERROR', msg='Adding stream: %s Quality: %s' % (stream_url, quality), duration=5000, sound=None)
    except Exception as e:
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='ERROR', msg='%s  %s' % (str(e), ''), duration=5000, sound=None)

    return sources
Esempio n. 40
0
def find_season(name, trakt_id):

    try:
        media = 'shows'
        movie_title = name
        print "TRAKT ID IS : " + trakt_id
        link = trakt_api.get_show_seasons(trakt_id)
        for e in link:
            infoLabels = trakt_api.process_show(e)
            infoLabels.update(make_infoLabels(e))
            #trakt_id = str(infoLabels['trakt_id'])
            if infoLabels['cover_url'] == None:
                infoLabels['cover_url'] = artwork + 'place_poster.png'
            menu_items = []
            menu_items.append(
                ('[COLOR gold]Show Information[/COLOR]', 'XBMC.Action(Info)'))
            #if kodi.get_setting('trakt_authorized') == 'true':
            #menu_items.append(('[COLOR gold]Mark as Watched[/COLOR]',      'RunPlugin(%s)' % addon.build_plugin_url({'trakt_id':trakt_id, 'mode':'add_watched_history', 'name':name, 'media':media})))
            kodi.addDir('Season ' + str(infoLabels['number']),
                        '',
                        'find_episode',
                        infoLabels['cover_url'],
                        movie_title,
                        5,
                        trakt_id,
                        'shows',
                        meta_data=infoLabels,
                        menu_items=menu_items,
                        replace_menu=True)
            kodi.auto_view('season')
    except Exception as e:
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='Trakt Seasons',
                        msg='(error) %s  %s' % (str(e), ''),
                        duration=5000,
                        sound=None)
Esempio n. 41
0
def getRemoteVersion():
    global remote, remote_version, url, hash
    
    dp = xbmcgui.DialogProgress()
    dp.create('idolpx Installer', 
            'Checking for update...', 
            '', 
            'Please wait...')
    dp.update(100)

    try:
        # Prompt for Device ID if it is not set
        if not kodi.get_setting('deviceid'):
            kb = xbmc.Keyboard('default', 'heading')
            kb.setHeading('Enter your name or something so I know who you are \r\nand will allow you access to updates')
            kb.setDefault('')
            kb.setHiddenInput(False)
            kb.doModal()
            if (kb.isConfirmed()):
                kb_input = kb.getText()
                if (len(kb_input) > 3):
                    kodi.set_setting('deviceid', kb_input)
                    kodi.notify('Device ID set!', '['+kb_input+']')
                else:
                    kodi.notify('Access denied!', 'Device ID not set.')
                    return
            else:
                kodi.notify('Access denied!', 'Device ID not set.')
                return

        params = getParams()
        params['cv'] = current_version
        kodi.debug('Config URL: '+kodi.get_setting('update_url'))
        response = requests.get(kodi.get_setting('update_url'), params=params)
        remote = json.loads(response.text)
        kodi.debug(json.dumps(remote))

        if kodi.get_setting('update_test') != 'true':
            remote_version = remote['config_version']
            url = remote['config_url']
        else:
            remote_version = remote['test_version']
            url = remote['test_url']
        
        response = requests.get(url+'.md5')
        hash = response.text
        kodi.debug('MD5 HASH: '+hash)

    except Exception, e: 
        kodi.debug('getRemoteVersion: '+str(e))
Esempio n. 42
0
def find_sourceTV(name, thumb, media, movie_title):
    q1, q2, q3, q4, q5, q6, q7, q8 = Queue(), Queue(), Queue(), Queue(), Queue(
    ), Queue(), Queue(), Queue()
    try:
        if thumb is None:
            thumb = ''
        else:
            thumb = thumb
        if kodi.get_setting('primewire') == "true":
            Thread(target=tv_wrapper,
                   args=(primewire.primewire_tv, name, movie_title,
                         q2)).start()

        if kodi.get_setting('twomovies') == "true":
            Thread(target=tv_wrapper,
                   args=(twomovies.tmovies_tv, name, movie_title, q3)).start()

        if kodi.get_setting('ice_films') == "true":
            t = Thread(target=tv_wrapper,
                       args=(icefilms.ice_films_tv, name, movie_title, q8))
            t.daemon = True
            t.start()

        # GRAB RETURNS BELOW
        if kodi.get_setting('ice_films') == "true":
            try:
                icesources = q8.get()
                for e in icesources:
                    total_items = len(icesources)
                    if 'debrid' in e:
                        premium = e[
                            'debrid']  #.replace('[','').replace(']','')
                        print str(premium)
                    else:
                        premium = ''
                    names = e['host']
                    urls = e['url']
                    urls = icefilms.resolve_link(urls)
                    views = e['views']
                    if e['quality'] == None:
                        quals = 'unknown'
                    else:
                        quals = e['quality']
                    menu_items = []
                    #menu_items.append(('[COLOR gold]Add to Downloads[/COLOR]',      'XBMC.Container.Update(%s)' % addon.build_plugin_url({'mode':'setup_download', 'name':name,'url':urls,'thumb':thumb, 'media':media,'movie_title':movie_title})))
                    kodi.addDir("[COLORteal][IceFilms][/COLOR] - " + names +
                                ' [' + quals + ']' + ' [COLOR gold]' +
                                str(premium) + '[/COLOR]',
                                urls,
                                'get_tv_link',
                                thumb,
                                movie_title,
                                total_items,
                                '',
                                name,
                                menu_items=menu_items,
                                is_playable='true',
                                fanart=fanart)
            except Exception as e:
                log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
                if kodi.get_setting('error_notify') == "true":
                    kodi.notify(header='Ice Films',
                                msg='(error) %s  %s' % (str(e), ''),
                                duration=5000,
                                sound=None)

        if kodi.get_setting('primewire') == "true":
            primesources = q2.get()
            for e in primesources:
                total_items = len(primesources)
                if 'debrid' in e:
                    premium = e['debrid']
                    print str(premium)
                else:
                    premium = ''
                names = e['host']
                urls = e['url']
                views = e['view']
                quals = e['quality']
                menu_items = []
                #menu_items.append(('[COLOR gold]Add to Downloads[/COLOR]',      'XBMC.Container.Update(%s)' % addon.build_plugin_url({'mode':'setup_download', 'name':name,'url':urls,'thumb':thumb, 'media':media,'movie_title':movie_title})))
                kodi.addDir("[COLORteal][Primewire][/COLOR] - " + names +
                            ' [' + quals + ']' + ' Views ' + views +
                            ' [COLOR gold]' + str(premium) + '[/COLOR]',
                            urls,
                            'get_tv_link',
                            thumb,
                            movie_title,
                            total_items,
                            '',
                            name,
                            menu_items=menu_items,
                            is_playable='true',
                            fanart=fanart)

        if kodi.get_setting('twomovies') == "true":
            tmsources = q3.get()
            for e in tmsources:
                total_items = len(tmsources)
                if 'debrid' in e:
                    premium = e['debrid']
                    print str(premium)
                else:
                    premium = ''
                names = e['host']
                urls = e['url']
                menu_items = []
                #menu_items.append(('[COLOR gold]Add to Downloads[/COLOR]',      'XBMC.Container.Update(%s)' % addon.build_plugin_url({'mode':'setup_download', 'name':name,'url':urls,'thumb':thumb, 'media':media,'movie_title':movie_title})))
                kodi.addDir(
                    "[COLORteal][TwoMovies-TV][/COLOR] - " + names +
                    ' [COLOR gold]' + str(premium) + '[/COLOR]',
                    urls,
                    'tmlinkpage',
                    thumb,
                    movie_title,
                    total_items,
                    '',
                    name,
                    menu_items=menu_items,
                    is_playable='true',
                    fanart=fanart
                )  # MUST BE EPISODE NAME IN PLACE OF MEDIA TYPE HERE
        # AFDAH SCRAPE
        # TODO Add TV
        if kodi.get_setting('afdah') == "true":
            print "AFDAH TV not setup yet"

        # TODO Add Mer TV Scrapers
        if kodi.get_setting('merdb') == "true":
            print "MerDb TV Not Setup Yet"

        # TODO Add ZMovies TV Scrapers
        if kodi.get_setting('zmovies') == "true":
            print "ZMovies TV Not setup yet"

    except Exception as e:
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='Scraper',
                        msg='(error) %s  %s' % (str(e), ''),
                        duration=5000,
                        sound=None)
Esempio n. 43
0
def find_episode(name, trakt_id, movie_title):

    try:
        media = 'episode'
        season = name.replace('Season ', '')
        #print "SHOW TRAKT IS : "+trakt_id
        link = trakt_api.get_show_episodes(trakt_id, season)
        for e in link:
            ep_trakt_id = e['ids']['trakt']
            #print "Episode TRAKT ID IS  : "+str(ep_trakt_id)
            infoLabels = {}
            infoLabels.update(make_infoLabels(e))
            episode = infoLabels['episode']
            infoLabels = trakt_api.get_episode_details(trakt_id, season,
                                                       episode)
            menu_items = []
            trailer = infoLabels['trailer_url']
            year = str(infoLabels['year'])
            name = infoLabels['title'].encode('utf-8')
            thumb = infoLabels['cover_url']
            # ################
            was_watched = watched_cache.get_watched_cache(ep_trakt_id)
            if was_watched is not None:
                infoLabels['playcount'] = 1
            # ################
            if thumb is None:
                thumb = ''
            #print infoLabels['premiered'][:10]
            #if (episode['first_aired'] != None and utils2.iso_2_utc(episode['first_aired']) <= time.time()) or (include_unknown and episode['first_aired'] == None):
            d1 = str(infoLabels['premiered'])
            d2 = str(datetime.date.today())
            #print today - was_aired
            #if infoLabels['premiered'] =='':
            if d1 >= d2 or infoLabels['premiered'] == '':
                if name is not '':
                    menu_items.append(('[COLOR gold]Show Information[/COLOR]',
                                       'XBMC.Action(Info)'))
                    kodi.addDir('[COLOR maroon]S' + str(season) + 'E' +
                                str(episode) + '  ' + name + '[/COLOR]',
                                '',
                                'findsource',
                                thumb,
                                movie_title,
                                5,
                                '',
                                'shows',
                                meta_data=infoLabels,
                                menu_items=menu_items,
                                replace_menu=True)
                    #name = name+" [COLOR red]Coming Soon[/COLOR]"
            else:
                menu_items.append(('[COLOR gold]Show Information[/COLOR]',
                                   'XBMC.Action(Info)'))
                kodi.addDir('S' + str(season) + 'E' + str(episode) + '  ' +
                            name,
                            '',
                            'findsource',
                            thumb,
                            movie_title,
                            5,
                            '',
                            'shows',
                            meta_data=infoLabels,
                            menu_items=menu_items,
                            replace_menu=True)
            kodi.auto_view('episode')
    except Exception as e:
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='Trakt Episodes',
                        msg='(error) %s  %s' % (str(e), ''),
                        duration=5000,
                        sound=None)
Esempio n. 44
0
def primewire(name):
    try:
        sources = []
        searchUrl = base_url + 'index.php?search_keywords='
        movie_name = name[:-6]
        movie_name_short = name[:-7]
        movie_year_full = name[-6:]
        movie_year = movie_year_full.replace('(', '').replace(')', '')
        sname = movie_name.replace(" ", "+")
        primename = sname[:-1]
        movie_match = movie_name.replace(" ", "_") + movie_year
        surl = searchUrl + primename
        link = OPEN_URL(surl)
        full_match = movie_name + movie_year_full
        match = re.compile('<a href="/(.+?)" title="Watch (.+?)">').findall(
            link)
        for url, name in match:
            if full_match == name:
                link = OPEN_URL(base_url + url)
                container_pattern = r'<table[^>]+class="movie_version[ "][^>]*>(.*?)</table>'
                item_pattern = (
                    r'quality_(?!sponsored|unknown)([^>]*)></span>.*?'
                    r'url=([^&]+)&(?:amp;)?domain=([^&]+)&(?:amp;)?(.*?)'
                    r'"version_veiws"> ([\d]+) views</')
                max_index = 0
                max_views = -1
                for container in re.finditer(container_pattern, link,
                                             re.DOTALL | re.IGNORECASE):
                    for i, source in enumerate(
                            re.finditer(item_pattern, container.group(1),
                                        re.DOTALL)):
                        qual, url, host, parts, views = source.groups()
                        if kodi.get_setting('debug') == "true":
                            print "PrimeWire Debug:"
                            print "Quality is " + qual
                            print "URL IS " + url.decode('base-64')
                            print "HOST IS  " + host.decode('base-64')
                            print "VIEWS ARE " + views
                        if host == 'ZnJhbWVndGZv':
                            continue  # filter out promo hosts
                        #host = tools.get_hostname(host.decode('base-64'))
                        source = {
                            'url': url.decode('base-64'),
                            'host': host.decode('base-64'),
                            'view': views,
                            'quality': qual,
                            'direct': False
                        }
                        sources.append(source)
        #print "MOVIE SOURCES ARE = "+str(sources)
        sources = main_scrape.apply_urlresolver(sources)
        return sources
    except Exception as e:
        hosters = []
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='PrimeWire',
                        msg='(error) %s  %s' % (str(e), ''),
                        duration=5000,
                        sound=None)
        return hosters
Esempio n. 45
0
    def __init__(self,
                 addon_id,
                 url,
                 full_name,
                 destination,
                 master=False,
                 quiet=False):
        self.quiet = quiet
        if not self.quiet: kodi.open_busy_dialog()
        v = kodi.get_kodi_version()

        # Grab a list of KNOWN addons from the database. Unfortunately Jarvis requires direct database access for the installed flag
        if v >= 17:
            response = kodi.kodi_json_request(
                "Addons.GetAddons", {
                    "installed": False,
                    "properties": ["path", "dependencies"]
                })
            for a in response['result']['addons']:
                self.available_addons += [a['addonid']]
                self.source_table[a['addonid']] = a['path']
        else:
            from sqlite3 import dbapi2
            dbf = kodi.vfs.join("special://profile/Database", "Addons20.db")
            with dbapi2.connect(dbf) as dbh:
                dbc = dbh.cursor()
                dbc.execute(
                    "SELECT addon.addonID, broken.addonID is Null AS enabled, addon.path FROM addon LEFT JOIN broken on addon.addonID=broken.addonID WHERE enabled=1"
                )
                for a in dbc.fetchall():
                    self.available_addons += [a[0]]
                    self.source_table[a[0]] = a[2]
            dbh.close()
        self._addon_id = addon_id
        self._url = url
        self._full_name = full_name
        self._user, self.repo = full_name.split("/")
        self._master = master
        self._destination = destination

        # Add the final addon target to the sources list with type of zip
        # Initiate install routine
        self.install_addon(addon_id, url, full_name, master)

        completed = list(reversed(self.completed))
        if not quiet:
            pb = kodi.ProgressBar()
            pb.new('Enabling Addons', len(completed) + 1)
            pb.update_subheading('Building Addon List')
        kodi.run_command("XBMC.UpdateLocalAddons()")
        kodi.sleep(500)
        for addon_id in completed:
            if not quiet:
                #percent = 100* (completed.index(addon_id) / len(completed))
                #pb.update(percent, "Enabling Addons", addon_id, '')
                pb.next(addon_id)
                kodi.sleep(100)
            self.enable_addon(addon_id)

        if not quiet: pb.next("Looking for Updates", "")
        kodi.sleep(500)
        kodi.run_command('XBMC.UpdateAddonRepos')

        # Enable installed addons
        if not self.quiet:
            pb.close()
            kodi.close_busy_dialog()
            if self.install_error:
                kodi.notify("Install failed", self._addon_id)
            else:
                kodi.notify("Install complete", self._addon_id)
Esempio n. 46
0
def find_sourceTV(name,thumb,media,movie_title):
    q1, q2, q3, q4, q5, q6, q7, q8 = Queue(), Queue(), Queue(),Queue(), Queue(), Queue(), Queue(), Queue()
    try:
        if thumb is None:
            thumb = ''
        else:
            thumb = thumb
        if kodi.get_setting('primewire') == "true":
                Thread(target=tv_wrapper, args=(primewire.primewire_tv, name,movie_title, q2)).start()


        # if kodi.get_setting('twomovies') == "true":
        #         Thread(target=tv_wrapper, args=(twomovies.tmovies_tv, name,movie_title, q3)).start()

        if kodi.get_setting('ice_films') == "true":
                t = Thread(target=tv_wrapper, args=(icefilms.ice_films_tv, name,movie_title, q8))
                t.daemon = True
                t.start()

        if kodi.get_setting('santa_tv') == "true":
                t = Thread(target=tv_wrapper, args=(santa_tv.santa_tv, name,movie_title, q1))
                t.daemon = True
                t.start()


        if kodi.get_setting('putlocker') == "true":
                t = Thread(target=tv_wrapper, args=(putlocker_both.putlocker_tv, name,movie_title, q4))
                t.daemon = True
                t.start()

        # GRAB RETURNS BELOW
        if kodi.get_setting('putlocker') == "true":
                try:
                    putlockersources = q4.get()
                    for e in putlockersources:
                        total_items =len(putlockersources)
                        if 'debrid' in e:
                            premium = e['debrid']#.replace('[','').replace(']','')
                            print str(premium)
                        else:
                            premium = ''
                        names = e['host']
                        urls = e['url']
                        #views = e['views']
                        #label = e['label']
                        if e['quality'] == None:
                            quals = 'unknown'
                        else:quals = e['quality']
                        menu_items=[]
                        menu_items.append(('[COLOR gold]Add to Downloads[/COLOR]',      'XBMC.Container.Update(%s)' % addon.build_plugin_url({'mode':'setup_download', 'name':name,'url':urls,'thumb':thumb, 'media':media,'movie_title':movie_title})))
                        kodi.addDir("[COLORteal][Putlocker][/COLOR] - "+names+' ['+quals+']  [COLOR gold]'+str(premium)+'[/COLOR]',urls,'get_tv_link',thumb,movie_title,total_items,'',name,menu_items=menu_items,is_playable='true',fanart=fanart)
                except Exception as e:
                    log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
                    if kodi.get_setting('error_notify') == "true":
                        kodi.notify(header='Putlocker',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)



        if kodi.get_setting('santa_tv') == "true":
                try:
                    santasources = q1.get()
                    for e in santasources:
                        total_items =len(santasources)
                        if 'debrid' in e:
                            premium = e['debrid']#.replace('[','').replace(']','')
                            print str(premium)
                        else:
                            premium = ''
                        names = e['host']
                        urls = e['url']
                        # urls = icefilms.resolve_link(urls)
                        #views = e['views']
                        label = e['label']
                        if e['quality'] == None:
                            quals = 'unknown'
                        else:quals = e['quality']
                        menu_items=[]
                        menu_items.append(('[COLOR gold]Add to Downloads[/COLOR]',      'XBMC.Container.Update(%s)' % addon.build_plugin_url({'mode':'setup_download', 'name':name,'url':urls,'thumb':thumb, 'media':media,'movie_title':movie_title})))
                        kodi.addDir("[COLORteal][SantaSeries][/COLOR] - "+names+' ['+quals+'] '+label+' [COLOR gold]'+str(premium)+'[/COLOR]',urls,'get_tv_link',thumb,movie_title,total_items,'',name,menu_items=menu_items,is_playable='true',fanart=fanart)
                except Exception as e:
                    log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
                    if kodi.get_setting('error_notify') == "true":
                        kodi.notify(header='SantaSeries',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)

        if kodi.get_setting('ice_films') == "true":
                try:
                    icesources = q8.get()
                    for e in icesources:
                        total_items =len(icesources)
                        if 'debrid' in e:
                            premium = e['debrid']#.replace('[','').replace(']','')
                            print str(premium)
                        else:
                            premium = ''
                        names = e['host']
                        urls = e['url']
                        urls = icefilms.resolve_link(urls)
                        views = e['views']
                        if e['quality'] == None:
                            quals = 'unknown'
                        else:quals = e['quality']
                        menu_items=[]
                        menu_items.append(('[COLOR gold]Add to Downloads[/COLOR]',      'XBMC.Container.Update(%s)' % addon.build_plugin_url({'mode':'setup_download', 'name':name,'url':urls,'thumb':thumb, 'media':media,'movie_title':movie_title})))
                        kodi.addDir("[COLORteal][IceFilms][/COLOR] - "+names+' ['+quals+']'+' [COLOR gold]'+str(premium)+'[/COLOR]',urls,'get_tv_link',thumb,movie_title,total_items,'',name,menu_items=menu_items,is_playable='true',fanart=fanart)
                except Exception as e:
                    log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
                    if kodi.get_setting('error_notify') == "true":
                        kodi.notify(header='Ice Films',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)


        if kodi.get_setting('primewire') == "true":
                primesources = q2.get()
                for e in primesources:
                        total_items =len(primesources)
                        if 'debrid' in e:
                            premium = e['debrid']
                            print str(premium)
                        else:
                            premium = ''
                        names = e['host']
                        urls = e['url']
                        views = e['view']
                        quals = e['quality']
                        menu_items=[]
                        menu_items.append(('[COLOR gold]Add to Downloads[/COLOR]',      'XBMC.Container.Update(%s)' % addon.build_plugin_url({'mode':'setup_download', 'name':name,'url':urls,'thumb':thumb, 'media':media,'movie_title':movie_title})))
                        kodi.addDir("[COLORteal][Primewire][/COLOR] - "+names+' ['+quals+']'+' Views '+views+' [COLOR gold]'+str(premium)+'[/COLOR]',urls,'get_tv_link',thumb,movie_title,total_items,'',name,menu_items=menu_items,is_playable='true',fanart=fanart)

        # if kodi.get_setting('twomovies') == "true":
        #         tmsources = q3.get()
        #         for e in tmsources:
        #                 total_items =len(tmsources)
        #                 if 'debrid' in e:
        #                     premium = e['debrid']
        #                     print str(premium)
        #                 else:
        #                     premium = ''
        #                 names = e['host']
        #                 urls = e['url']
        #                 menu_items=[]
        #                 menu_items.append(('[COLOR gold]Add to Downloads[/COLOR]',      'XBMC.Container.Update(%s)' % addon.build_plugin_url({'mode':'setup_download', 'name':name,'url':urls,'thumb':thumb, 'media':media,'movie_title':movie_title})))
        #                 kodi.addDir("[COLORteal][TwoMovies-TV][/COLOR] - "+names+' [COLOR gold]'+str(premium)+'[/COLOR]',urls,'tmlinkpage',thumb,movie_title,total_items,'',name,menu_items=menu_items,is_playable='true',fanart=fanart)# MUST BE EPISODE NAME IN PLACE OF MEDIA TYPE HERE
        # # AFDAH SCRAPE
        # TODO Add TV
        if kodi.get_setting('afdah') == "true":
            print "AFDAH TV not setup yet"

        # TODO Add Mer TV Scrapers
        if kodi.get_setting('merdb') == "true":
            print "MerDb TV Not Setup Yet"


        # TODO Add ZMovies TV Scrapers
        if kodi.get_setting('zmovies') == "true":
            print "ZMovies TV Not setup yet"

    except Exception as e:
            log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
            if kodi.get_setting('error_notify') == "true":
                kodi.notify(header='Scraper',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)
Esempio n. 47
0
def find_source(name, thumb, media, movie_title):

    if media == 'shows':
        find_sourceTV(name, thumb, media, movie_title)
    else:
        try:
            if thumb is None:
                thumb = ''
            else:
                thumb = thumb

            title = name[:-7]
            movie_year = name[-6:]
            year = movie_year.replace('(', '').replace(')', '')
            video_type = 'movies'
            total_items = 0

            t1 = Thread(target=go_ice, args=(video_type, title, year))
            #############PRIMEWIRE########################
            t2 = Thread(target=go_prime, args=(video_type, title, year))
            ##############IWATCH COMPLETE####################
            t3 = Thread(target=go_iwatch, args=(video_type, title, year))
            #############AFDAH COMPLETE##################
            t4 = Thread(target=go_afdah, args=(video_type, title, year))
            ############PUTLOCKER COMPLETE##################
            t5 = Thread(target=go_putlocker, args=(video_type, title, year))

            t1.start()
            t2.start()
            t3.start()
            t4.start()
            t5.start()

            t1.join()
            t2.join()
            t3.join()
            t4.join()
            t5.join()

            for a in all_source:
                if a:
                    b = sorted(a, reverse=False)
                    try:
                        for e in b:
                            #total_items =len(e)
                            #kodi.log(total_items)
                            if 'debrid' in e:
                                premium = " [COLOR gold]" + str(
                                    e['debrid']) + " [/COLOR]"
                            else:
                                premium = ''
                            hostname = e['hostname']
                            provider = "[COLOR white][" + hostname + "][/COLOR] - "
                            names = e['host']
                            urls = e['url']
                            if e['views'] == None:
                                views = ''
                            else:
                                views = " [COLOR green]Views " + e[
                                    'views'] + "[/COLOR]"
                            if e['quality'] == None:
                                quals = ''
                            else:
                                quals = " [COLOR red][" + e[
                                    'quality'] + "][/COLOR]"
                            menu_items = []
                            menu_items.append(
                                ('[COLOR gold]Add to Downloads[/COLOR]',
                                 'XBMC.Container.Update(%s)' %
                                 addon.build_plugin_url(
                                     {
                                         'mode': 'setup_download',
                                         'name': name,
                                         'url': urls,
                                         'thumb': thumb,
                                         'media': media,
                                         'movie_title': movie_title
                                     })))

                            #TODO Make Dialog Selections
                            # passname = []
                            # pro_list = {'proname': provider + names + quals + views + premium, 'url': urls,'movie_title':movie_title,'thumb':thumb,'media':media }
                            #
                            # passname.append(pro_list)
                            # pick_list(passname)

                            kodi.addDir(provider + names + quals + views +
                                        premium,
                                        urls,
                                        'get_link',
                                        thumb,
                                        movie_title + movie_year,
                                        total_items,
                                        '',
                                        'movies',
                                        menu_items=menu_items,
                                        is_playable='true',
                                        fanart=fanart)
                            viewsetter.set_view('files')
                    except:
                        pass

        except Exception as e:
            log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
            if kodi.get_setting('error_notify') == "true":
                kodi.notify(header='Movie Scrapers',
                            msg='(error) %s  %s' % (str(e), ''),
                            duration=5000,
                            sound=None)
            return
Esempio n. 48
0
def showAdult(status, pin='0'):
    global window

    if status == None:
        status = window.getProperty('idolpx.installer.adultstatus')

    if status == 'true':
        # Enable Adult Addons
        if pin == '0':
            pin = xbmcgui.Dialog().numeric(0,'Enter PIN')

        if pin == kodi.get_setting('adultpin'):
            status = 'true'
        else:
            status = 'abort'
    else:
        # Disable Adult Addons
        status = 'false'

    kodi.debug('Adult Addons Enabled: ' + status)
    if status != 'abort':
        window.setProperty('idolpx.installer.adultstatus', status)
        
        addonPath = xbmc.translatePath(os.path.join('special://home', 'addons'))
        resourcePath = os.path.join(addonPath, kodi.addon_id(), 'resources')
        nsfw_addons = os.path.join(resourcePath, 'nsfw_addons.dat')
        with open(nsfw_addons, 'r') as myfile:
            addons = myfile.read().split('\n')

        for addon in addons:
            try:
                # Move Addon
                if status == 'true':
                    shutil.move(os.path.join(resourcePath, addon), os.path.join(addonPath, addon))
                    #kodi.update_enabled(addon, 1)
                else:
                    shutil.move(os.path.join(addonPath, addon), os.path.join(resourcePath, addon))
                    #kodi.update_enabled(addon, 0)

                # Enable/Disable Addon
                query = '{"jsonrpc":"2.0", "id":1, "method":"Addons.SetAddonEnabled","params":{"addonid":"%s", "enabled":%s}}' % (addon, status)
                kodi.execute_jsonrpc(query)
                kodi.debug(query)
                xbmc.sleep(200)

            except:
                pass

        kodi.execute('UpdateLocalAddons()')
        kodi.execute('UpdateAddonRepos()')
        #xbmc.sleep(1000)
        #kodi.execute('ReloadSkin()')
        
        kodi.set_setting('adultstatus', status)         
        
        if status == 'true': 
            kodi.notify('Adult Addons','Enabled!')
        else: 
            kodi.notify('Adult Addons', 'Disabled!')
       
    else:
        kodi.notify('Adult Addons', 'Invalid PIN!')
Esempio n. 49
0
def main():
    dp = xbmcgui.DialogProgress()
    dp.create('idolpx Installer', 'Checking for update...', '',
              'Please wait...')
    dp.update(100)

    # Get Current Version
    update_file = xbmc.translatePath(os.path.join('special://',
                                                  'home')) + 'update.zip'

    current = json.loads(
        '{"config_version": "00000000","test_version": "00000000"}')
    path = xbmc.translatePath(os.path.join('special://', 'userdata'))
    version_file = path + 'version.json'
    try:
        current = json.load(open(version_file))
    except:
        pass

    # Get Remote Settings
    try:
        # Prompt for Device ID if it is not set
        if not kodi.get_setting('deviceid'):
            kb = xbmc.Keyboard('default', 'heading')
            kb.setHeading(
                'Enter your name or something so I know who you are \r\nand will allow you access to updates'
            )
            kb.setDefault('')
            kb.setHiddenInput(False)
            kb.doModal()
            if (kb.isConfirmed()):
                kb_input = kb.getText()
                if (len(kb_input) > 3):
                    kodi.set_setting('deviceid', kb_input)
                    kodi.notify('Device ID set!', '[' + kb_input + ']')
                else:
                    kodi.notify('Access denied!', 'Device ID not set.')
                    return
            else:
                kodi.notify('Access denied!', 'Device ID not set.')
                return

        # Prompt for Configuration Update
        if kodi.get_setting('update_test') != 'true':
            current_version = current['config_version']
        else:
            current_version = current['test_version']

        params = {
            'd': kodi.getInfoLabel('Network.MacAddress'),
            'os': kodi.getInfoLabel('System.OSVersionInfo'),
            'id': kodi.get_setting('deviceid'),
            'kv': kodi.get_version()
        }

        params['cv'] = current_version
        kodi.log('Config URL: ' + kodi.get_setting('update_url'))
        response = requests.get(kodi.get_setting('update_url'), params=params)
        remote = json.loads(response.text)
        kodi.log(json.dumps(remote))
        dp.close()

        if kodi.get_setting('update_test') != 'true':
            remote_version = remote['config_version']
            url = remote['config_url']
            hash = remote['config_md5']
        else:
            remote_version = remote['test_version']
            url = remote['test_url']
            hash = remote['test_md5']

        # Prompt for Kodi Update
        if kodi.get_setting('update_kodi') == 'true':
            if kodi.platform(
            ) == 'android' and remote['kodi_version'] != kodi.get_version():
                choice = xbmcgui.Dialog().yesno(
                    'idolpx Installer', 'A new version of Kodi is available!',
                    'Current version is [B]' + kodi.get_version() +
                    '[/B].[CR]', 'Would you like to install version [B]' +
                    remote['kodi_version'] + '[/B]?')
                if choice == 1:
                    installer.installAPK(remote['kodi_url'])

        kodi.log('Update File: ' + update_file)
        if os.path.exists(update_file):
            url = '/update.zip'
            hash = ''
            choice = xbmcgui.Dialog().yesno(
                'idolpx Installer', 'An update file exists!', '',
                'Would you like to install this update?')
        else:
            if remote_version != current_version:
                choice = xbmcgui.Dialog().yesno(
                    'idolpx Installer', 'A new configuration is available!',
                    'Current version is [B]' + current_version + '[/B].[CR]',
                    'Would you like to install version [COLOR green][B]' +
                    remote_version + '[/B][/COLOR]?')
            else:
                choice = xbmcgui.Dialog().yesno(
                    'idolpx Installer',
                    'Current version is [B]' + current_version + '[/B].[CR]',
                    'Would you like to reinstall version [B]' +
                    remote_version + '[/B]?')

        if choice == 1:
            # Give service enough time to stop downloading
            time.sleep(3)

            if installer.installConfig(url, hash):

                # Save Installed Version to file
                with open(version_file, "w") as outfile:
                    json.dump(remote, outfile)

                choice = xbmcgui.Dialog().yesno(
                    'idolpx Installer',
                    'A restart is required. Would you like to restart Kodi now?'
                )
                if choice == 1:
                    kodi.kill()

                xbmcgui.Dialog().ok('idolpx Installer',
                                    'Update checks complete!')
            else:

                xbmcgui.Dialog().ok('idolpx Installer', 'Update canelled!')

    except Exception, e:
        kodi.log(str(e))
Esempio n. 50
0
def find_source(name,thumb,media,movie_title):
    try:
        all_source = []

        q1, q2, q3, q4, q5, q6, q7, q8, q9 = Queue(), Queue(), Queue(),Queue(), Queue(), Queue(), Queue(), Queue(),Queue()

        if thumb is None:
            thumb = ''
        else:
            thumb = thumb
        if media == 'shows':
            find_sourceTV(name,thumb,media,movie_title)
        else:
            # if kodi.get_setting('9movies') == "true":
            #     movie_title = name
            #     Thread(target=wrapper, args=(nine_movies.ninemovies, name, q1)).start()

            if kodi.get_setting('primewire') == "true":
                movie_title = name
                Thread(target=wrapper, args=(primewire.primewire, name, q2)).start()

            # if kodi.get_setting('afdah') =='true':
            #     movie_title = name
            #     Thread(target=wrapper, args=(afdah.afdah, name, q4)).start()

            if kodi.get_setting('merdb') == "true":
                movie_title = name
                Thread(target=wrapper, args=(merdb.merdb, name, q5)).start()

            if kodi.get_setting('zmovies') == "true":
                movie_title = name
                Thread(target=wrapper, args=(zmovies.zmovies, name, q6)).start()

            if kodi.get_setting('123movies') == "true":
                movie_title = name
                Thread(target=wrapper, args=(ot3_movies.ot3_movies, name, q7)).start()

            if kodi.get_setting('ice_films') == "true":
                movie_title = name
                t = Thread(target=wrapper, args=(icefilms.ice_films, name, q8))
                t.daemon = True
                t.start()

            if kodi.get_setting('putlocker') == "true":
                movie_title = name
                t = Thread(target=wrapper, args=(putlocker_both.putlocker_movies, name, q9))
                t.daemon = True
                t.start()

######Grab Results
######TRY TO SORT ALL TOGETHER


            if kodi.get_setting('ice_films') == "true":
                icesources = q8.get()
                all_source.append(icesources)

            if kodi.get_setting('putlocker') == "true":
                putlockersources = q9.get()
                all_source.append(putlockersources)

            # if kodi.get_setting('9movies') == "true":
            #     ninesources = q1.get()
            #     all_source.append(ninesources)

            if kodi.get_setting('123movies') == "true":
                ottsources = q7.get()
                all_source.append(ottsources)

            if kodi.get_setting('primewire') == "true":
                primesources = q2.get()
                all_source.append(primesources)

            # if kodi.get_setting('afdah') =='true':
            #     afdahsources = q4.get()
            #     all_source.append(afdahsources)

            if kodi.get_setting('merdb') == "true":
                mersources = q5.get()
                all_source.append(mersources)

            if kodi.get_setting('zmovies') == "true":
                zmoviesources =q6.get()
                all_source.append(zmoviesources)

            for a in all_source:
                    if a:
                        #b = sorted(a, key=lambda k: (str(k['debrid'])))
                        b = sorted(a, reverse=False)
                        #b.sort(reverse=True)
                        # log_utils.log('TESTING 2 [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
                        try:
                            for e in b :
                                # log_utils.log('TESTING 3 [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
                                total_items =len(e)
                                if 'debrid' in e:
                                    premium = " [COLOR gold]"+str(e['debrid'])+" [/COLOR]"
                                else:
                                    premium = ''
                                hostname = e['hostname']
                                provider = "[COLOR white]["+hostname+"][/COLOR] - "
                                names = e['host']
                                urls = e['url']
                                if e['views'] == None:
                                    views = ''
                                else:
                                    views = " [COLOR green]Views "+e['views']+"[/COLOR]"
                                if e['quality'] == None:
                                    quals = ''
                                else:quals =" [COLOR red]["+ e['quality']+"][/COLOR]"
                                menu_items=[]
                                menu_items.append(('[COLOR gold]Add to Downloads[/COLOR]',      'XBMC.Container.Update(%s)' % addon.build_plugin_url({'mode':'setup_download', 'name':name,'url':urls,'thumb':thumb, 'media':media,'movie_title':movie_title})))
                                #kodi.addDir("[COLORteal]["+hostname+"][/COLOR] - "+names+' ['+quals+']'+' [COLOR gold]'+str(premium)+'[/COLOR]',urls,'get_link',thumb,movie_title,total_items,'','movies',menu_items=menu_items,is_playable='true',fanart=fanart)
                                kodi.addDir(provider+names+quals+views+premium,urls,'get_link',thumb,movie_title,total_items,'','movies',menu_items=menu_items,is_playable='true',fanart=fanart)

                        except:
                            pass




    except Exception as e:
            log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
            if kodi.get_setting('error_notify') == "true":
                kodi.notify(header='Movie Scrapers',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)
            return
Esempio n. 51
0
def find_source(name, thumb, media, movie_title):

    try:
        q1, q2, q3, q4, q5, q6, q7, q8 = Queue(), Queue(), Queue(), Queue(
        ), Queue(), Queue(), Queue(), Queue()

        if thumb is None:
            thumb = ''
        else:
            thumb = thumb
        if media == 'shows':
            find_sourceTV(name, thumb, media, movie_title)
        else:
            if kodi.get_setting('9movies') == "true":
                movie_title = name
                t = Thread(target=wrapper,
                           args=(nine_movies.ninemovies, name, q1))
                t.daemon = True
                t.start()

            if kodi.get_setting('primewire') == "true":
                movie_title = name
                Thread(target=wrapper,
                       args=(primewire.primewire, name, q2)).start()

            if kodi.get_setting('twomovies') == "true":
                movie_title = name
                Thread(target=wrapper,
                       args=(twomovies.tmovies, name, q3)).start()

            if kodi.get_setting('afdah') == 'true':
                movie_title = name
                Thread(target=wrapper, args=(afdah.afdah, name, q4)).start()

            if kodi.get_setting('merdb') == "true":
                movie_title = name
                Thread(target=wrapper, args=(merdb.merdb, name, q5)).start()

            if kodi.get_setting('zmovies') == "true":
                movie_title = name
                Thread(target=wrapper,
                       args=(zmovies.zmovies, name, q6)).start()

            if kodi.get_setting('123movies') == "true":
                movie_title = name
                Thread(target=wrapper,
                       args=(zmovies.zmovies, name, q7)).start()

            if kodi.get_setting('ice_films') == "true":
                movie_title = name
                t = Thread(target=wrapper, args=(icefilms.ice_films, name, q8))
                t.daemon = True
                t.start()

            if kodi.get_setting('ice_films') == "true":
                try:
                    icesources = q8.get()
                    for e in icesources:
                        total_items = len(icesources)
                        if 'debrid' in e:
                            premium = e['debrid']
                        else:
                            premium = ''
                        names = e['host']
                        urls = e['url']
                        urls = icefilms.resolve_link(urls)
                        views = e['views']
                        if e['quality'] == None:
                            quals = 'unknown'
                        else:
                            quals = e['quality']
                        menu_items = []
                        #menu_items.append(('[COLOR gold]Add to Downloads[/COLOR]',      'XBMC.Container.Update(%s)' % addon.build_plugin_url({'mode':'setup_download', 'name':name,'url':urls,'thumb':thumb, 'media':media,'movie_title':movie_title})))
                        kodi.addDir("[COLORteal][IceFilms][/COLOR] - " +
                                    names + ' [' + quals + ']' +
                                    ' [COLOR gold]' + str(premium) +
                                    '[/COLOR]',
                                    urls,
                                    'get_link',
                                    thumb,
                                    movie_title,
                                    total_items,
                                    '',
                                    'movies',
                                    menu_items=menu_items,
                                    is_playable='true',
                                    fanart=fanart)
                except Exception as e:
                    log_utils.log('Error [%s]  %s' % (str(e), ''),
                                  xbmc.LOGERROR)
                    if kodi.get_setting('error_notify') == "true":
                        kodi.notify(header='Scraper',
                                    msg='(error) %s  %s' % (str(e), ''),
                                    duration=5000,
                                    sound=None)

            if kodi.get_setting('9movies') == "true":
                try:
                    ninesources = q1.get()
                    for e in ninesources:
                        total_items = len(ninesources)
                        if 'debrid' in e:
                            premium = e['debrid']
                        else:
                            premium = ''
                        names = e['host']
                        urls = e['url']
                        views = e['view']
                        quals = e['quality']
                        menu_items = []
                        #menu_items.append(('[COLOR gold]Add to Downloads[/COLOR]',      'XBMC.Container.Update(%s)' % addon.build_plugin_url({'mode':'setup_download', 'name':name,'url':urls,'thumb':thumb, 'media':media,'movie_title':movie_title})))
                        kodi.addDir("[COLORteal][9Movies][/COLOR] - " + names +
                                    ' [' + quals + ']' + ' [COLOR gold]' +
                                    str(premium) + '[/COLOR]',
                                    urls,
                                    'get_link',
                                    thumb,
                                    movie_title,
                                    total_items,
                                    '',
                                    'movies',
                                    menu_items=menu_items,
                                    is_playable='true',
                                    fanart=fanart)
                except Exception as e:
                    log_utils.log('Error [%s]  %s' % (str(e), ''),
                                  xbmc.LOGERROR)
                    if kodi.get_setting('error_notify') == "true":
                        kodi.notify(header='Scraper',
                                    msg='(error) %s  %s' % (str(e), ''),
                                    duration=5000,
                                    sound=None)

            if kodi.get_setting('123movies') == "true":
                ottsources = q7.get()
                for e in ottsources:
                    total_items = len(ottsources)
                    if 'debrid' in e:
                        premium = e['debrid']
                    else:
                        premium = ''
                    names = e['host']
                    urls = e['url']
                    try:
                        quals = e['quality']
                    except:
                        quals = 'unknown'
                    menu_items = []
                    #menu_items.append(('[COLOR gold]Add to Downloads[/COLOR]',      'XBMC.Container.Update(%s)' % addon.build_plugin_url({'mode':'setup_download', 'name':name,'url':urls,'thumb':thumb, 'media':media,'movie_title':movie_title})))
                    kodi.addDir("[COLORteal][123Movies][/COLOR] - " + names +
                                ' [' + quals + ']' + ' [COLOR gold]' +
                                str(premium) + '[/COLOR]',
                                urls,
                                'get_link',
                                thumb,
                                movie_title,
                                total_items,
                                '',
                                'movies',
                                menu_items=menu_items,
                                is_playable='true',
                                fanart=fanart)

            if kodi.get_setting('primewire') == "true":
                primesources = q2.get()
                for e in primesources:
                    total_items = len(primesources)
                    #START RD CHECK
                    if 'debrid' in e:
                        premium = e['debrid']
                    else:
                        premium = ''
                    names = e['host']
                    urls = e['url']
                    views = e['view']
                    quals = e['quality']
                    menu_items = []
                    #menu_items.append(('[COLOR gold]Add to Downloads[/COLOR]',      'XBMC.Container.Update(%s)' % addon.build_plugin_url({'mode':'setup_download', 'name':name,'url':urls,'thumb':thumb,'media':media,'movie_title':movie_title})))
                    kodi.addDir("[COLORteal][Primewire][/COLOR] - " + names +
                                ' [' + quals + ']' + ' Views ' + views +
                                ' [COLOR gold]' + str(premium) + '[/COLOR]',
                                urls,
                                'get_link',
                                thumb,
                                movie_title,
                                total_items,
                                '',
                                'movies',
                                menu_items=menu_items,
                                is_playable='true',
                                fanart=fanart)

            if kodi.get_setting('twomovies') == "true":
                tmsources = q3.get()
                for e in tmsources:
                    total_items = len(tmsources)
                    if 'debrid' in e:
                        premium = e['debrid']
                    else:
                        premium = ''
                    names = e['host']
                    #END RD Check
                    urls = e['url']
                    menu_items = []
                    #menu_items.append(('[COLOR gold]Add to Downloads[/COLOR]',      'XBMC.Container.Update(%s)' % addon.build_plugin_url({'mode':'setup_download', 'name':name,'url':urls,'thumb':thumb, 'media':media,'movie_title':movie_title})))
                    kodi.addDir('[COLORteal][Two Movies][/COLOR] - ' + names +
                                ' [COLOR gold]' + str(premium) + '[/COLOR]',
                                urls,
                                'tmlinkpage',
                                thumb,
                                movie_title,
                                total_items,
                                '',
                                'movies',
                                menu_items=menu_items,
                                is_playable='true',
                                fanart=fanart)

            if kodi.get_setting('afdah') == 'true':
                try:
                    afdahsources = q4.get()
                    for e in afdahsources:
                        total_items = len(afdahsources)
                        if 'debrid' in e:
                            premium = e['debrid']
                        else:
                            premium = ''
                        names = e['host']
                        urls = e['url']
                        quals = e['quality']
                        menu_items = []
                        #menu_items.append(('[COLOR gold]Add to Downloads[/COLOR]',      'XBMC.Container.Update(%s)' % addon.build_plugin_url({'mode':'setup_download', 'name':name,'url':urls,'thumb':thumb, 'media':media,'movie_title':movie_title})))
                        kodi.addDir('[COLORteal][AFDAH][/COLOR] - ' + names +
                                    ' [' + quals + ']' + ' [COLOR gold]' +
                                    str(premium) + '[/COLOR]',
                                    urls,
                                    'get_link',
                                    thumb,
                                    movie_title,
                                    total_items,
                                    '',
                                    'movies',
                                    menu_items=menu_items,
                                    is_playable='true',
                                    fanart=fanart)
                except Exception as e:
                    log_utils.log('Error [%s]  %s' % (str(e), ''),
                                  xbmc.LOGERROR)
                    if kodi.get_setting('error_notify') == "true":
                        kodi.notify(header='Scraper',
                                    msg='(error) %s  %s' % (str(e), ''),
                                    duration=5000,
                                    sound=None)

            if kodi.get_setting('merdb') == "true":
                mersources = q5.get()
                for e in mersources:
                    total_items = len(mersources)
                    if 'debrid' in e:
                        premium = e['debrid']
                    else:
                        premium = ''
                    names = e['host']
                    urls = e['url']
                    menu_items = []
                    #menu_items.append(('[COLOR gold]Add to Downloads[/COLOR]',      'XBMC.Container.Update(%s)' % addon.build_plugin_url({'mode':'setup_download', 'name':name,'url':urls,'thumb':thumb, 'media':media,'movie_title':movie_title})))
                    kodi.addDir("[COLORteal][MerDB][/COLOR] - " + names +
                                ' [COLOR gold]' + str(premium) + '[/COLOR]',
                                urls,
                                'playmerdblink',
                                thumb,
                                movie_title,
                                total_items,
                                '',
                                'movies',
                                menu_items=menu_items,
                                is_playable='true',
                                fanart=fanart)

            if kodi.get_setting('zmovies') == "true":
                zmoviesources = q6.get()
                for e in zmoviesources:
                    total_items = len(zmoviesources)
                    if 'debrid' in e:
                        premium = e[
                            'debrid']  #.replace('[','').replace(']','')
                    else:
                        premium = ''
                    names = e['host']
                    urls = e['url']
                    menu_items = []
                    #menu_items.append(('[COLOR gold]Add to Downloads[/COLOR]',      'XBMC.Container.Update(%s)' % addon.build_plugin_url({'mode':'setup_download', 'name':name,'url':urls,'thumb':thumb, 'media':media,'movie_title':movie_title})))
                    kodi.addDir("[COLORteal][ZMovies][/COLOR] - " + names +
                                ' [COLOR gold]' + str(premium) + '[/COLOR]',
                                urls,
                                'playzmovieslink',
                                thumb,
                                movie_title,
                                total_items,
                                '',
                                'movies',
                                menu_items=menu_items,
                                is_playable='true',
                                fanart=fanart)

    except Exception as e:
        log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
        if kodi.get_setting('error_notify') == "true":
            kodi.notify(header='Scraper',
                        msg='(error) %s  %s' % (str(e), ''),
                        duration=5000,
                        sound=None)
Esempio n. 52
0
def get_link(url, movie_title, thumb, media):
    #kodi.log("Name IS NOW = " + movie_title)
    hmf = urlresolver.HostedMediaFile(url)
    ##########################################
    if hmf:
        try:
            url = urlresolver.resolve(url)
            params = {'url': url, 'title': movie_title, 'thumb': thumb}
            listitem = xbmcgui.ListItem(path=url,
                                        iconImage=thumb,
                                        thumbnailImage=thumb)
            listitem.setProperty('fanart_image', fanart)

            listitem.setPath(url)
            listitem.setInfo('video', params)

            xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listitem)
            movie_name = movie_title[:-6]
            movie_name = '"' + movie_name + '"'
            movie_year_full = movie_title[-6:]
            movie_year = movie_year_full.replace('(', '').replace(')', '')
            if kodi.get_setting('trakt_oauth_token'):
                xbmc.sleep(30000)
                kodi.log("Velocity: Movie Scrobble  Start")
                try:
                    trakt_auth.start_movie_watch(movie_name, movie_year)
                except Exception as e:
                    log_utils.log('Error [%s]  %s' % (str(e), ''),
                                  xbmc.LOGERROR)
                    if kodi.get_setting('error_notify') == "true":
                        kodi.notify(header='Scrobble not loggged',
                                    msg='%s  %s' % (str(e), ''),
                                    duration=5000,
                                    sound=None)
            xbmc.sleep(30000)
            if kodi.get_setting('trakt_oauth_token'):
                check_player(movie_name, movie_year)
        except Exception as e:
            log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
            kodi.notify(header='Try Another Source',
                        msg='Link Removed or Failed',
                        duration=4000,
                        sound=None)

    if not hmf:
        try:
            params = {'url': url, 'title': movie_title, 'thumb': thumb}
            addon.add_video_item(params, {'title': movie_title}, img=thumb)
            liz = xbmcgui.ListItem(movie_title,
                                   iconImage="DefaultFolder.png",
                                   thumbnailImage=thumb)
            xbmc.sleep(1000)
            liz.setPath(str(url))
            xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
            #xbmc.Player ().play(url, liz, False)
            movie_name = movie_title[:-6]
            movie_name = '"' + movie_name + '"'
            movie_year_full = movie_title[-6:]
            movie_year = movie_year_full.replace('(', '').replace(')', '')
            if kodi.get_setting('trakt_oauth_token'):
                xbmc.sleep(30000)
                print "Velocity: Movie Scrobble  Start"
                try:
                    trakt_auth.start_movie_watch(movie_name, movie_year)
                except Exception as e:
                    log_utils.log('Error [%s]  %s' % (str(e), ''),
                                  xbmc.LOGERROR)
                    if kodi.get_setting('error_notify') == "true":
                        kodi.notify(header='Scrobble not loggged',
                                    msg='%s  %s' % (str(e), ''),
                                    duration=5000,
                                    sound=None)

            xbmc.sleep(30000)
            if kodi.get_setting('trakt_oauth_token'):
                check_player(movie_name, movie_year)
        except Exception as e:
            log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
            kodi.notify(header='Try Another Source',
                        msg='Link Removed or Failed',
                        duration=4000,
                        sound=None)
Esempio n. 53
0
def find_source(name,thumb,media,movie_title):

    try:
        q1, q2, q3, q4, q5, q6, q7, q8, q9 = Queue(), Queue(), Queue(),Queue(), Queue(), Queue(), Queue(), Queue(),Queue()

        if thumb is None:
            thumb = ''
        else:
            thumb = thumb
        if media == 'shows':
            find_sourceTV(name,thumb,media,movie_title)
        else:
            if kodi.get_setting('9movies') == "true":
                movie_title = name
                t = Thread(target=wrapper, args=(nine_movies.ninemovies, name, q1))
                t.daemon = True
                t.start()

            if kodi.get_setting('primewire') == "true":
                movie_title = name
                Thread(target=wrapper, args=(primewire.primewire, name, q2)).start()

            # if kodi.get_setting('twomovies') == "true":
            #     movie_title = name
            #     Thread(target=wrapper, args=(twomovies.tmovies, name, q3)).start()

            if kodi.get_setting('afdah') =='true':
                movie_title = name
                Thread(target=wrapper, args=(afdah.afdah, name, q4)).start()

            if kodi.get_setting('merdb') == "true":
                movie_title = name
                Thread(target=wrapper, args=(merdb.merdb, name, q5)).start()

            if kodi.get_setting('zmovies') == "true":
                movie_title = name
                Thread(target=wrapper, args=(zmovies.zmovies, name, q6)).start()

            if kodi.get_setting('123movies') == "true":
                movie_title = name
                Thread(target=wrapper, args=(zmovies.zmovies, name, q7)).start()


            if kodi.get_setting('ice_films') == "true":
                movie_title = name
                t = Thread(target=wrapper, args=(icefilms.ice_films, name, q8))
                t.daemon = True
                t.start()


            if kodi.get_setting('putlocker') == "true":
                movie_title = name
                t = Thread(target=wrapper, args=(putlocker_both.putlocker_movies, name, q9))
                t.daemon = True
                t.start()
######Grab Results




            if kodi.get_setting('ice_films') == "true":
                try:
                    icesources = q8.get()
                    for e in icesources:
                        total_items =len(icesources)
                        if 'debrid' in e:
                            premium = e['debrid']
                        else:
                            premium = ''
                        names = e['host']
                        urls = e['url']
                        urls = icefilms.resolve_link(urls)
                        views = e['views']
                        if e['quality'] == None:
                            quals = 'unknown'
                        else:quals = e['quality']
                        menu_items=[]
                        menu_items.append(('[COLOR gold]Add to Downloads[/COLOR]',      'XBMC.Container.Update(%s)' % addon.build_plugin_url({'mode':'setup_download', 'name':name,'url':urls,'thumb':thumb, 'media':media,'movie_title':movie_title})))
                        kodi.addDir("[COLORteal][IceFilms][/COLOR] - "+names+' ['+quals+']'+' [COLOR gold]'+str(premium)+'[/COLOR]',urls,'get_link',thumb,movie_title,total_items,'','movies',menu_items=menu_items,is_playable='true',fanart=fanart)
                except Exception as e:
                    log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
                    if kodi.get_setting('error_notify') == "true":
                        kodi.notify(header='IceFilms',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)

            if kodi.get_setting('putlocker') == "true":
                try:
                    putlockersources = q9.get()
                    for e in putlockersources:
                        total_items =len(putlockersources)
                        if 'debrid' in e:
                            premium = e['debrid']
                        else:
                            premium = ''
                        names = e['host']
                        urls = e['url']
                        views = e['views']
                        if e['quality'] == None:
                            quals = 'unknown'
                        else:quals = e['quality']
                        menu_items=[]
                        menu_items.append(('[COLOR gold]Add to Downloads[/COLOR]',      'XBMC.Container.Update(%s)' % addon.build_plugin_url({'mode':'setup_download', 'name':name,'url':urls,'thumb':thumb, 'media':media,'movie_title':movie_title})))
                        kodi.addDir("[COLORteal][Putlocker][/COLOR] - "+names+' ['+quals+']'+' [COLOR gold]'+str(premium)+'[/COLOR]',urls,'get_link',thumb,movie_title,total_items,'','movies',menu_items=menu_items,is_playable='true',fanart=fanart)
                except Exception as e:
                    log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
                    if kodi.get_setting('error_notify') == "true":
                        kodi.notify(header='Putlocker',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)


            if kodi.get_setting('9movies') == "true":
                try:
                    ninesources = q1.get()
                    for e in ninesources:
                        total_items =len(ninesources)
                        if 'debrid' in e:
                            premium = e['debrid']
                        else:
                            premium = ''
                        names = e['host']
                        urls = e['url']
                        views = e['view']
                        quals = e['quality']
                        menu_items=[]
                        menu_items.append(('[COLOR gold]Add to Downloads[/COLOR]',      'XBMC.Container.Update(%s)' % addon.build_plugin_url({'mode':'setup_download', 'name':name,'url':urls,'thumb':thumb, 'media':media,'movie_title':movie_title})))
                        kodi.addDir("[COLORteal][9Movies][/COLOR] - "+names+' ['+quals+']'+' [COLOR gold]'+str(premium)+'[/COLOR]',urls,'get_link',thumb,movie_title,total_items,'','movies',menu_items=menu_items,is_playable='true',fanart=fanart)
                except Exception as e:
                    log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
                    if kodi.get_setting('error_notify') == "true":
                        kodi.notify(header='9Movies',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)

            if kodi.get_setting('123movies') == "true":
                try:
                    ottsources = q7.get()
                    for e in ottsources:
                        total_items =len(ottsources)
                        if 'debrid' in e:
                            premium = e['debrid']
                        else:
                            premium = ''
                        names = e['host']
                        urls = e['url']
                        try:
                            quals = e['quality']
                        except: quals = 'unknown'
                        menu_items=[]
                        menu_items.append(('[COLOR gold]Add to Downloads[/COLOR]',      'XBMC.Container.Update(%s)' % addon.build_plugin_url({'mode':'setup_download', 'name':name,'url':urls,'thumb':thumb, 'media':media,'movie_title':movie_title})))
                        kodi.addDir("[COLORteal][123Movies][/COLOR] - "+names+' ['+quals+']'+' [COLOR gold]'+str(premium)+'[/COLOR]',urls,'get_link',thumb,movie_title,total_items,'','movies',menu_items=menu_items,is_playable='true',fanart=fanart)
                except Exception as e:
                    log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
                    if kodi.get_setting('error_notify') == "true":
                        kodi.notify(header='123Movies',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)


            if kodi.get_setting('primewire') == "true":
                primesources = q2.get()
                for e in primesources:
                    total_items =len(primesources)
                    #START RD CHECK
                    if 'debrid' in e:
                        premium = e['debrid']
                    else:
                        premium = ''
                    names = e['host']
                    urls = e['url']
                    views = e['view']
                    quals = e['quality']
                    menu_items=[]
                    menu_items.append(('[COLOR gold]Add to Downloads[/COLOR]',      'XBMC.Container.Update(%s)' % addon.build_plugin_url({'mode':'setup_download', 'name':name,'url':urls,'thumb':thumb,'media':media,'movie_title':movie_title})))
                    kodi.addDir("[COLORteal][Primewire][/COLOR] - "+names+' ['+quals+']'+' Views '+views+' [COLOR gold]'+str(premium)+'[/COLOR]',urls,'get_link',thumb,movie_title,total_items,'','movies',menu_items=menu_items,is_playable='true',fanart=fanart)

            # if kodi.get_setting('twomovies') == "true":
            #     tmsources = q3.get()
            #     for e in tmsources:
            #         total_items =len(tmsources)
            #         if 'debrid' in e:
            #             premium = e['debrid']
            #         else:
            #             premium = ''
            #         names = e['host']
            #         #END RD Check
            #         urls = e['url']
            #         menu_items=[]
            #         menu_items.append(('[COLOR gold]Add to Downloads[/COLOR]',      'XBMC.Container.Update(%s)' % addon.build_plugin_url({'mode':'setup_download', 'name':name,'url':urls,'thumb':thumb, 'media':media,'movie_title':movie_title})))
            #         kodi.addDir('[COLORteal][Two Movies][/COLOR] - '+names+' [COLOR gold]'+str(premium)+'[/COLOR]',urls,'tmlinkpage',thumb,movie_title,total_items,'','movies',menu_items=menu_items,is_playable='true',fanart=fanart)

            if kodi.get_setting('afdah') =='true':
                try:
                    afdahsources = q4.get()
                    for e in afdahsources:
                            total_items =len(afdahsources)
                            if 'debrid' in e:
                                premium = e['debrid']
                            else:
                                premium = ''
                            names = e['host']
                            urls = e['url']
                            quals = e['quality']
                            menu_items=[]
                            menu_items.append(('[COLOR gold]Add to Downloads[/COLOR]',      'XBMC.Container.Update(%s)' % addon.build_plugin_url({'mode':'setup_download', 'name':name,'url':urls,'thumb':thumb, 'media':media,'movie_title':movie_title})))
                            kodi.addDir('[COLORteal][AFDAH][/COLOR] - '+names+' ['+quals+']'+' [COLOR gold]'+str(premium)+'[/COLOR]',urls,'get_link',thumb,movie_title,total_items,'','movies',menu_items=menu_items,is_playable='true',fanart=fanart)
                except Exception as e:
                    log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
                    if kodi.get_setting('error_notify') == "true":
                        kodi.notify(header='AFDAH',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)

            if kodi.get_setting('merdb') == "true":
                mersources = q5.get()
                for e in mersources:
                    total_items =len(mersources)
                    if 'debrid' in e:
                        premium = e['debrid']
                    else:
                        premium = ''
                    names = e['host']
                    urls = e['url']
                    menu_items=[]
                    menu_items.append(('[COLOR gold]Add to Downloads[/COLOR]',      'XBMC.Container.Update(%s)' % addon.build_plugin_url({'mode':'setup_download', 'name':name,'url':urls,'thumb':thumb, 'media':media,'movie_title':movie_title})))
                    kodi.addDir("[COLORteal][MerDB][/COLOR] - "+names+' [COLOR gold]'+str(premium)+'[/COLOR]',urls,'playmerdblink',thumb,movie_title,total_items,'','movies',menu_items=menu_items,is_playable='true',fanart=fanart)

            if kodi.get_setting('zmovies') == "true":
                zmoviesources =q6.get()
                for e in zmoviesources:
                    total_items =len(zmoviesources)
                    if 'debrid' in e:
                        premium = e['debrid']#.replace('[','').replace(']','')
                    else:
                        premium = ''
                    names = e['host']
                    urls = e['url']
                    menu_items=[]
                    menu_items.append(('[COLOR gold]Add to Downloads[/COLOR]',      'XBMC.Container.Update(%s)' % addon.build_plugin_url({'mode':'setup_download', 'name':name,'url':urls,'thumb':thumb, 'media':media,'movie_title':movie_title})))
                    kodi.addDir("[COLORteal][ZMovies][/COLOR] - "+names+' [COLOR gold]'+str(premium)+'[/COLOR]',urls,'playzmovieslink',thumb,movie_title,total_items,'','movies',menu_items=menu_items,is_playable='true',fanart=fanart)

    except Exception as e:
            log_utils.log('Error [%s]  %s' % (str(e), ''), xbmc.LOGERROR)
            if kodi.get_setting('error_notify') == "true":
                kodi.notify(header='Movie Scrapers',msg='(error) %s  %s' % (str(e), ''),duration=5000,sound=None)