musixmatch-master/7digital-python/tests/search_acceptance_tests.py
Go to the documentation of this file.
1 import py7digital
2 
3 #Search artist
4 results = py7digital.search_artist('stones')
5 print results.get_total_result_count()
6 for artist in results.get_next_page():
7  print artist.get_name() #, artist.get_image(), artist.get_url(), artist.get_tags()
8  print '\tTop tracks:'
9  for top_track in artist.get_top_tracks():
10  print '\t\t', top_track.get_title(), top_track.get_isrc(), top_track.get_duration(), top_track.get_position(), top_track.get_explicit(), top_track.get_version()
11  print '\tRec. Albums:'
12  for rec_album in artist.get_recommended_albums():
13  print '\t\t', rec_album, rec_album.get_year() #, album.get_barcode(), album.get_type(), album.get_artist(), album.get_tags(), album.get_label()
14  for album in artist.get_albums(5):
15  print '\t', album, album.get_year(), album.get_barcode(), album.get_type(), album.get_artist(), album.get_tags(), album.get_label(), album.get_release_date(), album.get_added_date()
16  for sim_album in album.get_similar():
17  print '\t\tSimilar:', sim_album, sim_album.get_year(), sim_album.get_artist()
18  for track in album.get_tracks():
19  print '\t\t', track, track.get_isrc() #, track.get_url(), track.get_audio()
20 
21 #Browse artists starting with 'J'
22 results = py7digital.browse_artists('j')
23 print results.get_total_result_count()
24 for artist in results.get_next_page():
25  print artist.get_name() #, artist.get_image(), artist.get_url(), artist.get_tags()
26  for album in artist.get_albums(2):
27  print '\t', album, album.get_year() #album.get_barcode(), album.get_type(), album.get_artist(), album.get_tags(), album.get_label()
28  for track in album.get_tracks():
29  print '\t\t', track.get_title(), track.get_isrc() #, track.get_url(), track.get_audio()
30 
31 #Search albums
32 searcher = py7digital.search_album('u2')
33 print searcher.get_total_result_count()
34 while searcher.has_results():
35  for album in searcher.get_next_page():
36  print album, album.get_similar()
37 
38 #Search tracks
39 searcher = py7digital.search_track('u2 one')
40 print searcher.get_total_result_count()
41 while searcher.has_results():
42  for track in searcher.get_next_page():
43  print track
44 
45 # New releases in a given period of time
46 results = py7digital.album_releases('20100901', '20100924')
47 for album in results.get_next_page():
48  print album, album.get_year(), album.get_barcode(), album.get_type(), album.get_artist(), album.get_tags(), album.get_label(), album.get_release_date(), album.get_added_date()
49  for sim_album in album.get_similar():
50  print '\tSimilar:', sim_album, sim_album.get_year(), sim_album.get_artist()
51  for track in album.get_tracks():
52  print '\t', track, track.get_isrc() #, track.get_url(), track.get_audio()
53 
54 # Album charts in a given period of time
55 results = py7digital.album_charts('month', '20100901')
56 for album in results.get_next_page():
57  print album, album.get_year(), album.get_barcode(), album.get_type(), album.get_artist(), album.get_tags(), album.get_label(), album.get_release_date(), album.get_added_date()
58  for sim_album in album.get_similar():
59  print '\tSimilar:', sim_album, sim_album.get_year(), sim_album.get_artist()
60  for track in album.get_tracks():
61  print '\t', track, track.get_isrc() #, track.get_url(), track.get_audio()
62