still trying to get accurate results from musicbrainz api
parent
f14abcf3c6
commit
cb757fcd01
|
@ -1,50 +1,36 @@
|
||||||
import musicbrainzngs as m
|
import musicbrainzngs as m
|
||||||
import sys
|
import sys, eyed3
|
||||||
|
|
||||||
|
|
||||||
def show_release_details(rel):
|
|
||||||
|
|
||||||
if rel['title'] != 'Half Girlfriend':
|
|
||||||
return
|
|
||||||
|
|
||||||
"""Print some details about a release dictionary to stdout.
|
|
||||||
"""
|
|
||||||
# "artist-credit-phrase" is a flat string of the credited artists
|
|
||||||
# joined with " + " or whatever is given by the server.
|
|
||||||
# You can also work with the "artist-credit" list manually.
|
|
||||||
|
|
||||||
print("{}, by {}".format(rel['title'], rel["artist-credit-phrase"]))
|
|
||||||
if 'date' in rel:
|
|
||||||
print("Released {} ({})".format(rel['date'], rel['status']))
|
|
||||||
print("MusicBrainz ID: {}".format(rel['id']))
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
m.set_useragent(
|
m.set_useragent(
|
||||||
"RepairMusicMetadata", "0.1", "https://yashagarwal.me")
|
"RepairMusicMetadata", "0.1", "https://yashagarwal.me")
|
||||||
# print(m.get_label_by_id("aab2e720-bdd2-4565-afc2-460743585f16"))
|
|
||||||
|
|
||||||
result = m.search_releases(release='Half Girlfriend',
|
music_path = "/home/yash/bf.mp3"
|
||||||
limit=5)
|
file = eyed3.load(music_path)
|
||||||
|
|
||||||
p = m.search_releases("Raabta")
|
artist_name = file.tag.artist
|
||||||
print(p)
|
title = file.tag.title
|
||||||
# if not result['release-list']:
|
album = file.tag.album
|
||||||
# sys.exit("no release found")
|
|
||||||
# for (idx, release) in enumerate(result['release-list']):
|
|
||||||
# print("match #{}:".format(idx + 1))
|
|
||||||
# release_id = release['id']
|
|
||||||
# # type(release_id)
|
|
||||||
# print(release)
|
|
||||||
# data = m.get_image_list(release_id)
|
|
||||||
|
|
||||||
# print(data)
|
result = m.search_recordings(recording=title, country="IN", artist=artist_name, release=album)
|
||||||
# for image in data["images"]:
|
# print(result)
|
||||||
# if "Front" in image["types"] and image["approved"]:
|
|
||||||
# print("%s is an approved front image!" %
|
for query in result['recording-list']:
|
||||||
# image["thumbnails"]["large"])
|
if(query['ext:score'] == "100"):
|
||||||
|
# print(query['release-list'][0]['title'])
|
||||||
|
# area = query['release-list'][0]['release-event-list'][0]['area']['name']
|
||||||
|
# print(area)
|
||||||
|
if(query['release-list'][0]['title'] == album):
|
||||||
|
id = query['release-list'][0]['medium-list'][0]['track-list'][0]['id']
|
||||||
|
print(id)
|
||||||
|
else:
|
||||||
|
print("Not Found")
|
||||||
|
# print(id)
|
||||||
|
# x = m.get_recording_by_id(id)
|
||||||
|
# print(x)
|
||||||
# break
|
# break
|
||||||
# print()
|
# print(release)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in New Issue