def search(query='', type='', silence=False):
    results = []
    if type == 'MOVIE':
        folder = settings.movie_folder
    else:
        folder = settings.show_folder
    # start to search
    settings.pages = settings.dialog.numeric(0, 'Number of pages:')
    if settings.pages == '' or settings.pages == 0:
        settings.pages = "1"
    settings.pages = int(settings.pages)
    for page in range(settings.pages):
        url_search = query % (settings.url_address, page)
        settings.log('[%s]%s' % (settings.name_provider_clean, url_search))
        if settings.time_noti > 0: settings.dialog.notification(settings.name_provider, 'Checking Page %s...' % page,
                                                                settings.icon, settings.time_noti)
        if browser.open(url_search):
            results.extend(extract_magnets(browser.content))
            if int(page) % 10 == 0: sleep(3000)  # to avoid too many connections
        else:
            settings.log('[%s]%s' % (settings.name_provider_clean, '>>>>>>>%s<<<<<<<' % browser.status))
            settings.dialog.notification(settings.name_provider, browser.status, settings.icon, 1000)
    if len(results) > 0:
        title = []
        magnet = []
        for item in results:
            info = tools.format_title(item['name'])
            if info['type'] == type:
                title.append(item['name'])
                magnet.append(item['uri'])
        tools.integration(filename=title, magnet=magnet, type_list=type, folder=folder, silence=silence,
                           name_provider=settings.name_provider)
Example #2
0
def search(query='', type='', silence=False):
    results = []
    if type == 'MOVIE':
        folder = settings.movie_folder
    else:
        folder = settings.show_folder
    # start to search
    settings.pages = settings.dialog.numeric(0, 'Number of pages:')
    if settings.pages == '' or settings.pages == 0:
        settings.pages = "1"
    settings.pages = int(settings.pages)
    for page in range(settings.pages):
        url_search = query % (settings.url_address, page)
        settings.log('[%s]%s' % (settings.name_provider_clean, url_search))
        if settings.time_noti > 0: settings.dialog.notification(settings.name_provider, 'Checking Page %s...' % str(page + 1),
                                                                settings.icon, settings.time_noti)
        if browser.open(url_search):
            results.extend(extract_magnets(browser.content))
            if int(page) % 10 == 0: sleep(3000)  # to avoid too many connections
        else:
            settings.log('[%s]%s' % (settings.name_provider_clean, '>>>>>>>%s<<<<<<<' % browser.status))
            settings.dialog.notification(settings.name_provider, browser.status, settings.icon, 1000)
    if len(results) > 0:
        title = []
        magnet = []
        for item in results:
            info = tools.format_title(item['name'])
            if info['type'] == type:
                title.append(item['name'])
                magnet.append(item['uri'])
        tools.integration(filename=title, magnet=magnet, type_list=type, folder=folder, silence=silence,
                           name_provider=settings.name_provider, message=type)
Example #3
0
def update_service():
    # this read the settings
    settings = tools.Settings()
    # define the browser
    browser = tools.Browser()
    #Begin Service
    if settings.service == 'true':
        if settings.time_noti > 0: settings.dialog.notification(settings.name_provider, 'Checking Online...', settings.icon, settings.time_noti)
        quality = Addon().getSetting('quality')
        text = '&minimum_rating=%s' % Addon().getSetting('minimum')
        sort = Addon().getSetting('sort')
        url_search = "%s/api/v2/list_movies.json?limit=50&quality=%s&sort_by=%s&order_by=desc" % (settings.url_address, quality, sort.lower().replace(' ', '_'))
        settings.log(url_search)
        title = []
        magnet = []
        for page in range(settings.pages):
            if settings.time_noti > 0: settings.dialog.notification(settings.name_provider, 'Checking Online, Page %s...'
                                                                    % str(page + 1), settings.icon, settings.time_noti)
            if browser.open(url_search):
                data = json.loads(browser.content)
                for movie in data['data']['movies']:
                    if movie.has_key('torrents'):
                        for torrent in movie['torrents']:
                            if torrent['quality'] in quality:
                                title.append(movie['title_long'])
                                magnet.append('magnet:?xt=urn:btih:%s' % torrent['hash'])
        if len(title) > 0:
            tools.integration(filename=title, magnet=magnet, type_list='MOVIE', folder=settings.movie_folder, silence=True, name_provider=settings.name_provider)
        else:
            settings.log('[%s] >>>>>>>%s<<<<<<<' % (settings.name_provider_clean, browser.status))
            settings.dialog.notification(settings.name_provider, browser.status, settings.icon, 1000)
    del settings
    del browser
Example #4
0
def update_service():
    # this read the settings
    settings = tools.Settings()
    # define the browser
    browser = tools.Browser()
    #Begin Service
    if settings.service == 'true':
        options = {
            'Estrenos de Cine': '%s/categoria/estrenos/pg/',
            'Peliculas en Alta Definicion': '%s/categoria/peliculas-hd/pg/',
            'Peliculas en 3D': '%s/categoria/peliculas-3d/pg/',
            'Peliculas en Castellano': '%s/categoria/peliculas-castellano/pg/',
            'Peliculas Latino': '%s/categoria/peliculas-latino/pg/'
        }
    ret = int(Addon().getSetting('option'))
    if ret < len(options):
        url_search = options.values()[ret] % settings.url_address
        title = []
        magnet = []
        if settings.pages == 0:
            settings.pages = 1  # manual pages if the parameter is zero
        for page in range(1, settings.pages + 1):
            if settings.time_noti > 0:
                settings.dialog.notification(
                    settings.name_provider,
                    'Checking Online page %s...' % page, settings.icon,
                    settings.time_noti)
            settings.log('[%s] %s%d' %
                         (settings.name_provider_clean, url_search, page))
            if browser.open(url_search + str(page)):
                data = browser.content
                for cm, torrent in enumerate(
                        re.findall(r'/descargar/(.*?)"', data)):
                    sname = re.search("_(.*?).html", torrent)
                    if sname is None:
                        name = torrent
                    else:
                        name = sname.group(1)
                    info = tools.format_title(name.replace('-', ' ').title())
                    title.append(info['title'])
                    magnet.append(settings.url_address + '/torrent/' +
                                  torrent)  # create torrent to send Pulsar
                if int(page) % 10 == 0:
                    sleep(3000)  # to avoid too many connections
            else:
                settings.log('[%s] >>>>>>>%s<<<<<<<' %
                             (settings.name_provider_clean, browser.status))
                settings.dialog.notification(settings.name_provider,
                                             browser.status, settings.icon,
                                             1000)
                break
        if len(title) > 0:
            tools.integration(filename=title,
                              magnet=magnet,
                              type_list='MOVIE',
                              folder=settings.movie_folder,
                              name_provider=settings.name_provider,
                              silence=True)
    del settings
    del browser
