Esempio n. 1
0
    def __init__(self, gyr, etype, erating):
        Item.__init__(self)
        # We need engine info for calculations
        self.gtype = gettext(gyr.childNodes)
        self.g_base = int(gyr.attributes["techbase"].value)

        # Check for legal gyro type, save data
        ident = False
        for i in GYRO:
            if (i[0] == self.gtype and i[1] == self.g_base):
                ident = True
                self.gyro_bv = i[2]
                gweightm = i[3]
                self.r_level = i[4]
                self.cost = i[5]
        if not ident:
            error_exit((self.gtype, self.g_base))

        # Calculate weight
        rating = erating
        # Hack: Make sure Primitive Engines get right gyro weight
        if etype == "Primitive Fusion Engine":
            rating *= 1.2
            rating = ceil_5(rating)
        base_weight = ceil(float(rating) / 100.0)
        self.weight = gweightm * base_weight
Esempio n. 2
0
    def __init__(self, eng, unit):
        Item.__init__(self)
        self.erating = int(eng.attributes["rating"].value)
        self.e_base = int(eng.attributes["techbase"].value)
        self.etype = gettext(eng.childNodes)
        self.speed = self.erating / unit.weight
        self.unit = unit  # Reference to parent unit
        # A note on primitive engines:
        # It seems like using engine rating directly does give
        # the right speed, even if rules says otherwise
        # This looks like an internal SSW issue, so
        # assume that the weight of these engines are incorrect

        # Check for legal engine type, save data
        ident = False
        for i in ENGINE:
            if (i[0] == self.etype and i[1] == self.e_base):
                ident = True
                self.eng_bv = i[2]
                if self.unit.type == "CV":
                    self.eweight = i[3](ceil_5(self.erating -
                                               self.get_suspension_factor()))
                else:
                    self.eweight = i[3](ceil_5(self.erating))
                self.r_level = i[4]
                self.cost = i[5]
                self.short = i[6]
        if not ident:
            error_exit((self.etype, self.e_base))
Esempio n. 3
0
    def __init__(self, cpt, unit):
        Item.__init__(self)
        cnode = cpt.getElementsByTagName("type")[0]
        self.type = gettext(cnode.childNodes)
        if self.type != "Torso-Mounted Cockpit":
            self.console = cnode.attributes["commandconsole"].value
        else:
            self.console = "FALSE"
        self.c_weight = 0
        self.unit = unit  # Reference to parent unit

        # Check for legal cockpit type, save data
        ident = False
        for i in COCKPIT:
            if (i[0] == self.type):
                ident = True
                self.wgt = i[1]
                self.r_level = i[2]
                self.cost = i[3]
        if not ident:
            error_exit((self.type))

        # Hack: Add console weight
        if self.console == "TRUE":
            self.c_weight = 3
Esempio n. 4
0
 def __init__(self, parent):
     logger.log( 9, 'FlickImage.__init__(parent=%r)', parent)
     Item.__init__(self, parent, skin_type='image')
     self.name = _('Flickr pictures')
     self.title = _('Flickr pictures')
     self.type = 'flickr'
     self.info = { 'name' : 'Flickr', 'description' : 'Flickr pictures', 'title' : 'Flickr' }
Esempio n. 5
0
 def __init__(self, level, pos, colour):
     Item.__init__(self, level, pos)
     
     self.tile = 6, colour + 2
     self.size = 0.5
     
     self.colour = colour
Esempio n. 6
0
    def __init__(self, file, cmd=None, args=None, imgpath=None, parent=None):
        logger.log( 9, 'GenericItem.__init__(file=%r, cmd=%r, args=%r, imgpath=%r, parent=%r)', file, cmd, args, imgpath, parent)

        Item.__init__(self, parent)
        self.type  = 'generic'            # fix value
        self.set_url(file, info=True)
        self.parent = parent

        self.name = os.path.splitext(os.path.basename(file))[0]

        # find image for this file
        shot = imgpath + '/' + os.path.splitext(os.path.basename(file))[0] + ".png"
        if os.path.isfile(shot):
            self.image = shot
        elif os.path.isfile(os.path.splitext(file)[0] + ".png"):
            self.image = os.path.splitext(file)[0] + ".png"

        command = ['--prio=%s' % config.GAMES_NICE, cmd]
        command.extend(args.split())
        if os.path.getsize(file) > 0:
            command.append(file)

        self.command = command

        self.game_player = game.get_singleton()
Esempio n. 7
0
    def __init__(self, nation, tv, parent):
        Item.__init__(self, parent)
        self.name = nation

        self.description = "Channels available: %d" % len(tv)

        self._tv = tv
