Пример #1
0
def search_results(imdb, session, settings, url, type='movie'):
    debug('search_results: url = ' + url)

    enumerator = TrackerPostsEnumerator(session)
    enumerator.settings = settings

    from log import dump_context
    with dump_context('nnmclub.enumerator.process_page'):
        enumerator.process_page(real_url(url, settings))
    result = []
    for post in enumerator.items():
        if 'seeds' in post and int(post['seeds']) < 5:
            continue

        if type == 'movie':
            parser = DescriptionParser(post['a'],
                                       settings=settings,
                                       tracker=True)
        elif type == 'tvshow':
            parser = DescriptionParserTVShows(post['a'],
                                              settings=settings,
                                              tracker=True)
        else:
            break
        if parser.parsed() and parser.get_value('imdb_id') == imdb:
            result.append({'parser': parser, 'link': post['dl_link']})

    return result
Пример #2
0
def search_results(imdb, session, settings, url, cat):
    debug('search_results: url = ' + url)

    enumerator = TrackerPostsEnumerator(session)

    from log import dump_context
    with dump_context('bluebird.enumerator.process_page'):
        enumerator.process_page(url)

    result = []
    for post in enumerator.items():
        if 'seeds' in post and int(post['seeds']) < 5:
            continue

        if str(post.get('cat', '')) != str(cat):
            continue

        # full_title, content, link, settings

        url = real_url(post['a'])
        page = session.get(url, headers={'Referer': real_url('/browse.php')})

        soup = BeautifulSoup(page.text, "html.parser")

        content = ''
        tbl = soup.find('table', attrs={'id': 'highlighted'})

        for td in tbl.find_all('td', class_='heading'):
            tdn = td.next_sibling
            content += unicode(tdn)

        img = soup.find('img', attrs={'title': "IMDB"})
        if img:
            content += unicode(img.parent)

        img = soup.find('img', attrs={'title': u"Кинопоиск"})
        if img:
            content += unicode(img.parent)

        parser = DescriptionParser(post['title'],
                                   content,
                                   origin_url(post['a']),
                                   settings=settings,
                                   imdb=imdb)

        debug(
            u'%s %s %s' %
            (post['title'], str(parser.parsed()), parser.get_value('imdb_id')))
        if parser.parsed():  # and parser.get_value('imdb_id') == imdb:
            result.append({
                'parser': parser,
                'link': origin_url(post['dl_link'])
            })

    return result
Пример #3
0
def search_results(imdb, settings, url, what=None):
    result = []

    enumerator = PostsEnumerator(settings)

    from log import dump_context
    with dump_context('rutor.enumerator.process_page'):
        enumerator.process_page(url)

    for post in enumerator.items():
        try:
            if 'seeds' in post and int(post['seeds']) < 1:
                continue
        except ValueError:
            pass

        title = post['a'].get_text()
        dl_link = str('http://rutor.info' + post['dl_link'])
        link = get_source_url(dl_link)

        import copy
        s = copy.copy(settings)
        if not imdb:
            s.no_skip_by_imdb = True

        if is_tvshow(title):
            parser = DescriptionParserRSSTVShows(
                title, link, s
            )  #parser = DescriptionParser(post['a'], settings=settings, tracker=True)
        else:
            parser = DescriptionParserRSS(title, link, s)
        if parser.parsed():
            if (imdb and parser.get_value('imdb_id') == imdb):
                result.append({'parser': parser, 'link': dl_link})
            elif what and parser.Dict().get('title') == what:
                result.append({'parser': parser, 'link': dl_link})

    return result
Пример #4
0
def update_service(show_progress=False):

    import anidub, hdclub, nnmclub, rutor, soap4me, bluebird, kinohd

    from player import _addon

    anidub_enable = _addon.getSetting('anidub_enable') == 'true'
    hdclub_enable = False
    bluebird_enable = _addon.getSetting('bluebird_enable') == 'true'
    nnmclub_enable = _addon.getSetting('nnmclub_enable') == 'true'
    rutor_enable = _addon.getSetting('rutor_enable') == 'true'
    soap4me_enable = _addon.getSetting('soap4me_enable') == 'true'
    kinohd_enable = _addon.getSetting('kinohd_enable') == 'true'

    from player import load_settings
    settings = load_settings()

    import time
    from_time = time.time()

    if show_progress:
        import xbmcgui
        info_dialog = xbmcgui.DialogProgressBG()
        info_dialog.create(settings.addon_name)
        settings.progress_dialog = info_dialog

    from log import dump_context

    if anidub_enable:
        with dump_context('anidub.run'):
            anidub.run(settings)

    #if hdclub_enable:
    #	hdclub.run(settings)

    if bluebird_enable:
        with dump_context('bluebird.run'):
            bluebird.run(settings)

    if rutor_enable:
        with dump_context('rutor.run'):
            rutor.run(settings)

    if kinohd_enable:
        with dump_context('kinohd.run'):
            kinohd.run(settings)

    if nnmclub_enable:
        from service import Addon
        addon = Addon('settings3.xml')

        try:
            import math
            from time import time
            settings.nnmclub_hours = int(
                math.ceil(
                    (time() - float(addon.getSetting('nnm_last_generate'))) /
                    3600.0))
        except BaseException as e:
            settings.nnmclub_hours = 168
            log.print_tb(e)

        if settings.nnmclub_hours > 168:
            settings.nnmclub_hours = 168

        if settings.nnmclub_hours < 8:
            settings.nnmclub_hours = 8

        log.debug('NNM hours: ' + str(settings.nnmclub_hours))

        addon.setSetting('nnm_last_generate', str(time()))

        with dump_context('nnmclub.run'):
            nnmclub.run(settings)

    #if soap4me_enable:
    #	import soap4me
    #	soap4me.run(settings)

    if show_progress:
        info_dialog.update(0, '', '')
        info_dialog.close()

    if anidub_enable or nnmclub_enable or rutor_enable or soap4me_enable or bluebird_enable or kinohd_enable:
        import xbmc
        if not xbmc.getCondVisibility('Library.IsScanningVideo'):
            xbmc.executebuiltin('UpdateLibrary("video")')

    recheck_torrent_if_need(from_time, settings)
