Exemple #1
0
    def get_next_page(self, mode, url, pattern, site='', parse=None):

        try:
            dirlst = []
            icon = xbmc.translatePath(
                os.path.join('special://home/addons/script.xxxodus.artwork',
                             'resources/art/main/next.png'))
            fanart = xbmc.translatePath(
                os.path.join('special://home/addons/script.xxxodus.artwork',
                             'resources/art/%s/fanart.jpg' % site))
            if '|GOT_URL' in url:
                url = url.split('|GOT_URL')[0]
                dirlst.append({
                    'name': kodi.giveColor('Next Page -->', 'white'),
                    'url': url,
                    'mode': mode,
                    'icon': icon,
                    'fanart': fanart,
                    'description': 'Load More......',
                    'folder': True
                })
            else:
                r = client.request(url)
                url = re.findall(r'%s' % pattern, r)[0]
                if parse: url = urlparse.urljoin(parse, url)
                if '&' in url: url = url.replace('&', '&')
                dirlst.append({
                    'name': kodi.giveColor('Next Page -->', 'white'),
                    'url': url,
                    'mode': mode,
                    'icon': icon,
                    'fanart': fanart,
                    'description': 'Load More......',
                    'folder': True
                })
            if 'chaturbate' in url:
                if dirlst:
                    buildDirectory(dirlst, isVideo=True, chaturbate=True)
            else:
                if dirlst: buildDirectory(dirlst, isVideo=True)
        except Exception as e:
            log_utils.log(
                'Error getting next page for %s :: Error: %s' %
                (site.title(), str(e)), log_utils.LOGERROR)
            xbmcplugin.setContent(kodi.syshandle, 'movies')
            utils.setView('thumbs')
            xbmcplugin.endOfDirectory(kodi.syshandle, cacheToDisc=True)
Exemple #2
0
def run(conf):

    pp = pprint.PrettyPrinter()
    # pp.pprint(conf)

    # Make sure the global configuration is in place
    utils.run_global_visit_configuration(conf)

    visitConf = utils.getValueForKeyPath(conf,'postprocessing.tracks.visit')
    if not visitConf:
        print "No configuration for visuals. Nothing to do."
        return 0

    # Set up background gradient, axis labels etc.
    utils.setAnnotations(conf,'postprocessing.tracks.visit.annotationAttributes')

    # Set the view straight
    utils.setView(conf,'postprocessing.tracks.visit.view')

    # Plot the map data
    utils.plotMapdata(conf,'postprocessing.tracks.visit.map')

    # Plot the tracks
    trackPlotConf = utils.getValueForKeyPath(conf,'postprocessing.tracks.visit.track')
    # pp.pprint(trackPlotConf)

    currentDirectory = os.path.abspath(os.getcwd())
    os.chdir(conf['tracks_dir'])

    if trackPlotConf:

        # Save value of legend flag
        legendFlag = trackPlotConf['PseudocolorAttributes']['legendFlag']

        # Plot the Tracks
        # track_pattern = conf['tracks_dir'] + "/*-track_*.vtk"

        track_pattern =  "*-track_*.vtk"
        list = sorted(glob.glob(track_pattern))
        print "Looking with pattern " + track_pattern
        print "Found %d track files." % len(list)
        count = 0;
        for trackFile in list:

            # add plot
            # trackFile = conf['tracks_dir'] + os.path.sep + fname

            # plot the legend for the first one only
            if (count == 1) and legendFlag:
                trackPlotConf['PseudocolorAttributes']['legendFlag'] = 0
                # pp.pprint(trackPlotConf)

            # Plot the actual track data
            file = conf['tracks_dir'] + os.path.sep + trackFile
            print "Adding plot for " + file
            utils.addPseudocolorPlot(file,trackPlotConf)

            count = count + 1

            # in case the script is being debugged, exit the script
            # after 10 tracks. This could be configured
            # if getValueForKeyPath(conf,'postprocessing.debugVisitScript') and count > 10

        # Restore flag value
        trackPlotConf['PseudocolorAttributes']['legendFlag'] = legendFlag
        # pp.pprint(trackPlotConf)

    print "Drawing plots"
    visit.DrawPlots()

    print "Saving image to %s" % os.getcwd()
    utils.saveImage("tracks",0)

    os.chdir(currentDirectory)

    return
Exemple #3
0
def run(conf):

    pp = pprint.PrettyPrinter()
    # pp.pprint(conf)

    # Make sure the global configuration is in place
    utils.run_global_visit_configuration(conf)

    visitConf = utils.getValueForKeyPath(conf, 'postprocessing.tracks.visit')
    if not visitConf:
        print "No configuration for visuals. Nothing to do."
        return 0

    # Set up background gradient, axis labels etc.
    utils.setAnnotations(conf,
                         'postprocessing.tracks.visit.annotationAttributes')

    # Set the view straight
    utils.setView(conf, 'postprocessing.tracks.visit.view')

    # Plot the map data
    utils.plotMapdata(conf, 'postprocessing.tracks.visit.map')

    # Plot the tracks
    trackPlotConf = utils.getValueForKeyPath(
        conf, 'postprocessing.tracks.visit.track')
    # pp.pprint(trackPlotConf)

    currentDirectory = os.path.abspath(os.getcwd())
    os.chdir(conf['tracks_dir'])

    if trackPlotConf:

        # Save value of legend flag
        legendFlag = trackPlotConf['PseudocolorAttributes']['legendFlag']

        # Plot the Tracks
        # track_pattern = conf['tracks_dir'] + "/*-track_*.vtk"

        track_pattern = "*-track_*.vtk"
        list = sorted(glob.glob(track_pattern))
        print "Looking with pattern " + track_pattern
        print "Found %d track files." % len(list)
        count = 0
        for trackFile in list:

            # add plot
            # trackFile = conf['tracks_dir'] + os.path.sep + fname

            # plot the legend for the first one only
            if (count == 1) and legendFlag:
                trackPlotConf['PseudocolorAttributes']['legendFlag'] = 0
                # pp.pprint(trackPlotConf)

            # Plot the actual track data
            file = conf['tracks_dir'] + os.path.sep + trackFile
            print "Adding plot for " + file
            utils.addPseudocolorPlot(file, trackPlotConf)

            count = count + 1

            # in case the script is being debugged, exit the script
            # after 10 tracks. This could be configured
            # if getValueForKeyPath(conf,'postprocessing.debugVisitScript') and count > 10

        # Restore flag value
        trackPlotConf['PseudocolorAttributes']['legendFlag'] = legendFlag
        # pp.pprint(trackPlotConf)

    print "Drawing plots"
    visit.DrawPlots()

    print "Saving image to %s" % os.getcwd()
    utils.saveImage("tracks", 0)

    os.chdir(currentDirectory)

    return