def parse_name(self, name): # find image for tv show and build new name if config.VIDEO_SHOW_REGEXP_MATCH(name) and not self.network_play: show_name = config.VIDEO_SHOW_REGEXP_SPLIT(name) if show_name[0] and show_name[1] and show_name[2]: ep = config.IMDB_SEASON_EPISODE_FORMAT % (int( show_name[1]), int(show_name[2])) name = '%s %s %s' % (show_name[0], ep, show_name[3]) if config.VIDEO_SHOW_DATA_DIR: 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.subtitle = '%s - Season %s' % (show_name[0], show_name[1]) self.tv_show_name = show_name[0] self.tv_show_season = show_name[1] self.tv_show_episode = show_name[2] self.tv_show_title = show_name[3] if not hasattr(self, 'subtitle') or not self.subtitle: self.subtitle = self.parent['title'] self.title = name return self.format_name(name)
def parse_name(self, name): # find image for tv show and build new name if config.VIDEO_SHOW_REGEXP_MATCH(name) and not self.network_play: show_name = config.VIDEO_SHOW_REGEXP_SPLIT(name) if show_name[0] and show_name[1] and show_name[2]: ep = config.IMDB_SEASON_EPISODE_FORMAT % (int(show_name[1]), int(show_name[2])) name = '%s %s %s' % (show_name[0], ep, show_name[3]) if config.VIDEO_SHOW_DATA_DIR: 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.subtitle = '%s - Season %s' % (show_name[0], show_name[1]) self.tv_show_name = show_name[0] self.tv_show_season = show_name[1] self.tv_show_episode = show_name[2] self.tv_show_title = show_name[3] if not hasattr(self, 'subtitle') or not self.subtitle: self.subtitle = self.parent['title'] self.title = name return self.format_name(name)
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, 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