Esempio n. 8
0
    def __init__ (self, folder, con=None):
        """Constructor for the abstract base class Contact. If con is not
        None, this behaves like pseudo copy constructor, copying all the
        contact properties from the pass contact. Note, in particular that all
        the 'object attributes' of con are left untouched, and are populated
        as per the general rules of creating a new contact."""

        Item.__init__(self, folder)

        self.props.update({'firstname'    : None, 'company'      : None,
                           'lastname'     : None, 'postal'       : {},
                           'middlename'   : None, 'notes'        : [],
                           'name'         : None, 'phone_home'   : [],
                           'suffix'       : None, 'phone_work'   : [],
                           'title'        : None, 'phone_mob'    : [],
                           'gender'       : None, 'phone_other'  : [],
                           'nickname'     : None, 'phone_prim'   : None,
                           'birthday'     : None, 'fax_home'     : [],
                           'anniv'        : None, 'fax_work'     : [],
                           'web_home'     : [],   'fax_prim'     : None,
                           'web_work'     : [],   'email_home'   : [],
                           'web_prim'     : None, 'email_work'   : [],
                           'dept'         : None, 'email_other'  : [],
                           'fileas'       : None, 'email_prim'   : None,
                           'prefix'       : None, 'im_prim'      : None,
                           'im'           : {},   'custom'       : {},
                           'postal_prim_label' : None,
                           })

        if con:
            self.init_props_from_con(con)
Esempio n. 9
0
    def __init__(self, arm, weight):
        Item.__init__(self)
        self.tech_base = int(arm.attributes["techbase"].value)
        self.atype = get_child_data(arm, "type")
        self.front = int(get_child_data(arm, "front"))
        self.left = int(get_child_data(arm, "left"))
        self.right = int(get_child_data(arm, "right"))
        self.rear = int(get_child_data(arm, "rear"))
        self.p_turret = int(get_child_data(arm, "primaryturret"))
        self.s_turret = int(get_child_data(arm, "secondaryturret"))
        self.rotor = int(get_child_data(arm, "rotor"))

        # Check for legal armor type, save data
        ident = False
        for i in ARMOR:
            if (i[0] == self.atype and i[1] == self.tech_base):
                ident = True
                self.armor_bv = i[2]
                self.armor_multipler = i[3]
                self.r_level = i[4]
                self.cost = i[5]
                self.short = i[6]
        if not ident:
            error_exit((self.atype, self.tech_base))

        # Last sum up total
        armortotal = (self.front + self.left + self.right + self.rear +
                      self.p_turret + self.s_turret + self.rotor)
        maxtotal = floor(3.5 * weight + 40)

        self.total = ArmorLoc("Total", armortotal, (maxtotal - 9) / 2 + 3,
                              maxtotal)
Esempio n. 10
0
 def __init__(self, parent):
     Item.__init__(self, parent)
     self.name = 'Apple Trailers'
     self.type = 'trailers'
     self.image = config.IMAGE_DIR + '/apple-trailers.png'
     self.trailers = None
     self.inprogress = kaa.ThreadCallable(self.download_trailers)()
Esempio n. 11
0
 def __init__(self, parent, apoddir):
     Item.__init__(self, parent, skin_type='image')
     self.name = _( 'APOD' )
     self.title = _( 'APOD' )
     self.apoddir = apoddir
     self.info = { 'name' : 'APOD', 'description' : 'Astronomy Picture of the day', 'title' : 'APOD' }
     self.type = 'image'
Esempio n. 12
0
    def __init__(self, parent):
        logger.log( 9, 'manual_record.ManualRecordItem.__init__(parent)')
        Item.__init__(self, parent, skin_type='video')

        self.name = _("Manual Record")

        self.recordclient = RecordClient()

        # maxinum number of days we can record
        self.MAXDAYS = 7

        # minimum amount of time it would take record_server.py
        # to pick us up in seconds by default it is one minute plus
        # a few seconds just in case
        self.MINPICKUP = 70

        self.months = [
            _('Jan'), _('Feb'), _('Mar'), _('Apr'), _('May'), _('Jun'),
            _('Jul'), _('Aug'), _('Sep'), _('Oct'), _('Nov'), _('Dec')
        ]

        now = time.time()
        now += 300
        self.startnow = now
        self.starttime = time.localtime(now)
        now += 1900
        self.stopnow = now
        self.stoptime = time.localtime(now)
Esempio n. 13
0
 def __init__(self, *args, **kwargs):
     # Pass arguments straight to the superclass constructor.
     Item.__init__(self, *args, **kwargs)
     self.parent = None
     self.children = None # Will optionally get pointed to a CircularDLL.
     self.marked = False
     self.degree = 0
Esempio n. 14
0
 def __init__(self):
     Item.__init__(self)
     self.title = None
     self.artist = None
     self.album = None
     self.image = None
     self.length = 0
Esempio n. 15
0
    def __init__(self, parent, prog, context='menu'):
        Item.__init__(self, parent, skin_type='video')
        logger.log( 9, '__init__(parent=%r, prog=%r, context=%r)', parent, prog, context)
        # prog is a TvProgram object as we get it from the recordserver
        self.prog = prog
        self.context= context

        if hasattr(prog, 'name'): self.name = self.title = prog.name
        if hasattr(prog, 'title'): self.title = self.name = Unicode(prog.title)
        if hasattr(prog, 'sub_title'): self.sub_title = prog.sub_title
        if hasattr(prog, 'desc'): self.description = prog.desc
        if hasattr(prog, 'categories'):self.categories = prog.categories
        if hasattr(prog, 'ratings'): self.ratings = prog.ratings
        if hasattr(prog, 'advisories'): self.advisories = prog.advisories

        self.channel = tv_util.get_chan_displayname(prog.channel_id)
        if hasattr(prog, 'scheduled'):
            self.scheduled = prog.scheduled
        else:
            self.scheduled = False

        self.favorite = False
        self.allowDuplicates = prog.allowDuplicates
        self.onlyNew = prog.onlyNew
        self.overlap = prog.overlap

        self.start = time.strftime(config.TV_DATETIME_FORMAT, time.localtime(prog.start))
        self.stop = time.strftime(config.TV_DATETIME_FORMAT, time.localtime(prog.stop))
        self.recordclient = RecordClient()
Esempio n. 16
0
    def __init__(self, parent):
        """
        Sets up the configuration variables
        """
        if not config.SYS_USE_NETWORK:
            self.reason = _('SYS_USE_NETWORK not enabled')
            return

        Item.__init__(self, parent, skin_type = 'audio')
        self.name = ( _('Icecast Radio') )

        self.min_bitrate = int(config.ICECAST_MIN_BITRATE)
        self.cache_ttl = int(config.ICECAST_TTL)
        self.max_bitrate = int(config.ICECAST_MAX_BITRATE)
        self.max_bitrate = 0
        self.yellowpages = config.ICECAST_YPS
        self.audiotypes = config.ICECAST_AUDIOTYPES
        self.genremapping = config.ICECAST_GENRE_MAP

        self.cacheFolder = str(config.FREEVO_CACHEDIR) + '/icecast/'
        if not os.path.isdir(self.cacheFolder):
            os.mkdir(self.cacheFolder)

        self.stations = {}
        self.genres = {}
        self.bitrates = {}
Esempio n. 17
0
    def __init__(self, service, parent_fid=None, resp_node=None):
        Item.__init__(self, service, parent_fid, resp_node, tag="Contact")

        self.file_as = FileAs()
        self.alias = Alias()
        self.complete_name = CompleteName()
        self.display_name = DisplayName()
        self.spouse_name = SpouseName()

        self.job_title = JobTitle()
        self.company_name = CompanyName()
        self.department = Department()
        self.manager = Manager()
        self.assistant_name = AssistantName()

        self.birthday = Birthday()
        self.anniversary = WeddingAnniversary()

        self.notes = Notes()
        self.emails = EmailAddresses()
        self.ims = ImAddresses()
        self.phones = PhoneNumbers()
        self.business_home_page = BusinessHomePage()

        self.gender = Gender()
        self.personal_home_page = PersonalHomePage()

        self._init_from_resp()
Esempio n. 18
0
 def __init__(self, parent):
     Item.__init__(self, parent, skin_type='skype')
     self.name = _('Skype')
     self.skype = SkypeApi()
     self.parent = parent
     self.arg = ('Skype', 0)
     self.type='main'
Esempio n. 19
0
 def __init__(self, parent):
     print "init mpd item"
     Item.__init__(self, parent)
     self.parent       = parent
     self.error        = 0
     self.location = "mpd"
     self.name = "MPD"
     self.last_update = 0
Esempio n. 20
0
 def __init__(self, parent):
     Item.__init__(self, parent)
     self.url = ''
     self.cachedir = '%s/headlines' % config.FREEVO_CACHEDIR
     if not os.path.isdir(self.cachedir):
         os.mkdir(self.cachedir,
                  stat.S_IMODE(os.stat(config.FREEVO_CACHEDIR)[stat.ST_MODE]))
     self.location_index = None
Esempio n. 21
0
 def __init__(self, parent):
     Item.__init__(self, parent)
     self.skin_display_type = "video"
     self.mainArray = {}
     self.nation_list = []
     self.nation_tv = {}
     self.categories_tv = {}
     self.__load()
Esempio n. 22
0
 def __init__(self, parent, gip_type):
     """
     Create a new instance of a download service
     @param parent: Parent item.
     @param gip_type: get_iplayer type.
     """
     Item.__init__(self, parent, skin_type="tv")
     self.gip_type = GIP_MAPPINGS[gip_type][0]
     self.name = GIP_MAPPINGS[gip_type][1]
Esempio n. 23
0
    def __init__(self, parent, Zm):
        Item.__init__(self, parent)
        self.name = _("Events by monitor")
        self.Zm = Zm
        self.menus = []

        names = Zm.list_monitor()
        for (id, name, width, height) in names:
            self.menus.append(MenuItem(name.capitalize(), self.events, id))
Esempio n. 24
0
 def __init__(self, parent):
     Item.__init__(self, parent, skin_type='skype')
     self.user_handle = ''
     self.location_index = None
     self.name = ''
     self.arg = None
     self.menuw = None
     self.parent = parent
     self.active_call = None
Esempio n. 25
0
    def __init__(self, parent, Zm):
        Item.__init__(self, parent)
        self.zm = Zm
        self.name = _("Stream")
        self.menus = [MenuItem(_("Montage"), self.montage)]

        names = Zm.list_monitor()
        for (id, name, width, height) in names:
            self.menus.append(MenuItem(name.capitalize(), self.live, id))
Esempio n. 26
0
 def __init__(self, movie, parent):
     Item.__init__(self, parent)
     self.movie = movie
     self.name = movie['name']
     if movie.has_key('poster_path'):
         self.image = movie['poster_path']
     if parent.type == 'theatre':
         self.description = movie['showtimes'][parent.name]+'\n'
     if movie.has_key('description'):
         self.description += movie['description']
Esempio n. 27
0
 def __init__(self, parent):
     logger.log( 9, 'YoutubeVideo.__init__(parent=%r)', parent)
     # look for a default player
     for p in plugin.getbyname(plugin.VIDEO_PLAYER, True):
         if config.VIDEO_PREFERED_PLAYER == p.name:
             self.player = p
     Item.__init__(self, parent)
     self.name = _('Youtube videos')
     self.type = 'youtube'
     self.image = config.IMAGE_DIR + '/youtube.png'
Esempio n. 28
0
 def __init__(self, name, tv, parent):
     Item.__init__(self, parent)
     self.name = name
     self.type = "video"
     self._tv = tv
     self.url = self._tv[1]
     self.mode = ""
     self.files = ""
     self.description = "Stream: " + self._tv[2]
     self.description += "\nInformation: " + self._tv[3]
Esempio n. 29
0
 def __init__(self, name, url, blacklist_regexp, autoplay, all_links, parent):
     Item.__init__(self, parent)
     self.url = url
     self.url_name = name
     self.name = name
     self.blacklist_regexp = blacklist_regexp
     self.autoplay = autoplay
     self.counter = 1
     self.all_links = all_links
     self.type = 'linkbrowser'
Esempio n. 30
0
    def __init__(self, url, parent, name=None, scan=True):
        self.type = 'audio'
        Item.__init__(self, parent)

        self.set_url(url, info=scan)

        if name:
            self.name = name
        else:
            self.name = self.format_track()

        self.start      = 0
        self.elapsed    = 0
        self.remain     = 0
        self.pause      = 0

        self.mplayer_options = ''

        try:
            self.length = int(self.info['length'])
        except:
            self.length = 0

        # Let's try to find if there is any image in the current directory
        # that could be used as a cover
        if self.filename and not self.image and not (self.parent and self.parent.type == 'dir'):
            images = ()
            covers = ()
            files =()

            def image_filter(x):
                return re.match('.*(jpg|png)$', x, re.IGNORECASE)

            def cover_filter(x):
                result = re.search(config.AUDIO_COVER_REGEXP, x, re.IGNORECASE)
                if result: logger.debug('cover_filter(%s): %r', x, result.group())
                return result

            # Pick an image if it is the only image in this dir, or it matches
            # the configurable regexp
            dirname = os.path.dirname(self.filename)
            try:
                files = os.listdir(dirname)
            except OSError:
                print "oops, os.listdir() error"
                traceback.print_exc()
            images = filter(image_filter, files)
            image = None
            if len(images) == 1:
                image = os.path.join(dirname, images[0])
            elif len(images) > 1:
                covers = filter(cover_filter, images)
                if covers:
                    image = os.path.join(dirname, covers[0])
            self.image = image
Esempio n. 31
0
    def __init__(self,
                 name,
                 action=None,
                 arg=None,
                 type=None,
                 image=None,
                 icon=None,
                 parent=None,
                 skin_type=None):
        Item.__init__(self, parent, skin_type=skin_type)
        if name:
            self.name = Unicode(name)
        if icon:
            self.icon = icon
        if image:
            self.image = image

        self.function = action
        self.arg = arg
        self.type = type
