コード例 #1
0
	def testReleases(self):
		inc1 = ArtistIncludes(aliases=True, releaseRelations=True)
		tags1 = inc1.createIncludeTags()
		tags1.sort()
		self.assertEqual(tags1, ['aliases', 'release-rels'])

		inc2 = ArtistIncludes(releaseRelations=True)
		tags2 = inc2.createIncludeTags()
		tags2.sort()
		self.assertNotEqual(tags2, ['aliases', 'release-rels'])

		inc3 = ArtistIncludes(aliases=True,
			releases=(Release.TYPE_ALBUM, Release.TYPE_OFFICIAL))
		tags3 = inc3.createIncludeTags()
		tags3.sort()
		self.assertEqual(tags3, ['aliases', 'sa-Album', 'sa-Official'])

		inc4 = ArtistIncludes(aliases=True, vaReleases=('Bootleg',))
		tags4 = inc4.createIncludeTags()
		tags4.sort()
		self.assertEqual(tags4, ['aliases', 'va-Bootleg'])

		inc5 = ArtistIncludes(aliases=True,
			vaReleases=(Release.TYPE_BOOTLEG,))
		tags5 = inc5.createIncludeTags()
		tags5.sort()
		self.assertEqual(tags5, ['aliases', 'va-Bootleg'])
コード例 #2
0
except WebServiceError, e:
	print 'Error:', e
	sys.exit(1)

if len(sys.argv) > 2:
	artistResults = [artistResults[int(sys.argv[2])]]
else:
	artistResults = [artistResults[0]]
	
tracks_ids = []
for result in artistResults:
	artist_name = result.artist
	releases = []
	for rtype in [m.Release.TYPE_ALBUM, m.Release.TYPE_SINGLE, m.Release.TYPE_COMPILATION, m.Release.TYPE_REMIX]:
		artist = q.getArtistById(artist_name.id, ArtistIncludes(
				releases=(m.Release.TYPE_OFFICIAL, rtype),
				tags=True))
	
		releases.extend(artist.getReleases())

	for release in releases:
		sleep(1) # respect TOS
		release = q.getReleaseById(release.id, ReleaseIncludes(artist = True, tracks = True))
		for track in release.tracks:
			name = track.artist.name if track.artist else release.artist.name
			full_title = (name + u" — " + track.title).lower()
			if not full_title in tracks_ids:
				print name, track.title
				if not sys.stdout.isatty():
					print >> sys.stderr, full_title
				tracks_ids.append(full_title)
コード例 #3
0
	def testReleaseGroups(self):
		inc = ArtistIncludes(releaseGroups=True)
		self.assertEqual(inc.createIncludeTags(), ['release-groups'])