Skip to content

Commit

Permalink
Merge pull request #4 from lukjak/0.4.1
Browse files Browse the repository at this point in the history
0.4.1
  • Loading branch information
lukjak authored Oct 25, 2022
2 parents ddc991f + 029b30e commit d320265
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "enmet"
version = "0.4.0"
version = "0.4.1"
description = "Python API for Encyclopaedia Metallum (The Metal Archives) website."
readme = {text = """
Enmet is a programmatic API to Encyclopaedia Metallum - The Metal Archives site. It allows convenient access to Metal Archives data from python code.
Expand Down
4 changes: 2 additions & 2 deletions src/enmet/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ def __str__(self):

class Band(EnmetEntity):
"""Band or artist performing as a band."""
def __init__(self, id_: str, *, name: str = None, country: str = None, genres: str = None):
def __init__(self, id_: str, *, name: str = None, country: Countries = None, genres: str = None):
if not hasattr(self, "id"):
super().__init__(id_)
if name is not None:
setattr(self, "name", name)
if country is not None:
setattr(self, "country", Countries[country_to_enum_name(country)])
setattr(self, "country", country)
if genres is not None:
setattr(self, "genres", genres)
self._band_page = BandPage(self.id)
Expand Down
2 changes: 1 addition & 1 deletion src/enmet/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def reviews(self) -> Tuple[Optional[str], str]:
return None, elem.text

@cached_property
def tracks(self):
def tracks(self) -> List[List[Union[str, Optional[bool]]]]:
result = [[]]
for elem in self.enmet.select_one("#album_tabs_tracklist").select("tr.even,tr.odd,.discRow"):
if "discRow" in elem["class"]:
Expand Down
4 changes: 2 additions & 2 deletions src/enmet/search.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import List

from enmet import Countries
from enmet import Countries, country_to_enum_name
from enmet.common import ReleaseTypes, url_to_id, datestr_to_date
from enmet.entities import Band, Album
from enmet.pages import BandSearchPage, AlbumSearchPage, RandomBandPage
Expand Down Expand Up @@ -30,7 +30,7 @@ def search_bands(*, name: str = None, strict: bool = None, genre: str = None, co
params[_BAND_SEARCH_FIELDS_MAPPING["countries"]] = [c.value for c in countries or []]
return [Band(url_to_id(b[0]),
name=b[1],
country=countries[0] if countries and len(countries) == 1 else b[3])
country=countries[0] if countries and len(countries) == 1 else Countries[country_to_enum_name(b[3])])
for b in BandSearchPage(params).bands]


Expand Down

0 comments on commit d320265

Please sign in to comment.