def update_service():
    path = translatePath('special://temp')
    # get the list
    try:
        with open(path + 'EZTV2PULSAR.txt', "r") as text_file:  # create .strm
            List_shows = [line.strip() for line in text_file]
            text_file.close()
    except:
        #convert from the old version
        database = shelve.open(path + 'EZTV2PULSAR.db')
        List_shows = []
        if database.has_key('list'):
            List_shows = database['list']
        else:
            List_shows = []

    # this read the settings
    settings = tools.Settings()
    # define the browser
    browser = tools.Browser()

    #Begin Service
    if settings.service == 'true':
        if settings.time_noti > 0: settings.dialog.notification(settings.name_provider, 'Checking Online...', settings.icon, settings.time_noti)
        if len(List_shows) > 0:
            quality_keys = settings.settings.getSetting('quality').lower().split(":")
            number = int(settings.settings.getSetting('number'))
            magnet_list = []
            file_list = []
            title_list = []
            if number == 0: number = 1  # manual pages if the parameter is zero
            for page in range(number + 1):
                if page == 0:
                    url_search = settings.url_address
                else:
                    url_search = '%s/page_%s' % (settings.url_address, str(page))
                if browser.open(url_search):
                    data = browser.content
                    magnets = re.findall(r'magnet:\?[^\'"\s<>\[\]]+', data)
                    for quality in quality_keys:
                        for magnet in magnets:
                            for show in List_shows:
                                name_file = magnet.lower()
                                if quality == 'hdtv' and ('720p' in name_file or '1080p' in name_file):
                                    name_file = name_file.replace('hdtv', '')
                                if show.replace(' ', '.').lower() in name_file and quality in name_file:
                                    magnet_list.append(magnet)
                                    file_list.append(re.search('&dn=(.*?)&', magnet).group(1))
                                    title_list.append(show)
                        if int(page) % 10 == 0: sleep(3000)  # to avoid too many connections
                else:
                    settings.log('[%s]>>>>>>>%s<<<<<<<' % (settings.name_provider_clean, browser.status))
                    settings.dialog.notification(settings.name_provider, browser.status, settings.icon, 1000)
            tools.integration(filename=file_list, magnet=magnet_list, title=title_list, type_list='EPISODES', silence=True,
                            folder=settings.show_folder, name_provider=settings.name_provider)
        else:
            settings.dialog.notification(settings.name_provider, 'Empty List', settings.icon, settings.time_noti)
    del settings
    del browser
def update_service():
    # this read the settings
    settings = tools.Settings()
    # define the browser
    browser = tools.Browser()
    #Begin Service
    if settings.service == 'true':
        options = {
            'Estrenos': '%s/categoria/1/estrenos/modo:listado/pag:',
            'Peliculas': '%s/categoria/2/peliculas/modo:listado/pag:',
            'Peliculas HDRip':
            '%s/categoria/13/peliculas-hdrip/modo:listado/pag:'
        }
        ret = int(Addon().getSetting('option'))
        if ret < len(options):
            url_search = options.values()[ret] % settings.url_address
            title = []
            magnet = []
            if settings.pages == 0:
                settings.pages = 1  # manual pages if the parameter is zero
            for page in range(1, settings.pages + 1):
                if settings.time_noti > 0:
                    settings.dialog.notification(
                        settings.name_provider,
                        'Checking Online page %s...' % page, settings.icon,
                        settings.time_noti)
                settings.log('[%s] %s%d' %
                             (settings.name_provider_clean, url_search, page))
                if browser.open(url_search + str(page)):
                    data = browser.content
                    for (torrent, name) in re.findall(r'/torrent/(.*?)/(.*?)"',
                                                      data):
                        info = tools.format_title(name)
                        title.append(info['title'].replace('-', ' '))
                        magnet.append(settings.url_address + '/get-torrent/' +
                                      torrent)  # create torrent to send P
                    if int(page) % 10 == 0:
                        sleep(3000)  # to avoid too many connections
                else:
                    settings.log(
                        '[%s] >>>>>>>%s<<<<<<<' %
                        (settings.name_provider_clean, browser.status))
                    settings.dialog.notification(settings.name_provider,
                                                 browser.status, settings.icon,
                                                 1000)
                    break
            if len(title) > 0:
                tools.integration(filename=title,
                                  magnet=magnet,
                                  type_list='MOVIE',
                                  folder=settings.movie_folder,
                                  name_provider=settings.name_provider,
                                  silence=True)
    del settings
    del browser
Example #7
0
def update_service():
    path = translatePath('special://temp')
    # get the Dictionary
    Dict_tvshows = {}
    try:
        with open(path + 'EZTVapi2KD.txt', 'r') as fp:
            for line in fp:
                listedline = line.strip().split('::')  # split around the :: sign
                if len(listedline) > 1:  # we have the : sign in there
                    Dict_tvshows[listedline[0]] = listedline[1]
    except:
        pass

    # this read the settings
    settings = tools.Settings()
    # define the browser
    browser = tools.Browser()

    # Begin Service
    if settings.service == 'true':
        if settings.time_noti > 0: settings.dialog.notification(settings.name_provider, 'Checking Online...', settings.icon, settings.time_noti)
        if len(Dict_tvshows.keys()) > 0:
            quality_keys = settings.settings.getSetting('quality').lower().split(":")
            magnet_list = []
            file_list = []
            title_list = []
            for (show, value) in Dict_tvshows.items():
                if settings.time_noti > 0: settings.dialog.notification(settings.name_provider,
                                            'Checking Online for %s...' % show, settings.icon, settings.time_noti)
                url_search = '%s/show/%s' % (settings.url_address, value)  # search for the tvshow
                settings.log('[%s]%s' % (settings.name_provider_clean, url_search))
                browser.open(url_search)
                data = browser.content
                magnets = re.findall(r'magnet:\?[^\'"\s<>\[\]]+', data)
                for quality in quality_keys:
                    for magnet in magnets:
                        name_file = magnet.lower() + ' hdtv'  # take any file as hdtv by default
                        if quality == 'hdtv' and ('720p' in name_file or '1080p' in name_file):
                            name_file = name_file.replace('hdtv', '')
                        if quality in name_file:
                            magnet_list.append(magnet)
                            title = magnet[magnet.find('&dn=') + 4:] + '&'  # find the start of the name
                            title = title[:title.find('&')]
                            file_list.append(title)
                            title_list.append(show)
            if len(file_list) > 0:
                tools.integration(title=title_list, filename=file_list, magnet=magnet_list, type_list='SHOW',
                              folder=settings.show_folder, name_provider=settings.name_provider, silence=True)
        else:
            if settings.time_noti > 0: settings.dialog.notification(settings.name_provider, 'Empty List', settings.icon, settings.time_noti)
    del settings
    del browser
def update_service():
    path = translatePath('special://temp')
    # get the list
    try:
        with open(path + 'HorribleSubs2PULSAR.txt', "r") as text_file:  # create .strm
            List_shows = [line.strip() for line in text_file]
            text_file.close()
    except:
        #convert from the old version
        database = shelve.open(path + 'HorribleSubs2PULSAR.db')
        List_shows = []
        if database.has_key('list'):
            List_shows = database['list']
        else:
            List_shows = []

    # this read the settings
    settings = tools.Settings(anime=True)
    # define the browser
    browser = tools.Browser()

    # Begin Service
    if settings.service == 'true':
        List_name = []
        if settings.time_noti > 0: settings.dialog.notification(settings.name_provider, 'Checking Online...', settings.icon, settings.time_noti)
        if len(List_shows) > 0:
            quality_keys = settings.settings.getSetting('quality').split(":")
            magnet_list = []
            file_list = []
            url_search = '%s/lib/latest.php' % settings.url_address
            settings.log('[%s]%s' % (settings.name_provider_clean, url_search))
            if browser.open(url_search):
                data = browser.content
                zip_list = zip(re.findall(r'magnet:\?[^\'"\s<>\[\]]+', data), re.findall('<i>(.*?)<', data))
                for quality in quality_keys:
                    for (magnet, name_file) in zip_list:
                        for show in List_shows:
                            if show.lower() in name_file.lower() and quality.lower() in name_file.lower():
                                name_file = name_file.replace('_', ' ')
                                magnet_list.append(magnet)
                                pos = name_file.rfind('- ')
                                name_file = name_file[:pos] + 'EP' + name_file[pos + 2:]  # insert EP to be identificated in kodi
                                file_list.append(name_file)
                tools.integration(filename=file_list, magnet=magnet_list, type_list='SHOW', silence=True,
                                        folder=settings.show_folder, name_provider=settings.name_provider)
            else:
                settings.log('[%s]>>>>>>>%s<<<<<<<' % (settings.name_provider_clean, browser.status))
                settings.dialog.notification(settings.name_provider, browser.status, settings.icon, 1000)
        else:
            if settings.time_noti > 0: settings.dialog.notification(settings.name_provider, 'Empty List', settings.icon, settings.time_noti)
    del settings
    del browser
def update_service():
    # this read the settings
    settings = tools.Settings()
    # define the browser
    browser = tools.Browser()
    # Begin Service
    if settings.service == "true":
        if settings.time_noti > 0:
            settings.dialog.notification(
                settings.name_provider, "Checking Online...", settings.icon, settings.time_noti
            )
        quality = Addon().getSetting("quality")
        sort = Addon().getSetting("sort")
        url_search = "%s/api/v2/list_movies.json?limit=50&quality=%s&sort_by=%s&order_by=desc" % (
            settings.url_address,
            quality,
            sort.lower().replace(" ", "_"),
        )
        settings.log(url_search)
        title = []
        magnet = []
        for page in range(settings.pages):
            if settings.time_noti > 0:
                settings.dialog.notification(
                    settings.name_provider,
                    "Checking Online, Page %s..." % str(page + 1),
                    settings.icon,
                    settings.time_noti,
                )
            if browser.open(url_search):
                data = json.loads(browser.content)
                for movie in data["data"]["movies"]:
                    if movie.has_key("torrents"):
                        for torrent in movie["torrents"]:
                            if torrent["quality"] in quality:
                                title.append(movie["title_long"])
                                magnet.append("magnet:?xt=urn:btih:%s" % torrent["hash"])
        if len(title) > 0:
            tools.integration(
                filename=title,
                magnet=magnet,
                type_list="MOVIE",
                folder=settings.movie_folder,
                silence=True,
                name_provider=settings.name_provider,
            )
        else:
            settings.log("[%s] >>>>>>>%s<<<<<<<" % (settings.name_provider_clean, browser.status))
            settings.dialog.notification(settings.name_provider, browser.status, settings.icon, 1000)
    del settings
    del browser
Example #10
0
def update_service():
    # this read the settings
    settings = tools.Settings()
    # define the browser
    browser = tools.Browser()
    #Begin Service
    if settings.service == 'true':
        if settings.time_noti > 0:
            settings.dialog.notification(settings.name_provider,
                                         'Checking Online...', settings.icon,
                                         settings.time_noti)
        quality = Addon().getSetting('quality')
        sort = Addon().getSetting('sort')
        url_search = "%s/api/v2/list_movies.json?limit=50&quality=%s&sort_by=%s&order_by=desc" % (
            settings.url_address, quality, sort.lower().replace(' ', '_'))
        settings.log(url_search)
        title = []
        magnet = []
        for page in range(settings.pages):
            if settings.time_noti > 0:
                settings.dialog.notification(
                    settings.name_provider,
                    'Checking Online, Page %s...' % str(page + 1),
                    settings.icon, settings.time_noti)
            if browser.open(url_search):
                data = json.loads(browser.content)
                for movie in data['data']['movies']:
                    if movie.has_key('torrents'):
                        for torrent in movie['torrents']:
                            if torrent['quality'] in quality:
                                title.append(movie['title_long'])
                                magnet.append('magnet:?xt=urn:btih:%s' %
                                              torrent['hash'])
        if len(title) > 0:
            tools.integration(filename=title,
                              magnet=magnet,
                              type_list='MOVIE',
                              folder=settings.movie_folder,
                              silence=True,
                              name_provider=settings.name_provider)
        else:
            settings.log('[%s] >>>>>>>%s<<<<<<<' %
                         (settings.name_provider_clean, browser.status))
            settings.dialog.notification(settings.name_provider,
                                         browser.status, settings.icon, 1000)
    del settings
    del browser
def update_service():
    path = translatePath('special://temp')
    # get the Dictionary
    Dict_tvshows = {}
    try:
        with open(path + 'addertv2PULSAR.txt', 'r') as fp:
            for line in fp:
                listedline = line.strip().split('::')  # split around the :: sign
                if len(listedline) > 1:  # we have the : sign in there
                    Dict_tvshows[listedline[0]] = listedline[1]
    except:
        pass

    # this read the settings
    settings = tools.Settings()
    # define the browser
    browser = tools.Browser()

    # Begin Service
    if settings.service == 'true':
        if settings.time_noti > 0: settings.dialog.notification(settings.name_provider, 'Checking Online...', settings.icon, settings.time_noti)
        if len(Dict_tvshows.keys()) > 0:
            magnet_list = []
            file_list = []
            title_list = []
            for (show, value) in Dict_tvshows.items():
                if settings.time_noti > 0: settings.dialog.notification(settings.name_provider,
                                            'Checking Online for %s...' % show, settings.icon, settings.time_noti)
                url_search = '%s/watch/%s' % (settings.url_address, value)  # search for the tvshow
                settings.log('[%s]%s' % (settings.name_provider_clean, url_search))
                browser.open(url_search)
                data = browser.content
                if data is not None and len(data) > 0:
                    for item in re.findall(r'magnet:\?[^\'"\s<>\[\]]+', data):
                        info = tools.Magnet(item)
                        magnet_list.append(item)
                        file_list.append(info.name)
                        title_list.append(show)
            if len(file_list) > 0:
                tools.integration(title=title_list, filename=file_list, magnet=magnet_list, type_list='SHOW',
                              folder=settings.show_folder, name_provider=settings.name_provider, silence=True)
        else:
            if settings.time_noti > 0: settings.dialog.notification(settings.name_provider, 'Empty List', settings.icon, settings.time_noti)
    del settings
    del browser
def update_service():
    # this read the settings
    settings = tools.Settings()
    # define the browser
    browser = tools.Browser()
    #Begin Service
    if settings.service == 'true':
        options = {'Estrenos de Cine': '%s/categoria/estrenos/pg/',
                   'Peliculas en Alta Definicion': '%s/categoria/peliculas-hd/pg/',
                   'Peliculas en 3D': '%s/categoria/peliculas-3d/pg/',
                   'Peliculas en Castellano': '%s/categoria/peliculas-castellano/pg/',
                   'Peliculas Latino': '%s/categoria/peliculas-latino/pg/'}
    ret = int(Addon().getSetting('option'))
    if ret < len(options):
        url_search = options.values()[ret] % settings.url_address
        title = []
        magnet = []
        if settings.pages == 0: settings.pages = 1  # manual pages if the parameter is zero
        for page in range(1, settings.pages + 1):
            if settings.time_noti > 0: settings.dialog.notification(settings.name_provider, 
                    'Checking Online page %s...' % page, settings.icon, settings.time_noti)
            settings.log('[%s] %s%d' % (settings.name_provider_clean, url_search, page))
            if browser.open(url_search + str(page)):
                data = browser.content
                for cm, torrent in enumerate(re.findall(r'/descargar/(.*?)"', data)):
                    sname = re.search("_(.*?).html", torrent)
                    if sname is None:
                        name = torrent
                    else:
                        name = sname.group(1)
                    info = tools.format_title(name.replace('-', ' ').title())
                    title.append(info['title'])
                    magnet.append(settings.url_address + '/torrent/' + torrent)  # create torrent to send Pulsar
                if int(page) % 10 == 0: sleep(3000)  # to avoid too many connections
            else:
                settings.log('[%s] >>>>>>>%s<<<<<<<' % (settings.name_provider_clean, browser.status))
                settings.dialog.notification(settings.name_provider, browser.status, settings.icon, 1000)
                break
        if len(title) > 0:
            tools.integration(filename=title, magnet=magnet, type_list='MOVIE', folder=settings.movie_folder,
                              name_provider=settings.name_provider, silence=True)
    del settings
    del browser
def update_service():
    # this read the settings
    settings = tools.Settings()
    # define the browser
    browser = tools.Browser()
    #Begin Service
    if settings.service == 'true':
        options = {'Estrenos': '%s/categoria/1/estrenos/modo:listado/pag:',
                   'Peliculas': '%s/categoria/2/peliculas/modo:listado/pag:',
                   'Peliculas HDRip': '%s/categoria/13/peliculas-hdrip/modo:listado/pag:'}
        ret = int(Addon().getSetting('option'))
        if ret < len(options):
            url_search = options.values()[ret] % settings.url_address
            title = []
            magnet = []
            if settings.pages == 0: settings.pages = 1  # manual pages if the parameter is zero
            for page in range(1, settings.pages + 1):
                if settings.time_noti > 0: settings.dialog.notification(settings.name_provider,
                                                                        'Checking Online page %s...' % page,
                                                                        settings.icon, settings.time_noti)
                settings.log('[%s] %s%d' % (settings.name_provider_clean, url_search, page))
                if browser.open(url_search + str(page)):
                    data = browser.content
                    for (torrent, name) in re.findall(r'/torrent/(.*?)/(.*?)"', data):
                        info = tools.format_title(name)
                        title.append(info['title'].replace('-', ' '))
                        magnet.append(settings.url_address + '/get-torrent/' + torrent)  # create torrent to send P
                    if int(page) % 10 == 0: sleep(3000)  # to avoid too many connections
                else:
                    settings.log('[%s] >>>>>>>%s<<<<<<<' % (settings.name_provider_clean, browser.status))
                    settings.dialog.notification(settings.name_provider, browser.status, settings.icon, 1000)
                    break
            if len(title) > 0:
                tools.integration(filename=title, magnet=magnet, type_list='MOVIE', folder=settings.movie_folder,
                                  name_provider=settings.name_provider, silence=True)
    del settings
    del browser
Example #14
0
                     cm += 1
                     if cm % 5: sleep(500)
                     if data is not None and len(data) > 0:
                         zip_list = zip(re.findall(r'magnet:\?[^\'"\s<>\[\]]+', data), re.findall('<i>(.*?)<', data))
                         for quality in quality_keys:
                             for (magnet, name_file) in zip_list:
                                 if quality.lower() in name_file.lower():
                                     name_file = name_file.replace('_', ' ')
                                     magnet_list.append(magnet)
                                     pos = name_file.rfind('- ')
                                     name_file = name_file[:pos] + 'EP' + name_file[pos + 2:] # insert EP to be identificated in kodi
                                     file_list.append(name_file)
                     else:
                         loop = False
                 if len(file_list)>0:
                     tools.integration(filename=file_list, magnet=magnet_list, type_list='SHOW',
                                     folder=settings.show_folder, name_provider=settings.name_provider)
 if rep == 1 and len(List_shows) > 0:  # Remove
     list_rep = settings.dialog.select('Choose Show to Remove', List_shows + ['CANCEL'])
     if list_rep < len(List_shows):
         if settings.dialog.yesno('', 'Do you want Remove %s?' % List_shows[list_rep]):
             del List_shows[list_rep]
 if rep == 2:  # List
     settings.dialog.select('Shows', List_shows)
 if rep == 3:  # Rebuild
     if settings.dialog.yesno("Horriblesubs2PULSAR", "Do you want to rebuild the all the episodes?"):
         quality_options = ['720p:1080p', '1080p:720p', '480p:720p:1080p', '1080p:720p:480p', '480p', '720p', '1080p']
         quality_ret = settings.dialog.select('Quality:', quality_options)
         quality_keys = quality_options[quality_ret].lower().split(":")
         magnet_list = []
         file_list = []
         for show in List_shows:
def update_service():
    # this read the settings
    settings = tools.Settings()
    # define the browser
    browser = tools.Browser()
    #Begin Service
    if settings.service == 'true':
        if settings.time_noti > 0: settings.dialog.notification(settings.name_provider, 'Checking Online...', settings.icon, settings.time_noti)
        list_url_search = []
        path = translatePath('special://temp')
        Dict_RSS = {}
        try:
            with open(path + 'RSS2PULSAR.txt', 'r') as fp:
                for line in fp:
                    listedline = line.strip().split('::')  # split around the :: sign
                    if len(listedline) > 1:  # we have the : sign in there
                        Dict_RSS[listedline[0]] = listedline[1]
        except:
            database = shelve.open(path + 'RSS2PULSAR.db')
            if database.has_key('dict'):
                Dict_RSS = database['dict']
        rep = 0
        list_url_search = Dict_RSS.values()
        if settings.time_noti > 0: settings.dialog.notification(settings.name_provider, 'Checking Online...', settings.icon, settings.time_noti)
        # Begin reading
        for url_search in list_url_search:
            if url_search is not '':
                magnet_movie = []
                title_movie = []
                magnet_show = []
                title_show = []
                if settings.time_noti > 0: settings.dialog.notification(settings.name_provider, 'Checking %s...' % url_search, settings.icon, settings.time_noti)
                acum = 0
                if browser.open(url_search):
                    items = re.findall('<item>(.*?)</item>', browser.content, re.S)
                    for item in items:
                        s_title = re.findall('title>(.*?)<', item)
                        s_link = re.findall(r'magnet:\?[^\'"\s<>\[\]]+', item)
                        if len(s_link) == 0:
                            s_link = re.findall(r'http://(.*?)[.]torrent', item)
                        if len(s_link) != 0:
                            if 'magnet' not in s_link[0]:
                                s_link[0] = 'http://' + s_link[0].replace('&amp;', '&') + '.torrent'
                            if len(s_title) > 0:
                                if s_title[0] != '':
                                    info = tools.format_title(s_title[0])
                                    if 'MOVIE' in info['type']:
                                        title_movie.append(s_title[0])
                                        magnet_movie.append(s_link[0])
                                        acum += 1
                                    if 'SHOW' in info['type']:
                                        title_show.append(s_title[0])
                                        magnet_show.append(s_link[0])
                                        acum += 1
                    if acum == 0:
                        if settings.time_noti > 0: settings.dialog.notification(settings.name_provider, 'No Movies nor Shows!!', settings.icon, settings.time_noti)
                    if len(title_movie) > 0:
                        tools.integration(filename=title_movie, magnet=magnet_movie, type_list='MOVIE',
                                        folder=settings.movie_folder, silence=True, name_provider=settings.name_provider)
                    if len(title_show) > 0:
                        tools.integration(filename=title_show, magnet=magnet_show, type_list='EPISODES',
                                        folder=settings.show_folder, silence=True, name_provider=settings.name_provider)
                else:
                    settings.log('[%s]>>>>>>>%s<<<<<<<' % (settings.name_provider_clean, browser.status))
                    settings.dialog.notification(settings.name_provider, browser.status, settings.icon, 1000)
    del settings
    del browser