Пример #5
0
def add_media_process(title, imdb):
    count = 0

    from player import getSetting, load_settings
    import anidub, hdclub, nnmclub, rutor, soap4me, bluebird, kinohd

    settings = load_settings()

    anidub_enable = getSetting('anidub_enable') == 'true'
    hdclub_enable = False
    bluebird_enable = getSetting('bluebird_enable') == 'true'
    nnmclub_enable = getSetting('nnmclub_enable') == 'true'
    rutor_enable = getSetting('rutor_enable') == 'true'
    soap4me_enable = getSetting('soap4me_enable') == 'true'
    kinohd_enable = getSetting('kinohd_enable') == 'true'

    class RemoteDialogProgress:
        progress_file_path = filesystem.join(addon_data_path(),
                                             '.'.join([imdb, 'progress']))

        def update(self, percent, *args, **kwargs):
            with filesystem.fopen(self.progress_file_path,
                                  'w') as progress_file:
                progress_file.write(str(percent) + '\n')
                progress_file.write('\n'.join(args).encode('utf-8'))

        def close(self):
            try:
                filesystem.remove(self.progress_file_path)
            except:
                pass

    settings.progress_dialog = RemoteDialogProgress()

    p = []

    from log import dump_context
    #try:
    if True:
        if anidub_enable and imdb.startswith('sm'):
            with dump_context('anidub.search_generate'):
                c = anidub.search_generate(title, settings, p)
                count += c

        if imdb.startswith('tt'):
            #if hdclub_enable:
            #	c = hdclub.search_generate(title, imdb, settings, p)
            #	count += c
            if bluebird_enable:
                with dump_context('bluebird.search_generate'):
                    c = bluebird.search_generate(title, imdb, settings, p)
                    count += c
            if rutor_enable:
                with dump_context('rutor.search_generate'):
                    c = rutor.search_generate(title, imdb, settings, p)
                    count += c
            if kinohd_enable:
                with dump_context('kinohd.search_generate'):
                    c = kinohd.search_generate(title, imdb, settings, p)
                    count += c

            if nnmclub_enable:
                with dump_context('nnmclub.search_generate'):
                    c = nnmclub.search_generate(title, imdb, settings, p)
                    count += c
            #if soap4me_enable:
            #	count += soap4me.search_generate(title, imdb, settings)
    #except BaseException as e:
    #	log.print_tb(e)

    if p:
        path = filesystem.join(addon_data_path(), imdb + '.strm_path')
        with filesystem.fopen(path, 'w') as f:
            f.write(p[0].encode('utf-8'))

    settings.progress_dialog.close()

    if count:
        import xbmc
        if not xbmc.getCondVisibility('Library.IsScanningVideo'):
            if p and p[0]:
                path = p[0]

                if path.endswith('.strm'):
                    type = 'movies'
                else:
                    type = 'tvshows'

                base_path = filesystem.dirname(p[0])

                from sources import Sources
                srcs = Sources()
                for src in srcs.get('video', normalize=False):
                    src_path_basename = filesystem.basename(
                        src.path.rstrip('\\/'))
                    if src_path_basename == base_path:  #base_path.lower().replace('\\', '/') in src.path.lower().replace('\\', '/'):
                        path_update = src.path
                        if type == 'tvshows':
                            if src.path.startswith('smb://'):
                                path_update = src.path
                                path_update = path_update.strip(
                                    '\\/') + '/' + filesystem.basename(path)
                            else:
                                path_update = filesystem.join(
                                    src.path, filesystem.basename(path))
                        log.debug(path_update)
                        xbmc.executebuiltin('UpdateLibrary("video","%s")' %
                                            path_update.encode('utf-8'))

                #xbmc.executebuiltin('UpdateLibrary("video")')
            else:
                xbmc.executebuiltin('UpdateLibrary("video")')

            xbmc.sleep(250)
            while xbmc.getCondVisibility('Library.IsScanningVideo'):
                xbmc.sleep(100)

    path = filesystem.join(addon_data_path(), imdb + '.ended')
    with filesystem.fopen(path, 'w') as f:
        f.write(str(count))
Пример #6
0
    return count


if __name__ == '__main__':
    settings = Settings(r'c:\Users\vd\Videos')
    settings.addon_data_path = u"c:\\Users\\vd\\AppData\\Roaming\\Kodi\\userdata\\addon_data\\script.media.aggregator\\"
    settings.rutor_domain = 'new-rutor.org'
    settings.torrent_path = u'c:\\Users\\vd\\AppData\\Roaming\\Kodi\\userdata\\addon_data\\script.media.aggregator'
    settings.torrent_player = 'torrent2http'
    settings.kp_googlecache = True
    settings.kp_usezaborona = True
    settings.use_kinopoisk = False
    settings.use_worldart = True

    path_out = []
    #search_generate(u'Ольга', 'tt6481562', settings, path_out)

    #import time
    #from_time = time.time()

    #from backgrounds import recheck_torrent_if_need

    from log import dump_context
    with dump_context('rutor.run'):
        run(settings)

    #recheck_torrent_if_need(from_time, settings)

    #search_generate(None, 'tt2948356', settings)