Esempio n. 1
0
    def create_top_menu(self):
        """ Menu at top of app """

        self.menu = tk.Menu(self, tearoff=False)
        self.config(menu=self.menu)
        editmenu = tk.Menu(self, tearoff=False)
        helpmenu = tk.Menu(self, tearoff=False)

        self.submenus = {
            'Edit': (editmenu, [
                ('Settings', lambda: tools.Settings(self, self.settingsfile)),
                ("Action Editor", lambda: tools.Action_Editor(self, DATAPATH))
            ]),
            'Help': (helpmenu, [
                ('Device Report', lambda: self.view_device_report()),
                ('User Guide', lambda: tools.User_Guide(self, USERGUIDE)),
                ('License', lambda: tools.License(self, LICENSE)),
                ('Anti-Cheat Policy',
                 lambda: tools.AntiCheatPolicy(self, ANTICHEATPOLICY)),
                ('Community', lambda: webbrowser.open(
                    'https://www.reddit.com/r/Sparlab/', new=2)),
                ('Check for Update', lambda: self.check_for_update())
            ])
        }

        for k, v in self.submenus.items():
            self.menu.add_cascade(label=k, menu=v[0])
            for i in v[1]:

                command = i[1]
                v[0].add_command(label=i[0], command=command)
Esempio n. 2
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():
    # 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
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
Esempio n. 5
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
#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()

rep = 0
List_name = []
List_name_id = []
while rep is not 7:
    rep = settings.dialog.select('Choose an Option:', [
        'Add a New Show', 'Remove a Show', 'View The List',
        'ReBuild All Episodes', 'Sync .strm Files', '-SETTINGS', '-HELP',
        'Exit'
    ])
    if rep == 0:  # Add new Show
        if len(List_name) == 0:
            if settings.time_noti > 0:
Esempio n. 7
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
Esempio n. 8
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
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()

rep = 0
List_name = []
while rep is not 7:
    rep = settings.dialog.select('Choose an Option:', [
        'Add a New Anime', 'Remove a Anime', 'View The List',
        'ReBuild All Episodes', 'Sync .strm Files', '-SETTINGS', '-HELP',
        'Exit'
    ])
    if rep == 0:  # Add a New Anime
        list_name = search_anime()
        if len(list_name) > 0:
            selection = settings.dialog.select('Select One Show:', list_name +
def update_service():
    # this read the settings
    settings = tools.Settings()
    browser = tools.Browser()
    filters = tools.Filtering()

    # using function from Steeve to add Provider's name and search torrent
    def extract_magnets(data):
        try:
            filters.information()  # print filters settings
            data = tools.clean_html(data)
            size = re.findall('Size (.*?)B', data)  # list the size
            seedsPeers = re.findall('<td align="right">(.*?)</td>',
                                    data)  # list the size
            seeds = seedsPeers[0:][::2]
            peers = seedsPeers[1:][::2]
            cont = 0
            results = []
            for cm, magnet in enumerate(
                    re.findall(r'magnet:\?[^\'"\s<>\[\]]+', data)):
                name = re.search('dn=(.*?)&',
                                 magnet).group(1)  # find name in the magnet
                infohash = re.search(':btih:(.*?)&', magnet).group(
                    1)  # find name in the magnet
                name = unquote_plus(name).replace('.', ' ').title()
                if filters.verify(name, size[cm].replace('&nbsp;', ' ')):
                    results.append({
                        "name":
                        name,
                        "uri":
                        magnet,
                        "info_hash":
                        infohash,
                        "size":
                        tools.size_int(size[cm].replace('&nbsp;', ' ')),
                        "seeds":
                        int(seeds[cm]),
                        "peers":
                        int(peers[cm]),
                        "language":
                        settings.language,
                        "trackers":
                        settings.trackers
                    })  # return le torrent
                    cont += 1
                # this is common for every provider
                else:
                    settings.log(
                        '[%s]%s' %
                        (settings.name_provider_clean, filters.reason))
                if cont == settings.max_magnets:  # limit magnets
                    break
            return results
        except:
            settings.log('[%s]%s' % (settings.name_provider_clean,
                                     '>>>>>>>ERROR parsing data<<<<<<<'))
            settings.dialog.notification(settings.name_provider,
                                         '>>>>>>>ERROR parsing data<<<<<<<<',
                                         settings.icon, 1000)

    def search(query='', type='', silence=False):
        results = []
        if type == 'MOVIE':
            folder = settings.movie_folder
        else:
            folder = settings.show_folder
        # start to search
        if settings.pages == 0:
            settings.pages = 1  # manual pages if the parameter is zero
        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)

    # define the browser
    if Addon().getSetting('movies') == 'true':  # Movies
        query = '%s/browse/201/%s/7'
        search(query, 'MOVIE', True)
    if Addon().getSetting('movies-hd') == 'true':  # HD - Movies
        query = '%s/browse/207/%s/7'
        search(query, 'MOVIE', True)
    if Addon().getSetting('movies-dvd') == 'true':  # Movies DVD
        query = '%s/browse/202/%s/7'
        search(query, 'MOVIE', True)
    if Addon().getSetting('movies-3D') == 'true':  # 3D
        query = '%s/browse/209/%s/7'
        search(query, 'MOVIE', True)
    if Addon().getSetting('tvshows') == 'true':  # TV shows
        query = '%s/browse/205/%s/7'
        search(query, 'SHOW', True)
    if Addon().getSetting('tvshows-hd') == 'true':  # HD - TV shows
        query = '%s/browse/208/%s/7'
        search(query, 'SHOW', True)