def testGetCollection(self):
        musicbrainzngs.get_releases_in_collection("0b15c97c-8eb8-4b4f-81c3-0eb24266a2ac")
        self.assertEqual("http://musicbrainz.org/ws/2/collection/0b15c97c-8eb8-4b4f-81c3-0eb24266a2ac/releases", self.opener.get_url())

        musicbrainzngs.get_works_in_collection("898676a6-bc79-4fe2-98ae-79c5940fe1a2")
        self.assertEqual("http://musicbrainz.org/ws/2/collection/898676a6-bc79-4fe2-98ae-79c5940fe1a2/works", self.opener.get_url())

        musicbrainzngs.get_events_in_collection("65cb5dda-44aa-44a8-9c0d-4f99a14ab944")
        self.assertEqual("http://musicbrainz.org/ws/2/collection/65cb5dda-44aa-44a8-9c0d-4f99a14ab944/events", self.opener.get_url())

        musicbrainzngs.get_places_in_collection("9dde4c3c-520a-4bfd-9aae-446c3a04ce0c")
        self.assertEqual("http://musicbrainz.org/ws/2/collection/9dde4c3c-520a-4bfd-9aae-446c3a04ce0c/places", self.opener.get_url())

        musicbrainzngs.get_recordings_in_collection("42bc6dd9-8deb-4bd7-83eb-5dacdb218b38")
        self.assertEqual("http://musicbrainz.org/ws/2/collection/42bc6dd9-8deb-4bd7-83eb-5dacdb218b38/recordings", self.opener.get_url())

        musicbrainzngs.get_artists_in_collection("7e582256-b3ce-421f-82ba-451b0ab080eb")
        self.assertEqual("http://musicbrainz.org/ws/2/collection/7e582256-b3ce-421f-82ba-451b0ab080eb/artists", self.opener.get_url())
Beispiel #2
0
def show_collection(collection_id, ctype):
    """Show a given collection.
    """
    if ctype == "release":
        result = musicbrainzngs.get_releases_in_collection(collection_id,
                                                           limit=0)
    elif ctype == "artist":
        result = musicbrainzngs.get_artists_in_collection(collection_id,
                                                          limit=0)
    elif ctype == "event":
        result = musicbrainzngs.get_events_in_collection(collection_id,
                                                         limit=0)
    elif ctype == "place":
        result = musicbrainzngs.get_places_in_collection(collection_id,
                                                         limit=0)
    elif ctype == "recording":
        result = musicbrainzngs.get_recordings_in_collection(collection_id,
                                                             limit=0)
    elif ctype == "work":
        result = musicbrainzngs.get_works_in_collection(collection_id, limit=0)
    collection = result['collection']
    # entity-type only available starting with musicbrainzngs 0.6
    if "entity-type" in collection:
        print('{mbid}\n"{name}" by {editor} ({cat}, {entity})'.format(
            name=collection['name'],
            editor=collection['editor'],
            cat=collection['type'],
            entity=collection['entity-type'],
            mbid=collection['id']))
    else:
        print('{mbid}\n"{name}" by {editor}'.format(
            name=collection['name'],
            editor=collection['editor'],
            mbid=collection['id']))
    print('')
    # release count is only available starting with musicbrainzngs 0.5
    if "release-count" in collection:
        print('{} releases'.format(collection['release-count']))
    if "artist-count" in collection:
        print('{} artists'.format(collection['artist-count']))
    if "event-count" in collection:
        print('{} events'.format(collection['release-count']))
    if "place-count" in collection:
        print('{} places'.format(collection['place-count']))
    if "recording-count" in collection:
        print('{} recordings'.format(collection['recording-count']))
    if "work-count" in collection:
        print('{} works'.format(collection['work-count']))
    print('')

    if "release-list" in collection:
        show_releases(collection)
    else:
        pass  # TODO