Example #16
0
                         magnet_movie.append(s_link[0])
                         acum += 1
                     if 'SHOW' in info['type']:
                         title_show.append(s_title[0])
                         magnet_show.append(s_link[0])
                         acum += 1
     if acum == 0:
         if settings.time_noti > 0:
             settings.dialog.notification(
                 settings.name_provider,
                 'No Movies nor Shows!!', settings.icon,
                 settings.time_noti)
     if len(title_movie) > 0:
         tools.integration(filename=title_movie,
                           magnet=magnet_movie,
                           type_list='MOVIE',
                           folder=settings.movie_folder,
                           silence=True,
                           name_provider=settings.name_provider)
     if len(title_show) > 0:
         tools.integration(filename=title_show,
                           magnet=magnet_show,
                           type_list='EPISODES',
                           folder=settings.show_folder,
                           silence=True,
                           name_provider=settings.name_provider)
 else:
     settings.log(
         '[%s]>>>>>>>%s<<<<<<<' %
         (settings.name_provider_clean, browser.status))
     settings.dialog.notification(settings.name_provider,
                                  browser.status, settings.icon,
                         for quality in quality_keys:
                             for (magnet, name_file) in zip_list:
                                 if quality.lower() in name_file.lower():
                                     name_file = name_file.replace('_', ' ')
                                     magnet_list.append(magnet)
                                     pos = name_file.rfind('- ')
                                     name_file = name_file[:pos] + 'EP' + name_file[
                                         pos +
                                         2:]  # insert EP to be identificated in kodi
                                     file_list.append(name_file)
                     else:
                         loop = False
                 if len(file_list) > 0:
                     tools.integration(filename=file_list,
                                       magnet=magnet_list,
                                       type_list='SHOW',
                                       folder=settings.show_folder,
                                       name_provider=settings.name_provider)
 if rep == 1 and len(List_shows) > 0:  # Remove
     list_rep = settings.dialog.select('Choose Show to Remove',
                                       List_shows + ['CANCEL'])
     if list_rep < len(List_shows):
         if settings.dialog.yesno(
                 '', 'Do you want Remove %s?' % List_shows[list_rep]):
             del List_shows[list_rep]
 if rep == 2:  # List
     settings.dialog.select('Shows', List_shows)
 if rep == 3:  # Rebuild
     if settings.dialog.yesno(
             "Horriblesubs2PULSAR",
             "Do you want to rebuild the all the episodes?"):
Example #18
0
def update_service():
    path = translatePath('special://temp')
    # get the list
    try:
        with open(path + 'EZTV2PULSAR.txt', "r") as text_file:  # create .strm
            List_shows = [line.strip() for line in text_file]
            text_file.close()
    except:
        #convert from the old version
        database = shelve.open(path + 'EZTV2PULSAR.db')
        List_shows = []
        if database.has_key('list'):
            List_shows = database['list']
        else:
            List_shows = []

    # this read the settings
    settings = tools.Settings()
    # define the browser
    browser = tools.Browser()

    #Begin Service
    if settings.service == 'true':
        if settings.time_noti > 0:
            settings.dialog.notification(settings.name_provider,
                                         'Checking Online...', settings.icon,
                                         settings.time_noti)
        if len(List_shows) > 0:
            quality_keys = settings.settings.getSetting(
                'quality').lower().split(":")
            number = int(settings.settings.getSetting('number'))
            magnet_list = []
            file_list = []
            title_list = []
            if number == 0: number = 1  # manual pages if the parameter is zero
            for page in range(number + 1):
                if page == 0:
                    url_search = settings.url_address
                else:
                    url_search = '%s/page_%s' % (settings.url_address,
                                                 str(page))
                if browser.open(url_search):
                    data = browser.content
                    magnets = re.findall(r'magnet:\?[^\'"\s<>\[\]]+', data)
                    for quality in quality_keys:
                        for magnet in magnets:
                            for show in List_shows:
                                name_file = magnet.lower()
                                if quality == 'hdtv' and ('720p' in name_file
                                                          or '1080p'
                                                          in name_file):
                                    name_file = name_file.replace('hdtv', '')
                                if show.replace(' ', '.').lower(
                                ) in name_file and quality in name_file:
                                    magnet_list.append(magnet)
                                    file_list.append(
                                        re.search('&dn=(.*?)&',
                                                  magnet).group(1))
                                    title_list.append(show)
                        if int(page) % 10 == 0:
                            sleep(3000)  # to avoid too many connections
                else:
                    settings.log(
                        '[%s]>>>>>>>%s<<<<<<<' %
                        (settings.name_provider_clean, browser.status))
                    settings.dialog.notification(settings.name_provider,
                                                 browser.status, settings.icon,
                                                 1000)
            tools.integration(filename=file_list,
                              magnet=magnet_list,
                              title=title_list,
                              type_list='EPISODES',
                              silence=True,
                              folder=settings.show_folder,
                              name_provider=settings.name_provider)
        else:
            settings.dialog.notification(settings.name_provider, 'Empty List',
                                         settings.icon, settings.time_noti)
    del settings
    del browser
Example #19
0
def update_service():
    # this read the settings
    settings = tools.Settings()
    # define the browser
    browser = tools.Browser()
    #Begin Service
    if settings.service == 'true':
        if settings.time_noti > 0:
            settings.dialog.notification(settings.name_provider,
                                         'Checking Online...', settings.icon,
                                         settings.time_noti)
        list_url_search = []
        path = translatePath('special://temp')
        Dict_RSS = {}
        try:
            with open(path + 'RSS2PULSAR.txt', 'r') as fp:
                for line in fp:
                    listedline = line.strip().split(
                        '::')  # split around the :: sign
                    if len(listedline) > 1:  # we have the : sign in there
                        Dict_RSS[listedline[0]] = listedline[1]
        except:
            database = shelve.open(path + 'RSS2PULSAR.db')
            if database.has_key('dict'):
                Dict_RSS = database['dict']
        rep = 0
        list_url_search = Dict_RSS.values()
        if settings.time_noti > 0:
            settings.dialog.notification(settings.name_provider,
                                         'Checking Online...', settings.icon,
                                         settings.time_noti)
        # Begin reading
        for url_search in list_url_search:
            if url_search is not '':
                magnet_movie = []
                title_movie = []
                magnet_show = []
                title_show = []
                if settings.time_noti > 0:
                    settings.dialog.notification(settings.name_provider,
                                                 'Checking %s...' % url_search,
                                                 settings.icon,
                                                 settings.time_noti)
                acum = 0
                if browser.open(url_search):
                    items = re.findall('<item>(.*?)</item>', browser.content,
                                       re.S)
                    for item in items:
                        s_title = re.findall('title>(.*?)<', item)
                        s_link = re.findall(r'magnet:\?[^\'"\s<>\[\]]+', item)
                        if len(s_link) == 0:
                            s_link = re.findall(r'http://(.*?)[.]torrent',
                                                item)
                        if len(s_link) != 0:
                            if 'magnet' not in s_link[0]:
                                s_link[0] = 'http://' + s_link[0].replace(
                                    '&amp;', '&') + '.torrent'
                            if len(s_title) > 0:
                                if s_title[0] != '':
                                    info = tools.format_title(s_title[0])
                                    if 'MOVIE' in info['type']:
                                        title_movie.append(s_title[0])
                                        magnet_movie.append(s_link[0])
                                        acum += 1
                                    if 'SHOW' in info['type']:
                                        title_show.append(s_title[0])
                                        magnet_show.append(s_link[0])
                                        acum += 1
                    if acum == 0:
                        if settings.time_noti > 0:
                            settings.dialog.notification(
                                settings.name_provider,
                                'No Movies nor Shows!!', settings.icon,
                                settings.time_noti)
                    if len(title_movie) > 0:
                        tools.integration(filename=title_movie,
                                          magnet=magnet_movie,
                                          type_list='MOVIE',
                                          folder=settings.movie_folder,
                                          silence=True,
                                          name_provider=settings.name_provider)
                    if len(title_show) > 0:
                        tools.integration(filename=title_show,
                                          magnet=magnet_show,
                                          type_list='EPISODES',
                                          folder=settings.show_folder,
                                          silence=True,
                                          name_provider=settings.name_provider)
                else:
                    settings.log(
                        '[%s]>>>>>>>%s<<<<<<<' %
                        (settings.name_provider_clean, browser.status))
                    settings.dialog.notification(settings.name_provider,
                                                 browser.status, settings.icon,
                                                 1000)
    del settings
    del browser
def update_service():
    path = translatePath('special://temp')
    # get the Dictionary
    Dict_tvshows = {}
    try:
        with open(path + 'addertv2PULSAR.txt', 'r') as fp:
            for line in fp:
                listedline = line.strip().split(
                    '::')  # split around the :: sign
                if len(listedline) > 1:  # we have the : sign in there
                    Dict_tvshows[listedline[0]] = listedline[1]
    except:
        pass

    # this read the settings
    settings = tools.Settings()
    # define the browser
    browser = tools.Browser()

    # Begin Service
    if settings.service == 'true':
        if settings.time_noti > 0:
            settings.dialog.notification(settings.name_provider,
                                         'Checking Online...', settings.icon,
                                         settings.time_noti)
        if len(Dict_tvshows.keys()) > 0:
            magnet_list = []
            file_list = []
            title_list = []
            for (show, value) in Dict_tvshows.items():
                if settings.time_noti > 0:
                    settings.dialog.notification(
                        settings.name_provider,
                        'Checking Online for %s...' % show, settings.icon,
                        settings.time_noti)
                url_search = '%s/watch/%s' % (settings.url_address, value
                                              )  # search for the tvshow
                settings.log('[%s]%s' %
                             (settings.name_provider_clean, url_search))
                browser.open(url_search)
                data = browser.content
                if data is not None and len(data) > 0:
                    for item in re.findall(r'magnet:\?[^\'"\s<>\[\]]+', data):
                        info = tools.Magnet(item)
                        magnet_list.append(item)
                        file_list.append(info.name)
                        title_list.append(show)
            if len(file_list) > 0:
                tools.integration(title=title_list,
                                  filename=file_list,
                                  magnet=magnet_list,
                                  type_list='SHOW',
                                  folder=settings.show_folder,
                                  name_provider=settings.name_provider,
                                  silence=True)
        else:
            if settings.time_noti > 0:
                settings.dialog.notification(settings.name_provider,
                                             'Empty List', settings.icon,
                                             settings.time_noti)
    del settings
    del browser
                         magnet_movie.append(s_link[0])
                         acum += 1
                     if "SHOW" in info["type"]:
                         title_show.append(s_title[0])
                         magnet_show.append(s_link[0])
                         acum += 1
     if acum == 0:
         if settings.time_noti > 0:
             settings.dialog.notification(
                 settings.name_provider, "No Movies nor Shows!!", settings.icon, settings.time_noti
             )
     if len(title_movie) > 0:
         tools.integration(
             filename=title_movie,
             magnet=magnet_movie,
             type_list="MOVIE",
             folder=settings.movie_folder,
             silence=True,
             name_provider=settings.name_provider,
         )
     if len(title_show) > 0:
         tools.integration(
             filename=title_show,
             magnet=magnet_show,
             type_list="EPISODES",
             folder=settings.show_folder,
             silence=True,
             name_provider=settings.name_provider,
         )
 else:
     settings.log("[%s]>>>>>>>%s<<<<<<<" % (settings.name_provider_clean, browser.status))
     settings.dialog.notification(settings.name_provider, browser.status, settings.icon, 1000)
Example #22
0
    settings.pages = settings.dialog.numeric(0, 'Number of pages:')
    if settings.pages == '' or settings.pages == 0:
        settings.pages = "1"
    settings.pages = int(settings.pages)
    for page in range(1, settings.pages + 1):
        if settings.time_noti > 0: settings.dialog.notification(settings.name_provider, 'Checking Page %s...' %
            page, settings.icon, settings.time_noti)
        settings.log('[%s] %s%d' % (settings.name_provider_clean, url_search, page))
        if browser.open(url_search + str(page)):
            data = browser.content
            for (torrent, name) in re.findall(r'/torrent/(.*?)/(.*?)"', data):
                title.append(name.replace('-', ' '))
                magnet.append(settings.url_address + '/get-torrent/' + torrent)  # create torrent to send P
            if int(page) % 10 == 0: sleep(3000)  # to avoid too many connections
        else:
            settings.log('[%s] >>>>>>>%s<<<<<<<' % (settings.name_provider_clean, browser.status))
            settings.dialog.notification(settings.name_provider, browser.status, settings.icon, 1000)
            break
    if len(title) > 0 and 'Series' not in list_options[ret]:
        tools.integration(filename=title, magnet=magnet, type_list='MOVIE', folder=settings.movie_folder,
                          name_provider=settings.name_provider)
    if len(title) > 0 and 'Series' in list_options[ret]:
        tools.integration(filename=title, magnet=magnet, type_list='SHOW', folder=settings.show_folder,
                          name_provider=settings.name_provider)
if ret == len(options):  # Settings
    settings.settings.openSettings()
    settings = tools.Settings()
if ret == len(options) + 1:  # Help
        settings.dialog.ok("Help", "Please, check this address to find the user's operation:\n[B]http://goo.gl/0b44BY[/B]")
del settings
del browser
Example #23
0
            if 'Success' in data['message']:
                for item in data['data']:
                    title.append(item['title'])
                    url_search.append(item['url'].replace('\\', ''))
            rep = settings.dialog.select('Which Movie:', title + ['CANCEL'])
            if rep < len(title):
                browser.open(url_search[rep])
                data = browser.content
                qualities = re.findall('id="modal-quality-(.*?)"', data)
                magnet = re.findall(r'magnet:\?[^\'"\s<>\[\]]+', data)
                ret = settings.dialog.select('Which Quality:',
                                             qualities + ['CANCEL'])
                if ret < len(qualities):
                    tools.integration(filename=[title[rep]],
                                      magnet=[magnet[ret]],
                                      type_list='MOVIE',
                                      folder=settings.movie_folder,
                                      name_provider=settings.name_provider)
        else:
            settings.log('[%s] >>>>>>>%s<<<<<<<' %
                         (settings.name_provider_clean, browser.status))
            settings.dialog.notification(settings.name_provider,
                                         browser.status, settings.icon, 1000)
elif ret == 1:
    qualities = ['720p', '1080p', '3D']
    sorts = [
        'Year', 'Rating', 'Seeds', 'Downloaded Count', 'Like Count',
        'Date Addded'
    ]
    quality = settings.dialog.select('Quality:', qualities)
    sort = settings.dialog.select('Sorting by:', sorts)
                     if seasons[season].lower() in name_file or seasons[
                             season] == 'ALL':  # check for the right season to add
                         if quality == 'hdtv' and ('720p' in name_file
                                                   or '1080p' in name_file):
                             name_file = name_file.replace('hdtv', '')
                         if quality in name_file:
                             magnet_list.append(magnet)
                             title = magnet[
                                 magnet.find('&dn=') +
                                 4:] + '&'  # find the start of the name
                             title = title[:title.find('&')]
                             file_list.append(title)
                             title_list.append(name)
             tools.integration(filename=file_list,
                               magnet=magnet_list,
                               title=title_list,
                               type_list='EPISODES',
                               folder=settings.show_folder,
                               name_provider=settings.name_provider)
 if rep == 1 and len(List_shows) > 0:  # Remove Show
     list_rep = settings.dialog.select('Choose Show to Remove',
                                       List_shows + ['CANCEL'])
     if list_rep < len(List_shows):
         if settings.dialog.yesno(
                 settings.name_provider,
                 'Do you want Remove %s?' % List_shows[list_rep]):
             del List_shows[list_rep]
 if rep == 2:  # View Show
     settings.dialog.select('Shows', List_shows)
 if rep == 3:  # Rebuild Strm files
     if settings.dialog.yesno(
             "EZTV2PULSAR", "Do you want to rebuild the all the episodes?"):
             season = settings.dialog.select('Season:', seasons)
             print seasons[season]
             magnets = re.findall(r'magnet:\?[^\'"\s<>\[\]]+', data)
             for quality in quality_keys:
                 for magnet in magnets:
                     name_file = magnet.lower() + ' hdtv'  # take any file as hdtv by default
                     if seasons[season].lower() in name_file or seasons[season] == 'ALL':  # check for the right season to add
                         if quality == 'hdtv' and ('720p' in name_file or '1080p' in name_file):
                             name_file = name_file.replace('hdtv', '')
                         if quality in name_file:
                             magnet_list.append(magnet)
                             title = magnet[magnet.find('&dn=') + 4:] + '&' # find the start of the name
                             title = title[:title.find('&')]
                             file_list.append(title)
                             title_list.append(name)
             tools.integration(filename=file_list, magnet=magnet_list, title=title_list, type_list='EPISODES', folder=settings.show_folder, name_provider=settings.name_provider)
 if rep == 1 and len(List_shows) > 0:  # Remove Show
     list_rep = settings.dialog.select('Choose Show to Remove', List_shows + ['CANCEL'])
     if list_rep < len(List_shows):
         if settings.dialog.yesno(settings.name_provider, 'Do you want Remove %s?' % List_shows[list_rep]):
             del List_shows[list_rep]
 if rep == 2:  # View Show
     settings.dialog.select('Shows', List_shows)
 if rep == 3:  # Rebuild Strm files
     if settings.dialog.yesno("EZTV2PULSAR","Do you want to rebuild the all the episodes?"):
         quality_options = ['HDTV:720p:1080p', '1080p:720p:HDTV', '720p:1080p', '1080p:720p', 'HDTV:720p', '720p:HDTV', 'HDTV',
                            '720p', '1080p']
         quality_ret = settings.dialog.select('Quality:', quality_options)
         quality_keys = quality_options[quality_ret].lower().split(":")
         number = int(settings.settings.getSetting('number'))
         if len(List_name) == 0: