Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(4)  |  Call(4)  |  Derive(0)  |  Import(0)

        def read(category, disc_id, server_url=default_server,
	 user=default_user, host=hostname, client_name=name,
         client_version=version):

    url = "%s?cmd=cddb+read+%s+%s&hello=%s+%s+%s+%s&proto=%i" % \
	  (server_url, category, disc_id, user, host, client_name,
           client_version, proto)

    response = urllib.urlopen(url)
    
    # kaa.metadata unicode fix
    encoding = ''
    if response.headers.has_key('content-type'):
        for value in response.headers['content-type'].split(';'):
            if value.strip().lower().startswith('charset='):
                encoding = value[value.find('=')+1:].strip().lower()

    header = string.split(string.rstrip(response.readline()), ' ', 3)

    header[0] = string.atoi(header[0])
    if header[0] == 210 or header[0] == 417: # success or access denied
	reply = []

	for line in response.readlines():
	    line = string.rstrip(line)

	    if line == '.':
		break;

	    line = string.replace(line, r'\t', "\t")
	    line = string.replace(line, r'\n', "\n")
	    line = string.replace(line, r'\\', "\\")

	    reply.append(line)

	if header[0] == 210:		# success, parse the reply
            # kaa.metadata unicode fix
            reply = parse_read_reply(reply)
            for key, value in reply.items():
                if isinstance(value, str):
                    try:
                        reply[key] = unicode(reply[key], encoding)
                    except UnicodeDecodeError:
                        reply[key] = unicode(reply[key], errors='replace')
	    return [ header[0], reply ]
	else:				# access denied. :(
	    return [ header[0], reply ]
    else:
	return [ header[0], None ]
        


src/d/e/deepin-music-player-HEAD/src/source/old.py   deepin-music-player(Download)
            self.logdebug('Unable to fetch CDDB info, status=%d', status)
 
        (status, info) = CDDB.read(info['category'], info['disc_id'])
        if status != 210:
            self.logdebug('Unable to fetch CDDB info, status=%d', status)

src/g/e/Gereqi-HEAD/gereqi/audio/Cdrom.py   Gereqi(Download)
        query_info = CDDB.query(disc_id)[1]
        #read_status, read_info = CDDB.read(
        read_info = CDDB.read(query_info[0]['category'], 
                              query_info[0]['disc_id'])[1]
 

src/k/a/kaa-metadata-0.7.8dev-r4569-20111003/src/disc/audio.py   kaa-metadata(Download)
                       and getattr(self, type)[-1] in ('"', '\''):
                    setattr(self, type, getattr(self, type)[1:-1])
            (read_stat, read_info) = CDDB.read(query_info['category'],
                                               query_info['disc_id'])
            # id = disc_id + number of tracks

src/k/a/kaa-metadata-HEAD/src/disc/audio.py   kaa-metadata(Download)
                       and getattr(self, type)[-1] in ('"', '\''):
                    setattr(self, type, getattr(self, type)[1:-1])
            (read_stat, read_info) = CDDB.read(query_info['category'],
                                               query_info['disc_id'])
            # id = disc_id + number of tracks