예제 #1
0
    if not args:
        parser.error('no username specified')
    username = args.pop(0)

    # Input the password.
    password = getpass.getpass('Password for {}: '.format(username))

    # Call musicbrainzngs.auth() before making any API calls that
    # require authentication.
    musicbrainzngs.auth(username, password)

    if args:
        # Actions for a specific collction.
        collection_id = args[0]
        if options.add:
            # Add a release to the collection.
            musicbrainzngs.add_releases_to_collection(
                collection_id, [options.add]
            )
        elif options.remove:
            # Remove a release from the collection.
            musicbrainzngs.remove_releases_from_collection(
                collection_id, [options.remove]
            )
        else:
            # Print out the collection's contents.
            show_collection(collection_id)
    else:
        # Show all collections.
        show_collections()
예제 #2
0
    options, args = parser.parse_args()

    if not args:
        parser.error('no username specified')
    username = args.pop(0)

    # Input the password.
    password = getpass.getpass('Password for {}: '.format(username))

    # Call musicbrainzngs.auth() before making any API calls that
    # require authentication.
    musicbrainzngs.auth(username, password)

    if args:
        # Actions for a specific collction.
        collection_id = args[0]
        if options.add:
            # Add a release to the collection.
            musicbrainzngs.add_releases_to_collection(collection_id,
                                                      [options.add])
        elif options.remove:
            # Remove a release from the collection.
            musicbrainzngs.remove_releases_from_collection(
                collection_id, [options.remove])
        else:
            # Print out the collection's contents.
            show_collection(collection_id)
    else:
        # Show all collections.
        show_collections()