Esempio n. 32
0
    def __init__(self, name='', playlist=None, parent=None, display_type=None,
                 random=False, build=False, autoplay=False, repeat=False):
        """
        Init the playlist

            1. a filename to a playlist file (e.g. m3u)
            2. a list of items to play, this list can include
                - Items
                - filenames
                - a list (directoryname, recursive=0|1)

        @param build: create the playlist, this means unfold the directories
        """
        Item.__init__(self, parent)

        self.type     = 'playlist'
        self.menuw    = None
        self.name     = Unicode(name)

        if isstring(playlist) and not name:
            self.name = util.getname(playlist)

        # variables only for Playlist
        self.current_item = None
        self.playlist     = playlist or []
        self.autoplay     = autoplay
        self.repeat       = repeat
        self.display_type = display_type

        self.__build__    = False
        self.suffixlist   = []
        self.get_plugins  = []

        self.background_playlist = None
        if build:
            self.build()

        if self.name.find('Playlist') < 0:
            self.name = '%s Playlist' % self.name

        self.random = random
Esempio n. 33
0
    def __init__(self, parent, fav, fav_action='edit'):
        """ """
        Item.__init__(self, parent, skin_type='video')
        logger.log(9,
                   'FavoriteItem.__init__(parent=%r, fav=%r, fav_action=%r)',
                   parent, fav, fav_action)
        self.recordclient = RecordClient()
        self.fav = fav
        self.name = self.origname = fav.name
        self.title = fav.title
        self.fav_action = fav_action
        if hasattr(fav, 'allowDuplicates'):
            self.allowDuplicates = int(fav.allowDuplicates)

        if hasattr(self.fav, 'onlyNew'):
            self.onlyNew = int(fav.onlyNew)

        self.week_days = (_('Monday'), _('Tuesday'), _('Wednesday'),
                          _('Thursday'), _('Friday'), _('Saturday'),
                          _('Sunday'))

        if fav.channel == 'ANY':
            self.channel = _('ANY CHANNEL')
        else:
            self.channel = fav.channel
        if fav.dow == 'ANY':
            self.dow = _('ANY DAY')
        else:
            self.dow = self.week_days[int(fav.dow)]
        if fav.mod == 'ANY':
            self.mod = _('ANY TIME')
        else:
            try:
                self.mod = time.strftime(config.TV_TIME_FORMAT,
                                         time.gmtime(float(int(fav.mod) * 60)))
            except:
                print 'Cannot add "%s" to favorites' % fav.name

        # needed by the inputbox handler
        self.menuw = None
Esempio n. 34
0
    def __init__(self, parent, prog, context='menu'):
        Item.__init__(self, parent, skin_type='video')
        logger.log(9, '__init__(parent=%r, prog=%r, context=%r)', parent, prog,
                   context)
        # prog is a TvProgram object as we get it from the recordserver
        self.prog = prog
        self.context = context

        if hasattr(prog, 'name'): self.name = self.title = prog.name
        if hasattr(prog, 'title'): self.title = self.name = Unicode(prog.title)
        if hasattr(prog, 'sub_title'): self.sub_title = prog.sub_title
        if hasattr(prog, 'desc'): self.description = prog.desc
        if hasattr(prog, 'categories'): self.categories = prog.categories
        if hasattr(prog, 'ratings'): self.ratings = prog.ratings
        if hasattr(prog, 'advisories'): self.advisories = prog.advisories

        self.channel = tv_util.get_chan_displayname(prog.channel_id)
        if hasattr(prog, 'scheduled'):
            self.scheduled = prog.scheduled
        else:
            self.scheduled = False

        self.favorite = False
        if hasattr(prog, 'allowDuplicates'):
            self.allowDuplicates = prog.allowDuplicates
        else:
            self.allowDuplicates = 1

        if hasattr(prog, 'onlyNew'):
            self.onlyNew = prog.onlyNew
        else:
            self.onlyNew = 0

        self.overlap = prog.overlap

        self.start = time.strftime(config.TV_DATETIME_FORMAT,
                                   time.localtime(prog.start))
        self.stop = time.strftime(config.TV_DATETIME_FORMAT,
                                  time.localtime(prog.stop))
        self.recordclient = RecordClient()
