Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Queries resulting in more than just the basic band information #7

Open
jogoe222 opened this issue Jan 27, 2019 · 0 comments
Open

Queries resulting in more than just the basic band information #7

jogoe222 opened this issue Jan 27, 2019 · 0 comments

Comments

@jogoe222
Copy link

BandResult only has properties to extract the data from index 0 to 2 which is sufficient for the most basic query result:

>>> print(metallum.band_search('Iron Maiden'))
[<SearchResult: Iron Maiden | Heavy Metal, NWOBHM | United Kingdom>]

But if other criteria are added, there'll be more information included in other indices and it adds up:

>>> print(metallum.band_search('Iron Maiden', countries='GB')) # Country query results in the location at index 2 instead of the country
[<SearchResult: Iron Maiden | Heavy Metal, NWOBHM | London, England >]

>>> print(metallum.band_search('Iron Maiden', location='London'))
[<SearchResult: Iron Maiden | Heavy Metal, NWOBHM | United Kingdom | London, England >] # Location query adds the location

>>> print(metallum.band_search('Iron Maiden', themes='History')) # Lyrical themes query adds data
[<SearchResult: Iron Maiden | Heavy Metal, NWOBHM | United Kingdom | History, Literature, War, Mythology, Society, Religion>]

>>> print(metallum.band_search('Iron Maiden', label="Parlophone")) # Label query adds data
[<SearchResult: Iron Maiden | Heavy Metal, NWOBHM | United Kingdom | Parlophone>]

Year created from/to both result in extra data containing the year the band was formed in:

>>> print(metallum.band_search('Iron Maiden', year_created_from="1970"))
[<SearchResult: Iron Maiden | Heavy Metal, NWOBHM | United Kingdom | 1975>]

>>> print(metallum.band_search('Iron Maiden', year_created_to="1980"))
[<SearchResult: Iron Maiden | Heavy Metal, NWOBHM | United Kingdom | 1975>]

>>> print(metallum.band_search('Iron Maiden', year_created_from="1970", year_created_to="1980"))
[<SearchResult: Iron Maiden | Heavy Metal, NWOBHM | United Kingdom | 1975>]

Arbitrary combinations are possible:

>>> print(metallum.band_search('Iron Maiden', themes='History', location='London'))
[<SearchResult: Iron Maiden | Heavy Metal, NWOBHM | United Kingdom | London, England  | History, Literature, War, Mythology, Society, Religion>]

>>> print(metallum.band_search('Iron Maiden', countries='GB', location='London', themes='History', year_created_from="1970", year_created_to="1980"))
[<SearchResult: Iron Maiden | Heavy Metal, NWOBHM | London, England  | History, Literature, War, Mythology, Society, Religion | 1975>]

Other queries don't add/change the basic data:

>>> print(metallum.band_search('Iron Maiden', status="1"))
[<SearchResult: Iron Maiden | Heavy Metal, NWOBHM | United Kingdom>]

To access the data separately I added the following in my local version

@property
def other(self) -> str:
    """
    >>> s[0].other
    ['Politics, Misanthropy, Gore']
    """
    return self[3:]

but this is fairly ugly and means that the user has to know what kind of information will be included in there, also in case of a country (but not location) query, the country property will return the location.

YisusChrist added a commit to YisusChrist/python-metallum that referenced this issue Feb 11, 2024
…ch parameters

- Added functionality for the song search feature (song_search and SongResult and a change in the link parsing to extract the song ID)
- Added additional search parameters for band_search and album_search such as release formats (there's a pull request for this by @pabe-github), additional notes etc.
- Integrated the "similar artists" feature from @msanlop's fork and pull request, including the README example
- Fixed the requests_cache.core import issue
- "Lyrical themes" has since been renamed to just "Themes"
- Added an other property to band_search results to allow access to additional search result parameters (issue by me Queries resulting in more than just the basic band information lcharlick#7)

Original pull request: lcharlick#17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant