Upgrade discogs_client to 2.2.2 (#28723)

This commit is contained in:
Fabian Affolter 2019-11-12 12:28:34 +01:00 committed by GitHub
parent e8348221d4
commit 1208ab4c76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 11 deletions

View File

@ -3,7 +3,7 @@
"name": "Discogs", "name": "Discogs",
"documentation": "https://www.home-assistant.io/integrations/discogs", "documentation": "https://www.home-assistant.io/integrations/discogs",
"requirements": [ "requirements": [
"discogs_client==2.2.1" "discogs_client==2.2.2"
], ],
"dependencies": [], "dependencies": [],
"codeowners": [ "codeowners": [

View File

@ -66,7 +66,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
def setup_platform(hass, config, add_entities, discovery_info=None): def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Discogs sensor.""" """Set up the Discogs sensor."""
token = config[CONF_TOKEN] token = config[CONF_TOKEN]
name = config[CONF_NAME] name = config[CONF_NAME]
@ -104,7 +103,7 @@ class DiscogsSensor(Entity):
@property @property
def name(self): def name(self):
"""Return the name of the sensor.""" """Return the name of the sensor."""
return "{} {}".format(self._name, SENSORS[self._type]["name"]) return f"{self._name} {SENSORS[self._type]['name']}"
@property @property
def state(self): def state(self):
@ -136,10 +135,7 @@ class DiscogsSensor(Entity):
return { return {
"cat_no": self._attrs["labels"][0]["catno"], "cat_no": self._attrs["labels"][0]["catno"],
"cover_image": self._attrs["cover_image"], "cover_image": self._attrs["cover_image"],
"format": "{} ({})".format( "format": f"{self._attrs['formats'][0]['name']} ({self._attrs['formats'][0]['descriptions'][0]})",
self._attrs["formats"][0]["name"],
self._attrs["formats"][0]["descriptions"][0],
),
"label": self._attrs["labels"][0]["name"], "label": self._attrs["labels"][0]["name"],
"released": self._attrs["year"], "released": self._attrs["year"],
ATTR_ATTRIBUTION: ATTRIBUTION, ATTR_ATTRIBUTION: ATTRIBUTION,
@ -154,9 +150,7 @@ class DiscogsSensor(Entity):
random_record = collection.releases[random_index].release random_record = collection.releases[random_index].release
self._attrs = random_record.data self._attrs = random_record.data
return "{} - {}".format( return f"{random_record.data['artists'][0]['name']} - {random_record.data['title']}"
random_record.data["artists"][0]["name"], random_record.data["title"]
)
def update(self): def update(self):
"""Set state to the amount of records in user's collection.""" """Set state to the amount of records in user's collection."""

View File

@ -414,7 +414,7 @@ denonavr==0.7.10
directpy==0.5 directpy==0.5
# homeassistant.components.discogs # homeassistant.components.discogs
discogs_client==2.2.1 discogs_client==2.2.2
# homeassistant.components.discord # homeassistant.components.discord
discord.py==1.2.4 discord.py==1.2.4