rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
if prog['description']: info['description'] = prog['description'] if prog['subtitle']: info['subtitle'] = prog['subtitle']
if prog.description: info['description'] = prog.description if prog.subtitle: info['subtitle'] = prog.subtitle
def schedule(self, prog): if not self.server: return False, 'Recordserver unavailable' info = {} if prog['description']: info['description'] = prog['description'] if prog['subtitle']: info['subtitle'] = prog['subtitle'] try: return self.server.recording_add(prog.title, prog.channel.id, 1000, prog.start, prog.stop, info...
url = 'http://us.imdb.com/Title?%s' % id req = urllib2.Request(url, txdata, txheaders) try: r = urllib2.urlopen(req) except urllib2.HTTPError, error: print error return None
def get_data(id): """ get imdb data about the movie with the given id """ title = '' info = {} for t in imdb_info_tags: info[t] = "" image_urls = [] dvd = 0 regexp_title = re.compile('.*STRONG CLASS="title">(.*?)<', re.I) regexp_year = re.compile('.*<A HREF="/Sections/Years/.*?([0-9]*)<', re.I) regexp_genre ...
for line in r.read().split("\n"):
for line in results.read().split("\n"):
def get_data(id): """ get imdb data about the movie with the given id """ title = '' info = {} for t in imdb_info_tags: info[t] = "" image_urls = [] dvd = 0 regexp_title = re.compile('.*STRONG CLASS="title">(.*?)<', re.I) regexp_year = re.compile('.*<A HREF="/Sections/Years/.*?([0-9]*)<', re.I) regexp_genre ...
print error return None for line in r.read().split("\n"): m = regexp_dvd_image.match(line) if m: image_urls += [ m.group(1) ]
pass
def get_data(id): """ get imdb data about the movie with the given id """ title = '' info = {} for t in imdb_info_tags: info[t] = "" image_urls = [] dvd = 0 regexp_title = re.compile('.*STRONG CLASS="title">(.*?)<', re.I) regexp_year = re.compile('.*<A HREF="/Sections/Years/.*?([0-9]*)<', re.I) regexp_genre ...
osd.clearscreen(osd.COL_BLACK) if settings.background.image: apply(osd.drawbitmap, (settings.background.image, -1, -1)) if settings.background.mask: osd.drawbitmap(settings.background.mask,-1,-1) DrawLogo(settings.logo)
InitScreen(settings)
def DrawTVGuide_Clear(self, settings): osd.clearscreen(osd.COL_BLACK)
str_w_head, str_h_head = osd.stringsize('Ajg', val.head.font, val.head.size)
str_w_label, str_h_label = osd.stringsize('Ajg', val.label.font, val.label.size)
def DrawTVGuide_ItemsPerPage(self, settings): items = -1 val = settings.listing
str_h = max (str_h_head, str_h_selection, str_h_normal )
str_h = max (str_h_label, str_h_selection, str_h_normal )
def DrawTVGuide_ItemsPerPage(self, settings): items = -1 val = settings.listing
height = val.height - str_h_head - 2 * val.spacing
height = val.height - str_h_label - 2 * val.spacing
def DrawTVGuide_ItemsPerPage(self, settings): items = -1 val = settings.listing
height = val.expand.height - str_h_head - 2 * val.spacing
height = val.expand.height - str_h_label - 2 * val.spacing
def DrawTVGuide_ItemsPerPage(self, settings): items = -1 val = settings.listing
str_w_head = str_h_head = 0
str_w_label = str_h_label = 0
def DrawTVGuide_Listing(self, to_listing, settings): val = settings.listing
str_w_head, str_h_head = osd.stringsize('Ajg', val.head.font, val.head.size)
str_w_label, str_h_label = osd.stringsize('Ajg', val.label.font, val.label.size)
def DrawTVGuide_Listing(self, to_listing, settings): val = settings.listing
y_contents = conf_y + str_h_head + 2 * val.spacing h_contents = conf_h - str_h_head - 2 * val.spacing x_contents = conf_x + val.channel_width w_contents = conf_w - val.channel_width
y_contents = conf_y + str_h_label + 2 * val.spacing h_contents = conf_h - str_h_label - 2 * val.spacing x_contents = conf_x + val.label.width w_contents = conf_w - val.label.width
def DrawTVGuide_Listing(self, to_listing, settings): val = settings.listing
occupied_height = 0
def DrawTVGuide_Listing(self, to_listing, settings): val = settings.listing
osd.drawbox(x, y, x+val.channel_width, y+str_h_head + 2 * val.spacing, width=-1, color=val.head.bgcolor) osd.drawbox(x, y, x+val.channel_width, y+str_h_head + 2 * val.spacing, width=1, color=val.border_color)
DrawBox(x, y, x+val.label.width, y+str_h_label + 2 * val.spacing, val.label.bgcolor, 1, val.border_color)
def DrawTVGuide_Listing(self, to_listing, settings): val = settings.listing
val.head, x + val.spacing, y + val.spacing, \ val.channel_width - 2 * val.spacing, str_h_head) x = x_contents head2 = copy.copy(val.head) head2.align='left'
val.label, x + val.spacing, y + val.spacing, \ val.label.width - 2 * val.spacing, str_h_label)
def DrawTVGuide_Listing(self, to_listing, settings): val = settings.listing
osd.drawbox(x, y, x+col_size, y+ str_h_head + 2 * val.spacing, width=-1, color=val.head.bgcolor) osd.drawbox(x, y, x+col_size, y+ str_h_head + 2 * val.spacing, width=1, color=val.border_color) DrawTextFramed(time.strftime("%H:%M",time.localtime(to_listing[0][i+1])), head2, x + val.spacing, y + val.spacing, col_size - 2...
x0 = int(x_contents + (float(w_contents) / n_cols) * i) x1 = int(x_contents + (float(w_contents) / n_cols) * (i+1)) DrawBox(x0, y, x1, y+ str_h_label + 2 * val.spacing, val.label.bgcolor, 1, val.border_color) DrawText(time.strftime("%H:%M",time.localtime(to_listing[0][i+1])), val.label, x0 + val.spacing, y + val.spaci...
def DrawTVGuide_Listing(self, to_listing, settings): val = settings.listing
str_h = max( str_h_head, str_h_selection, str_h_normal )
str_h = max( str_h_label, str_h_selection, str_h_normal )
def DrawTVGuide_Listing(self, to_listing, settings): val = settings.listing
y = y_contents
items_per_page = self.DrawTVGuide_ItemsPerPage(settings)
def DrawTVGuide_Listing(self, to_listing, settings): val = settings.listing
if occupied_height <= h_contents: osd.drawbox(conf_x, y, conf_x+val.channel_width, y+str_h + 2 * val.spacing, width=-1, color=val.head.bgcolor) osd.drawbox(conf_x, y, conf_x+val.channel_width, y+str_h + 2 * val.spacing, width=1, color=val.border_color) channel_logo = config.TV_LOGOS + '/' + to_listing[i].id + '.png' ...
if i - 1 > items_per_page: break y0 = int(y_contents + (i-2) * (float(h_contents) / items_per_page)) y1 = int(y_contents + (i-1) * (float(h_contents) / items_per_page)) DrawBox(conf_x, y0, conf_x+val.label.width, y1, val.label.bgcolor, 1, val.border_color) channel_logo = config.TV_LOGOS + '/' + to_listing[i].id + ...
def DrawTVGuide_Listing(self, to_listing, settings): val = settings.listing
break
DrawBox(x_contents, y0, x_contents+w_contents, y1, val2.bgcolor, 1, val2.border_color) DrawTextFramed('-[ NO DATA ]-', val, x_contents+val.spacing, y0+val.spacing, w_contents - 2 * val2.spacing, h)
def DrawTVGuide_Listing(self, to_listing, settings): val = settings.listing
if self.tray_open and self.info: self.tray_open = FALSE
def is_tray_open(self): if self.tray_open and self.info: # if we have an info, the tray can't be open self.tray_open = FALSE return self.tray_open
if data.mime in ('video/cd', 'video/dvd'):
if data.mime in ('video/vcd', 'video/dvd'):
def identify(self, media): """ magic! Try to find out as much as possible about the disc in the rom drive: title, image, play options, ... """ # Check drive status (tray pos, disc ready) try: fd = os.open(media.devicename, os.O_RDONLY | os.O_NONBLOCK) s = ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT) except: # maybe we n...
class to parse the mplayer output and store some informations
class to parse the mplayer output and store some information
def eventhandler(self, event): """ eventhandler for mplayer control. If an event is not bound in this function it will be passed over to the items eventhandler """
def check_password_and_build(self):
def check_password_then_browse(self):
def check_password_and_build(self): """ password checker """ # are we on a ROM_DRIVE and have to mount it first? for media in vfs.mountpoints: if self.dir.startswith(media.mountdir): media.mount() self.media = media
if vfs.isfile(self.dir + '/.password') and 0: log.warning('password protected dir') self.arg = arg pb = InputBox(text=_('Enter Password'), handler=self.pass_cmp_cb,
if vfs.isfile(self.dir + '/.password'): log.warning('password protected dir') pb = InputBox(text=_('Enter Password'), handler=self.browse_pass_cb,
def check_password_and_build(self): """ password checker """ # are we on a ROM_DRIVE and have to mount it first? for media in vfs.mountpoints: if self.dir.startswith(media.mountdir): media.mount() self.media = media
pb.show() else: self.build() def pass_cmp_cb(self, word=None):
pb.show() else: self.browse(authstatus=1) def browse_pass_cb(self, word=None):
def check_password_and_build(self): """ password checker """ # are we on a ROM_DRIVE and have to mount it first? for media in vfs.mountpoints: if self.dir.startswith(media.mountdir): media.mount() self.media = media
callback for check_password_and_build """ try: pwfile = vfs.open(self.dir + '/.password') line = pwfile.readline() except IOError, e: log.error('error %d (%s) reading password file for %s' % \ (e.errno, e.strerror, self.dir))
callback for check_password_then_browse """ try: pwfile = vfs.open(self.dir + '/.password') line = pwfile.readline() except IOError, e: log.error('error %d (%s) reading password file for %s' % \ (e.errno, e.strerror, self.dir)) return pwfile.close() password = line.strip() if word == password: self.browse(authstatus=1...
def pass_cmp_cb(self, word=None): """ read the contents of self.dir/.passwd and compare to word callback for check_password_and_build """
pwfile.close() password = line.strip() if word == password: self.build() else: MessageBox(_('Password incorrect')).show() return def browse(self, update=False): """ build the items for the directory """
def pass_cmp_cb(self, word=None): """ read the contents of self.dir/.passwd and compare to word callback for check_password_and_build """
position = min((self.bar_position * 100) / self.max_value, 100) width = ((self.get_size()[0]) * position ) / 100
def __draw(self): # catch division by zero error. if not self.max_value: return
(width-self.border_size, self.get_size()[1]-self.border_size),
(width-self.border_size*2, self.get_size()[1]-self.border_size*2),
def __draw(self): # catch division by zero error. if not self.max_value: return
self.play_items.sort(lambda l, o: cmp(l.name.upper(), o.name.upper()))
self.play_items.sort(lambda l, o: cmp(l.sort().upper(), o.sort().upper()))
def build(self, arg=None, menuw=None): """ build the items for the directory """ t0 = time.time() self.playlist = [] self.play_items = [] self.dir_items = [] self.pl_items = []
self._dump_recurse(f, self.tree)
try: self._dump_recurse(f, self.tree) except UnicodeDecodeError: f.close() f = vfs.codecs_open(filename, 'w', encoding='utf-8') f.write('<?xml version="1.0" ?>\n') self._dump_recurse(f, self.tree, encoding_problem=True)
def save(self, filename=None): """ Save the tree """ if not filename: filename = self.filename if vfs.isfile(filename): vfs.unlink(filename) f = vfs.codecs_open(filename, 'w', encoding='utf-8') f.write('<?xml version="1.0" ?>\n') self._dump_recurse(f, self.tree) f.write('\n') f.close()
def _dump_recurse(self, f, elem, depth=0):
def _dump_recurse(self, f, elem, depth=0, encoding_problem=False):
def _dump_recurse(self, f, elem, depth=0): """ Help function to dump all elements """ if not elem: return f.write('<' + elem.name) for (ns, name), value in elem.attrs.items(): f.write(' %s="%s"' % (name, value)) if elem.children or elem.first_cdata: if elem.first_cdata == None: f.write('>\n ') for i in range(depth): f...
f.write('>' + elem.first_cdata.replace('&', '&amp;'))
data = elem.first_cdata.replace('&', '&amp;') if encoding_problem: unidata = unicode() for c in data: unidata += unichr(ord(c)) data = unidata f.write('>' + data)
def _dump_recurse(self, f, elem, depth=0): """ Help function to dump all elements """ if not elem: return f.write('<' + elem.name) for (ns, name), value in elem.attrs.items(): f.write(' %s="%s"' % (name, value)) if elem.children or elem.first_cdata: if elem.first_cdata == None: f.write('>\n ') for i in range(depth): f...
self._dump_recurse(f, child, depth=depth+1)
self._dump_recurse(f, child, depth=depth+1, encoding_problem=encoding_problem)
def _dump_recurse(self, f, elem, depth=0): """ Help function to dump all elements """ if not elem: return f.write('<' + elem.name) for (ns, name), value in elem.attrs.items(): f.write(' %s="%s"' % (name, value)) if elem.children or elem.first_cdata: if elem.first_cdata == None: f.write('>\n ') for i in range(depth): f...
if (osd.sdl_driver == 'dxr3'):
if (osd.sdl_driver == 'dxr3' or \ config.CONF.display == 'dfbmga'):
def run(self): while 1: if self.mode == 'idle': self.mode_flag.wait() self.mode_flag.clear() elif self.mode == 'play': # The DXR3 device cannot be shared between our SDL session # and MPlayer. if (osd.sdl_driver == 'dxr3'): if DEBUG: print "Stopping Display for Video Playback on DXR3" osd.stopdisplay() if DEBUG: print...
if osd.sdl_driver == 'dxr3':
if osd.sdl_driver == 'dxr3' or config.CONF.display == 'dfbmga':
def run(self): while 1: if self.mode == 'idle': self.mode_flag.wait() self.mode_flag.clear() elif self.mode == 'play': # The DXR3 device cannot be shared between our SDL session # and MPlayer. if (osd.sdl_driver == 'dxr3'): if DEBUG: print "Stopping Display for Video Playback on DXR3" osd.stopdisplay() if DEBUG: print...
appname = os.path.splitext(os.path.basename(sys.argv[0]))[0] logfile = '%s/internal-%s-%s.log' % (LOGDIR, appname, os.getuid())
def __init__(self, logtype='(unknown)'): self.lineno = 1 self.logtype = logtype try: appname = os.path.splitext(os.path.basename(sys.argv[0]))[0] logfile = '%s/internal-%s-%s.log' % (LOGDIR, appname, os.getuid()) self.fp = open(logfile, 'a') if DEBUG: print 'Logging info in %s' % logfile except IOError: print 'Could no...
if DEBUG: print 'Logging info in %s' % logfile
def __init__(self, logtype='(unknown)'): self.lineno = 1 self.logtype = logtype try: appname = os.path.splitext(os.path.basename(sys.argv[0]))[0] logfile = '%s/internal-%s-%s.log' % (LOGDIR, appname, os.getuid()) self.fp = open(logfile, 'a') if DEBUG: print 'Logging info in %s' % logfile except IOError: print 'Could no...
ts = time.asctime(time.localtime(time.time())) if DEBUG: self.write('-' * 79 + '\n') if DEBUG: self.write('Starting %s at %s\n' % (logtype, ts))
def __init__(self, logtype='(unknown)'): self.lineno = 1 self.logtype = logtype try: appname = os.path.splitext(os.path.basename(sys.argv[0]))[0] logfile = '%s/internal-%s-%s.log' % (LOGDIR, appname, os.getuid()) self.fp = open(logfile, 'a') if DEBUG: print 'Logging info in %s' % logfile except IOError: print 'Could no...
for dir in cfgfilepath: freevoconf = dir + '/freevo.conf'
for dirname in cfgfilepath: freevoconf = dirname + '/freevo.conf'
def print_config_changes(conf_version, file_version, changelist): """ print changes made between version on the screen """ ver_old = float(file_version) ver_new = float(conf_version) if ver_old == ver_new: return print print 'You are using version %s, changes since then:' % file_version changed = [(cv, cd) for (cv, cd)...
_('Build video thumbnails for all items (may yake a while when entering).'),
_('Build video thumbnails for all items (may take a while when entering).'),
def dirconfig(self, diritem): """ adds configure variables to the directory """ return [ ('VIDEO_DIRECTORY_AUTOBUILD_THUMBNAILS', _('Directory Autobuild Thumbnails '), _('Build video thumbnails for all items (may yake a while when entering).'), False) ]
(title, dir) = d d = DirItem(dir, self, name = title,
(t, dir) = d d = DirItem(dir, self, name = t,
def main_menu(self, arg=None, menuw=None): """ display the (IMAGE|VIDEO|AUDIO|GAMES) main menu """ self.display_type, force_text_view = arg title = 'MEDIA' dirs = []
print "self.item.name=%s" % self.item.name
def confirm_delete(self, arg=None, menuw=None): self.menuw = menuw print "self.item.name=%s" % self.item.name ConfirmBox(text=_('Do you wish to delete\n \'%s\'?') % self.item.name, handler=self.delete_file, default_choice=1).show()
try:
log.debug('QUERY: %s' % query) timer_set() try:
def sql_execute(self, query, close=False): query = self.__escape_query(query)
if not self.db.execute('select name from sqlite_master where ' + \ 'name="%s" and type="table"' % table): return None return table
self.db.check_table(table)
def sql_checkTable(self,table=None): if not table: return False # verify the table exists if not self.db.execute('select name from sqlite_master where ' + \ 'name="%s" and type="table"' % table): return None return table
log.error('title to long %s' % title)
log.error('title too long %s' % title)
def sql_add_program(self, channel_id, title, start, stop, subtitle='', description='', episode=''): now = time.time() title = self.__escape_value(title) subtitle = self.__escape_value(subtitle).strip(' \t-_') description = self.__escape_value(description).strip(' \t-_') episode = self.__escape_value(episode).strip(' \t...
log.error('subtitle to long %s' % subtitle)
log.error('subtitle too long %s' % subtitle)
def sql_add_program(self, channel_id, title, start, stop, subtitle='', description='', episode=''): now = time.time() title = self.__escape_value(title) subtitle = self.__escape_value(subtitle).strip(' \t-_') description = self.__escape_value(description).strip(' \t-_') episode = self.__escape_value(episode).strip(' \t...
log.error('episode to long %s' % episode)
log.error('episode too long %s' % episode)
def sql_add_program(self, channel_id, title, start, stop, subtitle='', description='', episode=''): now = time.time() title = self.__escape_value(title) subtitle = self.__escape_value(subtitle).strip(' \t-_') description = self.__escape_value(description).strip(' \t-_') episode = self.__escape_value(episode).strip(' \t...
log.error('description to long %s' % description)
log.error('description too long %s' % description)
def sql_add_program(self, channel_id, title, start, stop, subtitle='', description='', episode=''): now = time.time() title = self.__escape_value(title) subtitle = self.__escape_value(subtitle).strip(' \t-_') description = self.__escape_value(description).strip(' \t-_') episode = self.__escape_value(episode).strip(' \t...
search_subtitle=True, search_description=True):
search_subtitle=True, search_description=True, exact_match=False):
def search(self, searchstr, by_chan=None, search_title=True, search_subtitle=True, search_description=True): """ Return a list of programs with a title similar to the given parameter. If by_chan is given, it has to be a valid channel id and only programs from this channel will be returned. Result is a list of Programs....
clause = '%s title like "%%%s%%"' % (clause, searchstr)
if exact_match: clause = '%s title="%s"' % (clause, searchstr) else: clause = '%s title like "%%%s%%"' % (clause, searchstr)
def search(self, searchstr, by_chan=None, search_title=True, search_subtitle=True, search_description=True): """ Return a list of programs with a title similar to the given parameter. If by_chan is given, it has to be a valid channel id and only programs from this channel will be returned. Result is a list of Programs....
clause = '%s subtitle like "%%%s%%"' % (clause, searchstr)
if exact_match: clause = '%s subtitle="%s"' % (clause, searchstr) else: clause = '%s subtitle like "%%%s%%"' % (clause, searchstr)
def search(self, searchstr, by_chan=None, search_title=True, search_subtitle=True, search_description=True): """ Return a list of programs with a title similar to the given parameter. If by_chan is given, it has to be a valid channel id and only programs from this channel will be returned. Result is a list of Programs....
clause = '%s description like "%%%s%%"' % (clause, searchstr)
if exact_match: clause = '%s description="%s"' % (clause, searchstr) else: clause = '%s description like "%%%s%%"' % (clause, searchstr)
def search(self, searchstr, by_chan=None, search_title=True, search_subtitle=True, search_description=True): """ Return a list of programs with a title similar to the given parameter. If by_chan is given, it has to be a valid channel id and only programs from this channel will be returned. Result is a list of Programs....
_singleton = OSD()
_singleton = SynchronizedObject(OSD())
def get_singleton(): global _singleton # One-time init if _singleton == None: _singleton = OSD() return _singleton
print 'drawstring "%s"' % string
print 'drawstring (%d;%d) "%s"' % (x, y, string)
def drawstring(self, string, x, y, fgcolor=None, bgcolor=None, font=None, ptsize=0):
image = pygame.image.load(filename).convert_alpha()
print 'Trying to load file "%s"' % filename tmp = pygame.image.load(filename) image = tmp.convert_alpha()
def _getbitmap(self, filename): for i in range(len(self.bitmapcache)): fname, image = self.bitmapcache[i] if fname == filename: # Move to front of FIFO del self.bitmapcache[i] self.bitmapcache.append((fname, image)) return image
osd.drawbox(x0, y1-130, x0 + pos, y1-110, color=0xa0000000, fill=TRUE)
osd.drawbox(x0, y1-130, x0 + pos, y1-110, color=0xa0000000L, fill=TRUE)
def draw(self, x0, y0, x1, y1): """ draw the current position """ x0 += 20 x1 -= 20
self.menu.items = copy.copy(self.menu.item_dir) self.menu.items = copy.copy(self.menu.item_pl)
self.menu.items.default = copy.copy(self.menu.items.default) self.menu.items.dir = copy.copy(self.menu.items.dir) self.menu.items.pl = copy.copy(self.menu.items.pl)
def parseItems(self, node, data, copy_content): data.x = self.attr_int(node, "x", data.x) data.y = self.attr_int(node, "y", data.y) data.height = self.attr_int(node, "height", data.height) data.width = self.attr_int(node, "width", data.width)
if copy_content: self.menu.item_dir = copy.copy(self.menu.item_dir)
if copy_content: self.menu.items.dir = copy.copy(self.menu.items.dir)
def parseItems(self, node, data, copy_content): data.x = self.attr_int(node, "x", data.x) data.y = self.attr_int(node, "y", data.y) data.height = self.attr_int(node, "height", data.height) data.width = self.attr_int(node, "width", data.width)
if copy_content: self.menu.item_pl = copy.copy(self.menu.item_pl)
if copy_content: self.menu.items.pl = copy.copy(self.menu.items.pl)
def parseItems(self, node, data, copy_content): data.x = self.attr_int(node, "x", data.x) data.y = self.attr_int(node, "y", data.y) data.height = self.attr_int(node, "height", data.height) data.width = self.attr_int(node, "width", data.width)
print "DEBUG:" print " Album: " + str(self.album) print " Artist: " + str(self.artist) print " Title: " + str(self.title) print " Track: " + str(self.track) print " Year: " + str(self.year) print " Length: " + str(self.length) print " Image: " + str(temp)
try: print "DEBUG:" print " Album: " + str(self.album) print " Artist: " + str(self.artist) print " Title: " + str(self.title) print " Track: " + str(self.track) print " Year: " + str(self.year) print " Length: " + str(self.length) print " Image: " + str(temp) except UnicodeError: print "Oops.. Got UnicodeError.....
def __init__( self, file, drawall=0 ): self.drawall = drawall self.filename = file self.album = '' self.artist = '' self.length = 0 self.title = 0 self.track = 0 self.year = 0 self.start = 0 self.elapsed = 0 self.remain = 0 self.done = 0.0 self.image = '' self.pa...
self.album = vc['ALBUM'][0]
self.album = str(vc['ALBUM'][0])
def set_info_ogg( self, file ): """ Sets all the info variables with useful info from the oggfile.
self.artist = vc['ARTIST'][0]
self.artist = str(vc['ARTIST'][0])
def set_info_ogg( self, file ): """ Sets all the info variables with useful info from the oggfile.
self.title = vc['TITLE'][0]
self.title = str(vc['TITLE'][0])
def set_info_ogg( self, file ): """ Sets all the info variables with useful info from the oggfile.
self.track = vc['TRACK'][0]
self.track = str(vc['TRACK'][0])
def set_info_ogg( self, file ): """ Sets all the info variables with useful info from the oggfile.
self.track = vc['TRACKNUMBER'][0]
self.track = str(vc['TRACKNUMBER'][0])
def set_info_ogg( self, file ): """ Sets all the info variables with useful info from the oggfile.
self.year = vc['YEAR'][0]
self.year = str(vc['YEAR'][0])
def set_info_ogg( self, file ): """ Sets all the info variables with useful info from the oggfile.
self.engine.toggle_display_style(menu)
self.engine.toggle_display_style(self.menustack[-1])
def eventhandler(self, event): """ Eventhandler for menu controll """ if MenuStack.eventhandler(self, event): return True
time.sleep(2.0)
self.app.child.wait() if config.OSD_SDL_EXEC_AFTER_STARTUP: os.system(config.OSD_SDL_EXEC_AFTER_STARTUP)
def run(self): while 1: if self.mode == 'idle': self.mode_flag.wait() self.mode_flag.clear() elif self.mode == 'play':
while self.mode == 'play' and self.app.isAlive(): time.sleep(0.1) self.app.kill()
def run(self): while 1: if self.mode == 'idle': self.mode_flag.wait() self.mode_flag.clear() elif self.mode == 'play':
self.last_time = vfs.mtime(self.dir) self.item.__dirwatcher_last_time = self.last_time self.files = self.listoverlay()
def scan(self): if not self.dir: return try: if vfs.mtime(self.dir) <= self.last_time: return True except (OSError, IOError): # the directory is gone log.info('Dirwatcher: unable to read directory %s' % self.dir)
if self.subitems:
if self.subitems and not self.variants:
def eventhandler(self, event, menuw=None): """ eventhandler for this item """ # when called from mplayer.py, there is no menuw if not menuw: menuw = self.menuw
if settings.menu.has_key(menu.item_types): area = settings.menu[menu.item_types] else: area = settings.menu['default'] if self.display_style['menu'] >= len(area.style): self.display_style['menu'] = 0 self.display_style['menu'] = (self.display_style['menu'] + 1) % len(area.style)
if hasattr(settings,'menu'): if settings.menu.has_key(menu.item_types): area = settings.menu[menu.item_types] else: area = settings.menu['default'] if self.display_style['menu'] >= len(area.style): self.display_style['menu'] = 0 self.display_style['menu'] = (self.display_style['menu'] + 1) % len(area.style)
def toggle_display_style(self, menu): """ Toggle display style """ if isinstance(menu, str): if not self.display_style.has_key(menu): self.display_style[menu] = 0 self.display_style[menu] = (self.display_style[menu] + 1) % \ len(self.settings.sets[menu].style) return 1 if menu.force_skin_layout != -1: return 0 if men...
width = font.stringsize(string) if width <= max_width: return (width, string, '')
def dsf_calc_line(self, string, max_width, font, hard, ellipses, word_splitter): """ calculate _one_ line for drawstringframed """ string = string.strip() c = 0 # num of chars fitting width = 0 # width needed ls = len(string) space = 0 # position of ...
log.error(e) length = 0
try: length = int(self.infoitem.info['video'][0]['length']) except Exception, e: log.error(e) length = 0
def update(self): """ Update the progressbar """ settings = self.settings
tuner_freq = self.fc.chanSet(tuner_channel, app='mplayer')
freq_khz = self.fc.chanSet(tuner_channel, app='mplayer') tuner_freq = '%1.3f' % (freq_khz / 1000.0)
def Play(self, mode, tuner_channel=None, channel_change=0):
norm = 'norm=%s' % vg.norm
norm = 'norm=%s' % vg.tuner_norm
def Play(self, mode, tuner_channel=None, channel_change=0):
new_freq = self.fc.chanUp(app=self.thread.app)
freq_khz = self.fc.chanUp(app=self.thread.app)
def eventhandler(self, event, menuw=None): print '%s: %s app got %s event' % (time.time(), self.mode, event) if event == em.STOP or event == em.PLAY_END: self.Stop() rc.post_event(em.PLAY_END) return TRUE elif event == em.TV_CHANNEL_UP or event == em.TV_CHANNEL_DOWN: if self.mode == 'vcr': return # Go to the prev/nex...
new_freq = self.fc.chanDown(app=self.thread.app)
freq_khz = self.fc.chanDown(app=self.thread.app) new_freq = '%1.3f' % (freq_khz / 1000.0)
def eventhandler(self, event, menuw=None): print '%s: %s app got %s event' % (time.time(), self.mode, event) if event == em.STOP or event == em.PLAY_END: self.Stop() rc.post_event(em.PLAY_END) return TRUE elif event == em.TV_CHANNEL_UP or event == em.TV_CHANNEL_DOWN: if self.mode == 'vcr': return # Go to the prev/nex...
self.font = None
self.font = font['default']
def prepare(self, font, color): if self.font: try: self.font = font[self.font] except: print 'can\'t find font %s' % self.font print font else: self.font = None
print item.mimetype
def rate(self, item): """ How good can this player play the file: 2 = good 1 = possible, but not good 0 = unplayable """ if item.url in ('dvd://', 'vcd://'): return 1 print item.mimetype if item.mimetype in config.VIDEO_MPLAYER_SUFFIX: return 2 if item.network_play: return 1 return 0
cursor.execute("CREATE TABLE music (id INTEGER PRIMARY KEY, dirtitle VARCHAR(255), md5 VARCHAR(32) UNIQUE, path VARCHAR(255), filename VARCHAR(255), type VARCHAR(3), artist VARCHAR(255), title VARCHAR(255), album VARCHAR(255), year VARCHAR(255), track NUMERIC(3), track_total NUMERIC(3), bpm NUMERIC(3), last_play float,...
cursor.execute("CREATE TABLE music (id INTEGER PRIMARY KEY, dirtitle VARCHAR(255), md5 VARCHAR(32) UNIQUE, path VARCHAR(255), filename VARCHAR(255), type VARCHAR(3), artist VARCHAR(255), title VARCHAR(255), album VARCHAR(255), year VARCHAR(255), track NUMERIC(3), track_total NUMERIC(3), bpm NUMERIC(3), last_play float,...
def create_db(): db = sqlite.connect(DATABASE) cursor = db.cursor() cursor.execute("CREATE TABLE music (id INTEGER PRIMARY KEY, dirtitle VARCHAR(255), md5 VARCHAR(32) UNIQUE, path VARCHAR(255), filename VARCHAR(255), type VARCHAR(3), artist VARCHAR(255), title VARCHAR(255), album VARCHAR(255), year VARCHAR(255), track ...
trackof, 100,0,0,'0','262',0,'null')
trackof, 100,0,0,'0',inti(a['length']),0,'null')
def make_query(filename,dirtitle): md5 = 'null' if not os.path.exists(filename): print "File %s does not exist" % (filename) return None a = mmpython.parse(filename) md5 = util.md5file(filename) # This is ugly, how do I clean it up? trackno = -1 trackof = -1 if a['trackno']: trackno = inti(a['trackno'].split('/')...
def __init__(self, license=None):
def __init__(self, license=None, locale='us'):
def __init__(self, license=None): if not config.USE_NETWORK: self.reason = 'no network' return if license: amazon.setLicense(license) try: amazon.getLicense() except amazon.NoLicenseKey: print String(_( 'To search for covers you need an Amazon.com Web' \ 'Services\nlicense key. You can get it from:\n')) print 'https:/...
self.locales = [ 'us', 'uk' ] if locale in self.locales: self.locales.remove(locale) self.locales = [ locale ] + self.locales
def __init__(self, license=None): if not config.USE_NETWORK: self.reason = 'no network' return if license: amazon.setLicense(license) try: amazon.getLicense() except amazon.NoLicenseKey: print String(_( 'To search for covers you need an Amazon.com Web' \ 'Services\nlicense key. You can get it from:\n')) print 'https:/...
self.item = item
def actions(self, item): self.item = item # don't allow this for items on an audio cd, only on the disc itself if item.type == 'audio' and item.parent.type == 'audiocd': return []
vfs.isfile(os.path.join(os.path.dirname(item.filename), 'cover.jpg')):
vfs.isfile(os.path.join(c, 'cover.jpg')):
def actions(self, item): self.item = item # don't allow this for items on an audio cd, only on the disc itself if item.type == 'audio' and item.parent.type == 'audiocd': return []
if self.item.getattr('artist') and \ ((self.item.getattr('album') and \ item.type in ('audio', 'dir')) or \ (self.item.getattr('title') and item.type == 'audiocd')): return [ ( self.cover_search_file, _( 'Find a cover for this music' ), 'imdb_search_or_cover_search') ]
if (item['artist'] and item['album'] and \ item.type in ('audio', 'dir') or \ (item['title'] and item.type == 'audiocd')): return [ Action(_( 'Find a cover for this music' ), self.search, SHORTCUT) ]
def actions(self, item): self.item = item # don't allow this for items on an audio cd, only on the disc itself if item.type == 'audio' and item.parent.type == 'audiocd': return []
except AttributeError: log.warning('unknown disc')
except AttributeError, e: log.exception('coversearch')
def actions(self, item): self.item = item # don't allow this for items on an audio cd, only on the disc itself if item.type == 'audio' and item.parent.type == 'audiocd': return []
def cover_search_file(self, arg=None, menuw=None): """ search imdb for this item
def handle_exception(self, item, box, exception): """ Exception while getting data. """ box.destroy() if isinstance(exception, amazon.AmazonError): text = _('No matches for %s - %s') % \ (item['artist'], item['album']) else: text = _('Unknown error: %s' % exception) MessageBox(text).show() item.show_menu() def __get_...
def cover_search_file(self, arg=None, menuw=None): """ search imdb for this item """ box = WaitBox(text=_( 'searching Amazon...' ) ) box.show()
album = self.item.getattr('album')
album = item['album']
def cover_search_file(self, arg=None, menuw=None): """ search imdb for this item """ box = WaitBox(text=_( 'searching Amazon...' ) ) box.show()
album = self.item.getattr('title') artist = self.item.getattr('artist')
album = item['title'] artist = item['artist']
def cover_search_file(self, arg=None, menuw=None): """ search imdb for this item """ box = WaitBox(text=_( 'searching Amazon...' ) ) box.show()
try: cover = fthread.call(amazon.searchByKeyword, search_string, product_line="music") except amazon.AmazonError: box.destroy() dict_tmp = { "artist": String(artist), "album": String(album) } box = WaitBox(text=_('No matches for %(artist)s - %(album)s') \ % dict_tmp ) box.show() time.sleep(2) box.destroy() return exce...
log.info('searching for \'%s\'' % search_string) cb = notifier.Callback(self.cover_menu, item, box) ex = notifier.Callback(self.handle_exception, item, box) Thread(self.__get_data_thread, search_string).start(cb, ex) def cover_menu(self, item, box, cover): """ Show cover images. """ box.destroy()
def cover_search_file(self, arg=None, menuw=None): """ search imdb for this item """ box = WaitBox(text=_( 'searching Amazon...' ) ) box.show()
MissingFile = False m = None n = None for i in range(len(cover)): try: m = fthread.call(urllib2.urlopen, cover[i].ImageUrlLarge) except urllib2.HTTPError: MissingFile = True if not MissingFile and not (m.info()['Content-Length'] == '807'): image = Image.open(cStringIO.StringIO(m.read())) items += [ menu.MenuItem('%s'...
for name, image in cover: a = ActionItem(name, item, self.save) a.image = image a.parameter(image) items.append(a) item.pushmenu(Menu( _( 'Cover Search Results' ), items)) def save(self, item, image):
def cover_search_file(self, arg=None, menuw=None): """ search imdb for this item """ box = WaitBox(text=_( 'searching Amazon...' ) ) box.show()
import directory box = WaitBox(text= _( 'getting data...' ) ) box.show() if self.item.type == 'audiocd':
if item.type == 'audiocd':
def cover_create(self, arg=None, menuw=None): """ create cover file for the item """ import directory box = WaitBox(text= _( 'getting data...' ) ) box.show() #filename = os.path.splitext(self.item.filename)[0] if self.item.type == 'audiocd': filename = '%s/disc/metadata/%s.jpg' % (config.OVERLAY_DIR, self.item.info['...
self.item.info['id']) elif self.item.type == 'dir': filename = os.path.join(self.item.dir, 'cover.jpg')
item.info['id']) elif item.type == 'dir': filename = os.path.join(item.dir, 'cover.jpg')
def cover_create(self, arg=None, menuw=None): """ create cover file for the item """ import directory box = WaitBox(text= _( 'getting data...' ) ) box.show() #filename = os.path.splitext(self.item.filename)[0] if self.item.type == 'audiocd': filename = '%s/disc/metadata/%s.jpg' % (config.OVERLAY_DIR, self.item.info['...
filename = '%s/cover.jpg' % (os.path.dirname(self.item.filename)) fp = fthread.call(urllib2.urlopen, str(arg)) m = vfs.open(filename,'wb') m.write(fp.read()) m.close() fp.close() try: import Image image = Image.open(filename) width, height = image.size image.crop((2,2,width-4, height-4)).save(filename) except: pass ...
filename = '%s/cover.jpg' % (os.path.dirname(item.filename)) log.info('save to cover to %s' % filename) image.save(filename) item.show_menu()
def cover_create(self, arg=None, menuw=None): """ create cover file for the item """ import directory box = WaitBox(text= _( 'getting data...' ) ) box.show() #filename = os.path.splitext(self.item.filename)[0] if self.item.type == 'audiocd': filename = '%s/disc/metadata/%s.jpg' % (config.OVERLAY_DIR, self.item.info['...
if self.scheduled:
if self.scheduled and not self.scheduled.status in \ ('deleted', 'missed'): print self.scheduled.status
def submenu(self, arg=None, menuw=None, additional_items=False): """ show a submenu for this item """ items = [] if self.scheduled: if self.start < time.time() + 10 and \ self.scheduled[5] in ('recording', 'saved'): items.append(menu.MenuItem(_('Watch recording'), \ self.watch_recording)) if self.stop > time.time(): if...
self.scheduled[5] in ('recording', 'saved'):
self.scheduled.status in ('recording', 'saved'):
def submenu(self, arg=None, menuw=None, additional_items=False): """ show a submenu for this item """ items = [] if self.scheduled: if self.start < time.time() + 10 and \ self.scheduled[5] in ('recording', 'saved'): items.append(menu.MenuItem(_('Watch recording'), \ self.watch_recording)) if self.stop > time.time(): if...