def show_collection(collection_id, ctype):
    """Show a given collection.
    """
    if ctype == "release":
        result = musicbrainzngs.get_releases_in_collection(collection_id, limit=0)
    elif ctype == "artist":
        result = musicbrainzngs.get_artists_in_collection(collection_id, limit=0)
    elif ctype == "event":
        result = musicbrainzngs.get_events_in_collection(collection_id, limit=0)
    elif ctype == "place":
        result = musicbrainzngs.get_places_in_collection(collection_id, limit=0)
    elif ctype == "recording":
        result = musicbrainzngs.get_recordings_in_collection(collection_id, limit=0)
    elif ctype == "work":
        result = musicbrainzngs.get_works_in_collection(collection_id, limit=0)
    collection = result["collection"]
    # entity-type only available starting with musicbrainzngs 0.6
    if "entity-type" in collection:
        print(
            '{mbid}\n"{name}" by {editor} ({cat}, {entity})'.format(
                name=collection["name"],
                editor=collection["editor"],
                cat=collection["type"],
                entity=collection["entity-type"],
                mbid=collection["id"],
            )
        )
    else:
        print(
            '{mbid}\n"{name}" by {editor}'.format(
                name=collection["name"], editor=collection["editor"], mbid=collection["id"]
            )
        )
    print("")
    # release count is only available starting with musicbrainzngs 0.5
    if "release-count" in collection:
        print("{} releases".format(collection["release-count"]))
    if "artist-count" in collection:
        print("{} artists".format(collection["artist-count"]))
    if "event-count" in collection:
        print("{} events".format(collection["release-count"]))
    if "place-count" in collection:
        print("{} places".format(collection["place-count"]))
    if "recording-count" in collection:
        print("{} recordings".format(collection["recording-count"]))
    if "work-count" in collection:
        print("{} works".format(collection["work-count"]))
    print("")

    if "release-list" in collection:
        show_releases(collection)
    else:
        pass  # TODO
Beispiel #4
0
    def testGetCollection(self):
        musicbrainzngs.get_releases_in_collection(
            "0b15c97c-8eb8-4b4f-81c3-0eb24266a2ac")
        self.assertEqual(
            "http://musicbrainz.org/ws/2/collection/0b15c97c-8eb8-4b4f-81c3-0eb24266a2ac/releases",
            self.opener.get_url())

        musicbrainzngs.get_works_in_collection(
            "898676a6-bc79-4fe2-98ae-79c5940fe1a2")
        self.assertEqual(
            "http://musicbrainz.org/ws/2/collection/898676a6-bc79-4fe2-98ae-79c5940fe1a2/works",
            self.opener.get_url())

        musicbrainzngs.get_events_in_collection(
            "65cb5dda-44aa-44a8-9c0d-4f99a14ab944")
        self.assertEqual(
            "http://musicbrainz.org/ws/2/collection/65cb5dda-44aa-44a8-9c0d-4f99a14ab944/events",
            self.opener.get_url())

        musicbrainzngs.get_places_in_collection(
            "9dde4c3c-520a-4bfd-9aae-446c3a04ce0c")
        self.assertEqual(
            "http://musicbrainz.org/ws/2/collection/9dde4c3c-520a-4bfd-9aae-446c3a04ce0c/places",
            self.opener.get_url())

        musicbrainzngs.get_recordings_in_collection(
            "42bc6dd9-8deb-4bd7-83eb-5dacdb218b38")
        self.assertEqual(
            "http://musicbrainz.org/ws/2/collection/42bc6dd9-8deb-4bd7-83eb-5dacdb218b38/recordings",
            self.opener.get_url())

        musicbrainzngs.get_artists_in_collection(
            "7e582256-b3ce-421f-82ba-451b0ab080eb")
        self.assertEqual(
            "http://musicbrainz.org/ws/2/collection/7e582256-b3ce-421f-82ba-451b0ab080eb/artists",
            self.opener.get_url())