Esempio n. 35
0
    def __init__(self, channels, start_time, player, menuw):
        logger.log(9, 'TVGuide.__init__(start_time=%r, player=%r, menuw=%r)',
                   start_time, player, menuw)
        Item.__init__(self)

        self.channels = channels
        self.start_channel_idx = 0
        self.selected_channel_idx = 0

        # get skin definitions of the TVGuide
        self.n_items, self.hours_per_page = skin.items_per_page(('tv', self))
        # end of visible guide
        stop_time = start_time + self.hours_per_page * 60 * 60

        self.selected = None
        self.col_time = 30  # each col represents 30 minutes
        self.n_cols = (stop_time - start_time) / 60 / self.col_time
        self.player = player

        self.type = 'tv'
        self.menuw = menuw
        self.visible = True
        self.select_time = start_time
        self.last_update = 0

        self.lastinput_value = None
        self.lastinput_time = None

        self.event_context = 'tvmenu'
        self.transition = skin.TRANSITION_IN
        self.start_time = 0
        self.stop_time = 0

        # We select the first channel/program available an relie on
        # the rebuild method not calling the select function again
        # after a program has been selected.
        self.rebuild(start_time, stop_time, lambda p: True)

        menuw.pushmenu(self)
Esempio n. 36
0
    def __init__(self, parent):
        _debug_('manual_record.ManualRecordItem.__init__(parent)', 2)
        Item.__init__(self, parent, skin_type='video')

        self.name = _("Manual Record")

        self.recordclient = RecordClient()

        # maxinum number of days we can record
        self.MAXDAYS = 7

        # minimum amount of time it would take record_server.py
        # to pick us up in seconds by default it is one minute plus
        # a few seconds just in case
        self.MINPICKUP = 70

        self.months = [
            _('Jan'),
            _('Feb'),
            _('Mar'),
            _('Apr'),
            _('May'),
            _('Jun'),
            _('Jul'),
            _('Aug'),
            _('Sep'),
            _('Oct'),
            _('Nov'),
            _('Dec')
        ]

        now = time.time()
        now += 300
        self.startnow = now
        self.starttime = time.localtime(now)
        now += 1900
        self.stopnow = now
        self.stoptime = time.localtime(now)
Esempio n. 37
0
    def __init__(self, start_time, player, menuw):
        Item.__init__(self)

        self.n_items, hours_per_page = skin.items_per_page(('tv', self))
        stop_time = start_time + hours_per_page * 60 * 60

        msgtext = _('Preparing the program guide')
        guide = epg_xmltv.get_guide(PopupBox(text=msgtext))
        channels = guide.GetPrograms(start=start_time + 1, stop=stop_time - 1)
        if not channels:
            AlertBox(text=_('TV Guide is corrupt!')).show()
            return

        selected = None
        for chan in channels:
            if chan.programs:
                selected = chan.programs[0]
                break

        self.col_time = 30  # each col represents 30 minutes
        self.n_cols = (stop_time - start_time) / 60 / self.col_time
        self.player = player

        self.type = 'tv'
        self.menuw = menuw
        self.visible = True
        self.select_time = start_time
        self.last_update = 0

        self.lastinput_value = None
        self.lastinput_time = None

        self.update_schedules(force=True)
        self.fc = FreevoChannels()

        self.rebuild(start_time, stop_time, guide.chan_list[0].id, selected)
        self.event_context = 'tvmenu'
        menuw.pushmenu(self)
Esempio n. 38
0
    def __init__(self, parent, fav, fav_action='edit'):
        Item.__init__(self, parent, skin_type='video')
        self.fav = fav
        self.name = self.origname = fav.name
        self.title = fav.title
        self.fav_action = fav_action
        if hasattr(fav, 'allowDuplicates'):
            self.allowDuplicates = fav.allowDuplicates
        else:
            self.allowDuplicates = 1
        if hasattr(fav, 'onlyNew'):
            self.onlyNew = fav.onlyNew
        else:
            self.onlyNew = 0

        self.week_days = (_('Mon'), _('Tue'), _('Wed'), _('Thu'), _('Fri'),
                          _('Sat'), _('Sun'))

        if fav.channel == 'ANY':
            self.channel = _('ANY CHANNEL')
        else:
            self.channel = fav.channel
        if fav.dow == 'ANY':
            self.dow = _('ANY DAY')
        else:
            self.dow = self.week_days[int(fav.dow)]
        if fav.mod == 'ANY':
            self.mod = _('ANY TIME')
        else:
            try:
                self.mod = strftime(config.TV_TIMEFORMAT,
                                    gmtime(float(int(fav.mod) * 60)))
            except:
                print 'Cannot add "%s" to favorites' % fav.name

        # needed by the inputbox handler
        self.menuw = None
Esempio n. 39
0
    def __init__(self, file, cmd=None, args=None, imgpath=None, parent=None):
        Item.__init__(self, parent)
        self.type = 'generic'  # fix value
        self.set_url(file, info=True)
        self.parent = parent

        self.name = os.path.splitext(os.path.basename(file))[0]

        # find image for this file
        # find image for this file
        shot = imgpath + '/' + \
               os.path.splitext(os.path.basename(file))[0] + ".png"
        if os.path.isfile(shot):
            self.image = shot
        elif os.path.isfile(os.path.splitext(file)[0] + ".png"):
            self.image = os.path.splitext(file)[0] + ".png"

        command = ['--prio=%s' % config.GAMES_NICE, cmd]
        command.extend(args.split())
        command.append(file)

        self.command = command

        self.game_player = game.get_singleton()
Esempio n. 40
0
 def __init__(self, parent=None):
     Item.__init__(self, parent, skin_type='shutdown')
     self.idletimer = plugin.getbyname('autoshutdowntimer')
Esempio n. 41
0
 def __init__(self, parent):
     Item.__init__(self, parent, skin_type='itv')
     self.name = _('Internet TV')
Esempio n. 42
0
    def __init__(self, url, parent, info=None, parse=True):
        self.autovars = [('deinterlace', 0)]
        Item.__init__(self, parent)

        self.type = 'video'
        self.set_url(url, info=parse)

        if info:
            self.info.set_variables(info)

        self.variants = []  # if this item has variants
        self.subitems = []  # more than one file/track to play
        self.current_subitem = None
        self.media_id = ''

        self.subtitle_file = {}  # text subtitles
        self.audio_file = {}  # audio dubbing

        self.mplayer_options = ''
        self.tv_show = False

        self.video_width = 0
        self.video_height = 0

        self.selected_subtitle = None
        self.selected_audio = None
        self.elapsed = 0

        self.possible_player = []

        self.player = None
        self.player_rating = 0

        # find image for tv show and build new title
        if config.VIDEO_SHOW_REGEXP_MATCH(self.name) and not self.network_play and \
               config.VIDEO_SHOW_DATA_DIR:

            show_name = config.VIDEO_SHOW_REGEXP_SPLIT(self.name)
            if show_name[0] and show_name[1] and show_name[2] and show_name[3]:
                self.name = show_name[0] + u' ' + show_name[1] + u'x' + show_name[2] +\
                            u' - ' + show_name[3]
                image = util.getimage((config.VIDEO_SHOW_DATA_DIR + \
                                       show_name[0].lower()))
                if self.filename and not image:
                    image = util.getimage(os.path.dirname(self.filename) + '/' + \
                                          show_name[0].lower())

                if image:
                    self.image = image

                from video import tv_show_informations
                if tv_show_informations.has_key(show_name[0].lower()):
                    tvinfo = tv_show_informations[show_name[0].lower()]
                    self.info.set_variables(tvinfo[1])
                    if not self.image:
                        self.image = tvinfo[0]
                    self.skin_fxd = tvinfo[3]
                    self.mplayer_options = tvinfo[2]

                self.tv_show = True
                self.show_name = show_name
                self.tv_show_name = show_name[0]
                self.tv_show_ep = show_name[3]

        # extra infos in discset_informations
        if parent and parent.media:
            fid = parent.media.id + \
                  self.filename[len(os.path.join(parent.media.mountdir,'')):]
            from video import discset_informations
            if discset_informations.has_key(fid):
                self.mplayer_options = discset_informations[fid]
