我有以下代码返回所有结果(和所有类型)
import musicbrainzngs
result = musicbrainzngs.browse_release_groups("cc2c9c3c-b7bc-4b8b-84d8-4fbd8779e493")
我只是想通过设置release_type=[]
列表来过滤API与代码中的结果并将所有其他内容丢弃
release_type=['album', 'live', 'single']
result = musicbrainzngs.browse_release_groups("cc2c9c3c-b7bc-4b8b-84d8-4fbd8779e493", release_type=release_type)
)
问题是,这段代码只给了我" live&单"发布..尽管我也指定了album
......
{'release-group-list': [{'first-release-date': '2011-11-25',
'id': '36e41dc0-2a0c-4ff7-b043-097534d52bf6',
'title': 'Adele Live at the Royal Albert Hall',
'type': 'Live'},
{'first-release-date': '2011',
'id': '37367c39-1c91-4a8c-baa7-0a09c3df4b6b',
'title': '2011-02-25: Morning Becomes Eclectic, KCRW-FM, Santa Monica, CA, USA',
'type': 'Live'},
{'first-release-date': '2012-10-05',
'id': '4307ecf9-d0f2-4b95-b7ad-2f8cba84a5e9',
'title': 'Skyfall',
'type': 'Single'},
{'first-release-date': '2011-04-28',
'id': 'c9ddd0ed-ba23-4dfc-bb7e-42f8ffb21fb7',
'title': '2011-04-08: Paradiso FM, Amsterdam, Netherlands',
'type': 'Live'}]}
我确实发布type='Album'
而不使用release_type
,即:
{
'first-release-date': '2011-07-13',
'id': '763f800f-4284-432b-b056-7f6e0aa26bfe',
'title': 'iTunes Festival: London 2011',
'type': 'EP'
},
{
'first-release-date': '2011-07-04',
'id': '7c2071cb-598d-4a0c-b1d5-a53e2cb9b5f8',
'title': 'Set Fire to the Rain',
'type': 'Single'
},
{
'first-release-date': '2008-01-27',
'id': '9796da06-2d59-3176-8598-2105f31ee54a',
'title': '19',
'type': 'Album'
},
当我使用release_type=['album']
(没有live
& single
时)的结果非常奇怪 - 我现在收到了相册&实时类型(?!?!)
release_type=['album']
result = musicbrainzngs.browse_release_groups("cc2c9c3c-b7bc-4b8b-84d8-4fbd8779e493", release_type=release_type)
{'release-group-list': [{'first-release-date': '2011-11-25',
'id': '36e41dc0-2a0c-4ff7-b043-097534d52bf6',
'title': 'Adele Live at the Royal Albert Hall',
'type': 'Live'},
{'first-release-date': '2011',
'id': '37367c39-1c91-4a8c-baa7-0a09c3df4b6b',
'title': '2011-02-25: Morning Becomes Eclectic, KCRW-FM, Santa Monica, CA, USA',
'type': 'Live'},
{'first-release-date': '2008-01-27',
'id': '9796da06-2d59-3176-8598-2105f31ee54a',
'title': '19',
'type': 'Album'},
{'first-release-date': '2012',
'id': 'ad1343e8-1832-4035-8dcc-0bed2daa5ace',
'title': 'Greatest Hits',
'type': 'Compilation'},
{'first-release-date': '2011-04-28',
'id': 'c9ddd0ed-ba23-4dfc-bb7e-42f8ffb21fb7',
'title': '2011-04-08: Paradiso FM, Amsterdam, Netherlands',
'type': 'Live'},
{'first-release-date': '2011-01-19',
'id': 'e4174758-d333-4a8e-a31f-dd0edd51518e',
'title': '21',
'type': 'Album'}]}
知道为什么吗?