-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
According to the API page, it's possible to find collections that are linked to a bunch of other entities: https://musicbrainz.org/doc/MusicBrainz_API#Linked_entities
- Loading branch information
LoveIsGrief
committed
Dec 31, 2021
1 parent
8ed0187
commit d16e8c8
Showing
3 changed files
with
69 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env python | ||
""" | ||
Browse entities on musicbrainz | ||
""" | ||
import json | ||
import sys | ||
from argparse import ArgumentParser | ||
|
||
import musicbrainzngs | ||
|
||
musicbrainzngs.set_useragent( | ||
"python-musicbrainzngs-example", | ||
"0.1", | ||
"https://github.com/alastair/python-musicbrainzngs/", | ||
) | ||
|
||
if __name__ == '__main__': | ||
parser = ArgumentParser() | ||
parser.add_argument( | ||
"entity_type", | ||
choices=["collection"], | ||
help="The type of entity we're trying to get" | ||
) | ||
parser.add_argument("linked_entity_type", help="The entity type it's linked to") | ||
parser.add_argument("mbid", help="The ID of the linked entity") | ||
args = parser.parse_args() | ||
|
||
result = {} | ||
if args.entity_type == "collection": | ||
result = musicbrainzngs.browse_collections(args.linked_entity_type, args.mbid) | ||
else: | ||
print("Invalid entity type passed", file=sys.stderr) | ||
exit(1) | ||
print(json.dumps(result, indent=2)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters