Example #1
0
	def _calc_fingerprint_AcoustId(self):
		song = Song(url = self.url, _useDb = False)
		try:
			song.openFile()
		except IOError as exc:
			return {"error": exc}
		import musicplayer
		try:
			duration, fingerprint = musicplayer.calcAcoustIdFingerprint(song)
		except Exception as exc:
			return {"error": exc}
		# fingerprint is URL-safe base64 with missing padding
		fingerprint += "==="
		import base64
		fingerprint = base64.urlsafe_b64decode(fingerprint)
		return {"duration": duration, "fingerprint_AcoustId": fingerprint}
Example #2
0
	def _calc_fingerprint_AcoustId(self):
		song = Song(url = self.url, _useDb = False)
		try:
			song.openFile()
		except IOError as exc:
			return {"error": exc}
		import musicplayer
		try:
			duration, fingerprint = musicplayer.calcAcoustIdFingerprint(song)
		except Exception as exc:
			return {"error": exc}
		# fingerprint is URL-safe base64 with missing padding
		fingerprint += "==="
		import base64
		fingerprint = base64.urlsafe_b64decode(fingerprint)
		return {"duration": duration, "fingerprint_AcoustId": fingerprint}
		"~/Music/Special/zorba/(01) - Theme From Zorba The Greek.ogg",
		"~/Music/Classic/Glenn Gould Plays Bach/French Suites, BWV812-7 - Gould/Bach, French Suite 5 in G, BWV816 - 5 Bourree.mp3",
		"~/Music/Electronic/Von Paul Kalkbrenner - Aaron.mp3",
		"~/Music/Electronic/One Day_Reckoning Song (Wankelmut Remix) - Asaf Avidan & the Mojos.mp3",
	]
	files = map(os.path.expanduser, files)
	filename = files[5]

if len(sys.argv) >= 3:
	filename = "?"
	duration = int(sys.argv[1])
	fingerprint = sys.argv[2]
else:
	assert os.path.isfile(filename)
	import musicplayer
	duration, fingerprint = musicplayer.calcAcoustIdFingerprint(Song(filename))

print "fingerprint for", os.path.basename(filename), "is:", duration, fingerprint


# AcoustID service
# see: http://acoustid.org/webservice

api_url = "http://api.acoustid.org/v2/lookup"
# "8XaBELgH" is the one from the web example from AcoustID.
# "cSpUJKpD" is from the example from pyacoustid
# get an own one here: http://acoustid.org/api-key
client_api_key = "Rexr3KDO"

params = {
	'format': 'json',
    def readPacket(self, bufSize):
        s = self.f.read(bufSize)
        return s

    def seekRaw(self, offset, whence):
        r = self.f.seek(offset, whence)
        return self.f.tell()


for f in files:
    musicplayer.getMetadata(Song(f))
    progr()

print "after getMetadata"
step()

for f in files:
    musicplayer.calcAcoustIdFingerprint(Song(f))
    progr()

print "after calcAcoustIdFingerprint"
step()

for f in files:
    musicplayer.calcBitmapThumbnail(Song(f))
    progr()

print "after calcBitmapThumbnail"
step()
        "~/Music/Special/zorba/(01) - Theme From Zorba The Greek.ogg",
        "~/Music/Classic/Glenn Gould Plays Bach/French Suites, BWV812-7 - Gould/Bach, French Suite 5 in G, BWV816 - 5 Bourree.mp3",
        "~/Music/Electronic/Von Paul Kalkbrenner - Aaron.mp3",
        "~/Music/Electronic/One Day_Reckoning Song (Wankelmut Remix) - Asaf Avidan & the Mojos.mp3",
    ]
    files = map(os.path.expanduser, files)
    filename = files[5]

if len(sys.argv) >= 3:
    filename = "?"
    duration = int(sys.argv[1])
    fingerprint = sys.argv[2]
else:
    assert os.path.isfile(filename)
    import musicplayer
    duration, fingerprint = musicplayer.calcAcoustIdFingerprint(Song(filename))

print "fingerprint for", os.path.basename(
    filename), "is:", duration, fingerprint

# AcoustID service
# see: http://acoustid.org/webservice

api_url = "http://api.acoustid.org/v2/lookup"
# "8XaBELgH" is the one from the web example from AcoustID.
# "cSpUJKpD" is from the example from pyacoustid
# get an own one here: http://acoustid.org/api-key
client_api_key = "Rexr3KDO"

params = {
    'format': 'json',