Пример #1
0
    def update_item(self, i):
        self.item['mode'] = self.mode
        self.item['title'] = utfenc(self.title)
        self.item['plot'] = utfenc(self.description)
        self.item['id'] = self.id
        self.item['type'] = utfenc(resources(self.type))

        if self.params:
            self.item['params'] = self.params

        if (self.type == 'UpComing' or 'Scheduled' in i.get(
                'Id', '')) or (self.type == 'Highlights'):
            if self.type == 'UpComing':
                day = resources(days(self.type, self.now, self.start))
                sub_title = unicode('%s %s' % (day, self.start[11:][:5]))
            else:
                sub_title = resources(self.type)
            self.item['params'] = i['Id'].split(':')[0]
            self.item['title'] = utfenc(
                unicode('%s (%s)' % (self.title, sub_title)))

        if i.get('ListingStartTime', None):
            self.item['date'] = utc2local(i['ListingStartTime'])[:10]

        if self.related:
            self.item['cm'] = self.related

        self.add_thumb(i)
        self.add_duration(i)
Пример #2
0
    def update_item(self, i):
        self.item['mode']  = self.mode
        self.item['title'] = utfenc(self.title)
        self.item['plot']  = utfenc(self.description)
        self.item['id']    = self.id
        self.item['type']  = utfenc(resources(self.type))

        if self.params:
            self.item['params'] = self.params
            
        if (self.type == 'UpComing' or 'Scheduled' in i.get('Id', '')) or (self.type == 'Highlights'):
            if self.type == 'UpComing':
                day = resources(days(self.type, self.now, self.start))
                sub_title = unicode('%s %s' % (day, self.start[11:][:5]))
            else:
                sub_title = resources(self.type)
            self.item['params'] = i['Id'].split(':')[0]
            self.item['title']  = utfenc(unicode('%s (%s)' % (self.title, sub_title)))
            
        if i.get('ListingStartTime', None):
            self.item['date'] = utc2local(i['ListingStartTime'])[:10]
            
        if self.related:
            self.item['cm'] = self.related
        
        self.add_thumb(i)
        self.add_duration(i)
Пример #3
0
 def date_item(day):
     return {
         'mode': 'epg',
         'title': '%s (%s)' % (resources(day.strftime('%A')), day.strftime(date_format)),
         'plot': '%s (%s)' % (resources(date.strftime('%A')), date.strftime(date_format)),
         'params': day,
         'cm': cm
     }
Пример #4
0
    def __init__(self,
                 d=20,
                 motor_driver=motor_controller.gpio,
                 motor_setup=motor_controller.mecanum):
        #set logger field and setup logger
        self.logger = logger.logger()
        self.resources = resources.resources()

        self.motors = m_con(self.logger, d, motor_setup, motor_driver)

        #create lidar object
        #self.lidar = lidar.lidar(self.pwm, logger)

        #camera is not eseential, so we can ignore erros:
        #create camera controlller object without flipping the image
        try:
            self.camera = camera_controller.camera_controller(
                self.pwm, False, self.logger)
        except Exception as e:
            self.logger.warning("camera init error: " + repr(e))
#the following are NOT essential, so we can ignore errors if any occur
        try:
            auth = tweepy.OAuthHandler(config.twitter_consumer_key,
                                       config.twitter_consumer_secret)
            auth.set_access_token(config.twitter_access_token,
                                  config.twitter_access_secret)
            self.twitter = tweepy.API(auth)
        except Exception as e:
            self.logger.warning("failed to initiate tweepy: " + repr(e))
Пример #5
0
 def date_item(params, id):
     return {
         'mode':
         'epg',
         'title':
         '%s (%s)' %
         (resources(id.strftime('%A')), id.strftime(date_format)),
         'plot':
         '%s (%s)' % (resources(epg_date(date).strftime('%A')),
                      epg_date(date).strftime(date_format)),
         'id':
         id.strftime(date_format),
         'params':
         params.strftime(date_format),
         'cm':
         cm
     }
Пример #6
0
 def __init__(self, i):
     self.item = {}
     self.item['mode']  = 'rail'
     self.item['title'] = utfenc(resources(i['Id']))
     self.item['id']    = i['Id']
     self.item['plot']  = i['Id']
     if i.get('Params', ''):
         self.item['params'] = i['Params']
Пример #7
0
 def __init__(self, i):
     self.item = {}
     self.item['mode'] = 'rail'
     self.item['title'] = utfenc(resources(i['Id']))
     self.item['id'] = i['Id']
     self.item['plot'] = i['Id']
     if i.get('Params', ''):
         self.item['params'] = i['Params']
Пример #8
0
    def update_item(self, i):
        self.item['mode'] = self.mode
        self.item['title'] = utfenc(self.title)
        self.item['plot'] = utfenc(self.description)
        self.item['id'] = self.id
        self.item['type'] = utfenc(resources(self.type))

        if self.params:
            self.item['params'] = self.params

        if 'Epg' in i.get('Id', ''):
            if self.competition:
                competition = self.competition['Title']
            if self.sport:
                sport = self.sport['Title']
            time = self.start[11:][:5]
            if self.type == 'Live':
                self.item['title'] = utfenc(
                    unicode(
                        '[COLOR red]%s[/COLOR] [COLOR dimgray]%s[/COLOR] %s [COLOR dimgray]%s[/COLOR]'
                        % (time, sport, self.title, competition)))
            else:
                self.item['title'] = utfenc(
                    unicode(
                        '%s [COLOR dimgray]%s[/COLOR] %s [COLOR dimgray]%s[/COLOR]'
                        % (time, sport, self.title, competition)))

        elif (self.type == 'UpComing' or 'Scheduled' in i.get(
                'Id', '')) or (self.type == 'Highlights'):
            if self.type == 'UpComing':
                day = resources(days(self.type, self.now, self.start))
                sub_title = unicode('%s %s' % (day, self.start[11:][:5]))
            else:
                sub_title = resources(self.type)
            self.item['title'] = utfenc(
                unicode('%s (%s)' % (self.title, sub_title)))

        if self.start:
            self.item['date'] = self.start[:10]

        self.item['related'] = self.related
        self.item['sport'] = self.sport
        self.item['competition'] = self.competition

        self.add_thumb(i)
        self.add_duration(i)
Пример #9
0
 def date_item(params, _id):
     return {
         'mode':
         'epg',
         'title':
         '{0} {1}'.format(resources(_id.strftime('%A')),
                          _id.strftime(date_format)),
         'plot':
         '{0} {1}'.format(resources(epg_date(date).strftime('%A')),
                          epg_date(date).strftime(date_format)),
         'id':
         _id.strftime(date_format),
         'params':
         params.strftime(date_format),
         'cm':
         cm
     }
Пример #10
0
    def update_item(self, i):
        self.item['mode'] = self.mode
        self.item['title'] = self.title
        self.item['plot'] = self.description
        self.item['id'] = self.id
        self.item['type'] = utfenc(resources(self.type))

        if self.params:
            self.item['params'] = self.params

        if 'Epg' in i.get('Id', ''):
            if self.competition:
                competition = utfenc(self.competition['Title'])
            if self.sport:
                sport = utfenc(self.sport['Title'])
            time = self.start[11:][:5]
            if self.type == 'Live':
                self.item[
                    'title'] = '[COLOR red]{0}[/COLOR] [COLOR dimgray]{1}[/COLOR] {2} [COLOR dimgray]{3}[/COLOR]'.format(
                        time, sport, self.title, competition)
            else:
                self.item[
                    'title'] = '{0} [COLOR dimgray]{1}[/COLOR] {2} [COLOR dimgray]{3}[/COLOR]'.format(
                        time, sport, self.title, competition)

        elif (self.type == 'UpComing' or 'Scheduled' in i.get(
                'Id', '')) or (self.type == 'Highlights'):
            if self.type == 'UpComing':
                day = resources(days(self.type, self.now, self.start))
                sub_title = '{0} {1}'.format(utfenc(day), self.start[11:][:5])
            else:
                sub_title = resources(self.type)
            self.item['title'] = '{0} ({1})'.format(self.title,
                                                    utfenc(sub_title))

        if self.start:
            self.item['date'] = self.start[:10]

        self.item['related'] = self.related
        self.item['sport'] = self.sport
        self.item['competition'] = self.competition

        self.add_thumb(i)
        self.add_duration(i)
Пример #11
0
class hyperload(object):
    resources = resources.resources()
    jobs = jobs.jobs()
    access = webAuth.access()

    remote = remoteRoute.remoteRoute()

    @cherrypy.expose
    def index(self, statusid=0, *args, **kwargs):
        return layout.getIndex()

    @cherrypy.expose
    @authorization.isAuthorized
    def home(self):
        return layout.getHome()

    @cherrypy.expose
    def js(self):
        cherrypy.response.headers['Content-Type'] = "text/javascript"

        return layout.getJS()
Пример #12
0
 def get_resource(self, string):
     result = self.utfenc(string)
     id_ = resources(string)
     if isinstance(id_, int) and id_ != 0:
         result = self.get_string(id_)
     return result
Пример #13
0
#MAIN PROGRAM - USER ENTRIES

from user import user
from job_type import jobtype
from parameters_values import parametersvalues
from check_rules import checkrules
from resources import resources
from job_queue import jobqueue

#Execute all the functions and save in the database all the features of every user
for i in range(0, 4):
    user_id = user()
    title, title_parameters, title_rules, job_id = jobtype()
    arguments = parametersvalues(title, title_parameters)
    rule_num = checkrules(arguments, title, title_rules)
    job_resources, memory = resources(rule_num, title)
    jobqueue(arguments, title, title_parameters, title_rules, job_resources,
             user_id, job_id, memory)
Пример #14
0
 def get_resource(self, string):
     result = self.utfenc(string)
     id_ = resources(string)
     if isinstance(id_, int) and id_ != 0:
         result = self.get_string(id_)
     return result
Пример #15
0
        buttonHoldTime = time.time() - buttonTimerStart
        buttonTimerStart = 0
    else:
        numberOfButtonPresses = numberOfButtonPresses + 1
        buttonTimerStart = time.time()


if gpioAvailable:
    GPIO.add_event_detect(20, GPIO.BOTH, callback=my_callback, bouncetime=300)

#initialise pygame
pygame.init()

#initialise required game classes
scope = pyscope()
resources = resources()  #get a resources object instance
ca = Calibration(scope, resources)
cg = CalibrationGraphics(scope, resources, ca)
sg = StartupGraphics(scope, resources)  #get the startup graphics instance
tg = TrackerGraphics(scope, resources, ca)  #get the tracker graphics instance
ta = TrackerAudio(resources)  #get the tracker audio instance
pygame.mouse.set_visible(False)  # Hide the mouse pointer

#initialise a clock instance so we can control the game loop
my_clock = pygame.time.Clock()

#enter the game loop
wave_size = 0
args = []
done = False
currentState = True