Esempio n. 43
0
    def __init__(self, url, parent, info=None, parse=True):
        """
        Create an instance of a VideoItem

        @param url: the pysudo URL for the VideoItem
        @param parent: the parent of the VideoItem
        @param info: controls if additional information is found
        @type info: boolean
        @param parse: controls if the url is parsed
        @type parse: boolean
        """
        self.autovars = []
        Item.__init__(self, parent)
        self.type = 'video'

        self.variants = []
        self.subitems = []
        self.current_subitem = None
        self.media_id = ''

        self.subtitle_file = {}
        self.audio_file = {}

        self.mplayer_options = ''
        self.tv_show = False

        self.video_width = 0
        self.video_height = 0

        self.selected_subtitle = None
        self.selected_audio = None
        self.elapsed = 0

        self.possible_players = []
        self.player = None
        self.player_rating = 0

        # set the url (this influences the list of possible players!)
        self.set_url(url, info=parse)
        if info:
            self.info.set_variables(info)

        # deinterlacing and related things
        video_deinterlace = config.VIDEO_DEINTERLACE != None and config.VIDEO_DEINTERLACE or False
        self['deinterlace'] = video_deinterlace

        video_use_xvmc = config.VIDEO_USE_XVMC != None and config.VIDEO_USE_XVMC or False
        self['xvmc'] = video_use_xvmc

        video_field_dominance = config.VIDEO_FIELD_DOMINANCE != None and config.VIDEO_FIELD_DOMINANCE or False
        self['field-dominance'] = video_field_dominance

        # find image for tv show and build new title
        if config.VIDEO_SHOW_REGEXP_MATCH(
                self.name
        ) and not self.network_play and config.VIDEO_SHOW_DATA_DIR:

            show_name = config.VIDEO_SHOW_REGEXP_SPLIT(self.name)
            if show_name[0] and show_name[1] and show_name[2] and show_name[3]:
                self.name = show_name[0] + u' ' + show_name[
                    1] + u'x' + show_name[2] + u' - ' + show_name[3]
                image = util.getimage(
                    (config.VIDEO_SHOW_DATA_DIR + show_name[0].lower()))
                if self.filename and not image:
                    image = util.getimage(
                        os.path.join(os.path.dirname(self.filename),
                                     show_name[0].lower()))

                if image:
                    self.image = image

                from video import tv_show_information
                if tv_show_information.has_key(show_name[0].lower()):
                    tvinfo = tv_show_information[show_name[0].lower()]
                    self.info.set_variables(tvinfo[1])
                    if not self.image:
                        self.image = tvinfo[0]
                    self.skin_fxd = tvinfo[3]
                    self.mplayer_options = tvinfo[2]

                self.tv_show = True
                self.show_name = show_name
                self.tv_show_name = show_name[0]
                self.tv_show_ep = show_name[3]

        # extra info in discset_information
        if parent and parent.media:
            fid = String(
                parent.media.id
            ) + self.filename[len(os.path.join(parent.media.mountdir, '')):]
            from video import discset_information
            if discset_information.has_key(fid):
                self.mplayer_options = discset_information[fid]

        if config.VIDEO_DEINTERLACE and self.info['interlaced']:
            # force deinterlacing
            self['deinterlace'] = True
        else:
            self['deinterlace'] = False
 def __init__(self, parent):
     Item.__init__(self, parent, skin_type='tv')
     self.name = _('Scheduled Recordings')
     self.menuw = None
 def __init__(self, i, j, name, floor):
     Item.__init__(self, i, j, name, floor)
     self._obj = LIB[name].name.replace('_trigger2',
                                        '').replace('_trigger', '')
     self._case = LIB[name].case
Esempio n. 46
0
 def __init__(self, parent):
     Item.__init__(self, parent)
     self.name = _('Voir les bandes annonces de film')
     self.type = 'trailers'
Esempio n. 47
0
 def __init__(self, name, power):
     Item.__init__(self, name)
     self.power = power
     self.picked_up = False
     self.consumed = False
Esempio n. 48
0
 def __init__(self, default_value=True, stock_id=None, important=False):
     Item.__init__(self, stock_id, important)
     self.default_value = default_value
     self.active = default_value
Esempio n. 49
0
 def __init__(self, parent):
     Item.__init__(self, parent, skin_type='homeautomation')
     self.name = _('Home Automation')
Esempio n. 50
0
 def __init__(self, parent):
     Item.__init__(self, parent, skin_type='tv')
     self.name = _('Browse Categories')
Esempio n. 51
0
 def __init__(self, parent, category):
     Item.__init__(self, parent, skin_type='tv')
     self.name = category
     self.category = category
Esempio n. 52
0
 def __init__(self, parent):
     Item.__init__(self, parent, skin_type='tv')
     self.parent = parent
     self.name   = _('Freebox TV')
Esempio n. 53
0
 def __init__(self, room_name, room_story, name_item, description_item):
     Item.__init__(self, name_item, description_item)
     self.room_name = room_name
     self.room_story = room_story
Esempio n. 54
0
 def __init__(self, parent, name, image, skin):
     Item.__init__(self, parent)
     self.name = name
     self.image = image
     self.skin = skin
Esempio n. 55
0
 def __init__(self, i, j, name, floor):
     Item.__init__(self, i, j, name, floor)
     self._useable = True
Esempio n. 56
0
 def __init__(self, parent):
     Item.__init__(self, parent)
Esempio n. 57
0
 def __init__(self, parent):
     Item.__init__(self, parent)
     self.name = _('Voir les sorties DVD')
     self.type = 'trailers'
Esempio n. 58
0
 def __init__(self, parent=None):
     logger.log(9, 'ShutdownMenuItem.__init__(parent=%r)', parent)
     Item.__init__(self, parent, skin_type='shutdown')
     self.idletimer = plugin.getbyname('autoshutdowntimer')
Esempio n. 59
0
 def __init__(self):
     Item.__init__(self)
     self.type = 'tv'
Esempio n. 60
0
 def __init__(self):
     Item.__init__(self)
     self.type = 'mediamenu'