From 0748e123417dbbf90ba750dc62c12663a386d18d Mon Sep 17 00:00:00 2001 From: Brandon Rothweiler Date: Thu, 16 Feb 2023 04:16:32 -0500 Subject: [PATCH] Fix capitalization of OwnTone integration (#88219) --- .../components/forked_daapd/browse_media.py | 26 +++++++++---------- .../components/forked_daapd/const.py | 2 +- .../components/forked_daapd/manifest.json | 2 +- .../components/forked_daapd/strings.json | 14 +++++----- homeassistant/generated/integrations.json | 2 +- .../forked_daapd/test_browse_media.py | 2 +- .../forked_daapd/test_media_player.py | 4 +-- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/homeassistant/components/forked_daapd/browse_media.py b/homeassistant/components/forked_daapd/browse_media.py index dee1cd444c3..79aa03774b7 100644 --- a/homeassistant/components/forked_daapd/browse_media.py +++ b/homeassistant/components/forked_daapd/browse_media.py @@ -43,7 +43,7 @@ CAN_EXPAND_TYPE = { MEDIA_TYPE_DIRECTORY, } # The keys and values in the below dict are identical only because the -# HA constants happen to align with the Owntone constants. +# HA constants happen to align with the OwnTone constants. OWNTONE_TYPE_TO_MEDIA_TYPE = { "track": MediaType.TRACK, "playlist": MediaType.PLAYLIST, @@ -58,13 +58,13 @@ MEDIA_TYPE_TO_OWNTONE_TYPE = {v: k for k, v in OWNTONE_TYPE_TO_MEDIA_TYPE.items( # media_content_id is a uri in the form of SCHEMA:Title:OwnToneURI:Subtype (Subtype only used for Genre) # OwnToneURI is in format library:type:id (for directories, id is path) # media_content_type - type of item (mostly used to check if playable or can expand) -# Owntone type may differ from media_content_type when media_content_type is a directory -# Owntone type is used in our own branching, but media_content_type is used for determining playability +# OwnTone type may differ from media_content_type when media_content_type is a directory +# OwnTone type is used in our own branching, but media_content_type is used for determining playability @dataclass class MediaContent: - """Class for representing Owntone media content.""" + """Class for representing OwnTone media content.""" title: str type: str @@ -87,7 +87,7 @@ class MediaContent: def create_owntone_uri(media_type: str, id_or_path: str) -> str: - """Create an Owntone uri.""" + """Create an OwnTone uri.""" return f"library:{MEDIA_TYPE_TO_OWNTONE_TYPE[media_type]}:{quote(id_or_path)}" @@ -113,7 +113,7 @@ def is_owntone_media_content_id(media_content_id: str) -> bool: def convert_to_owntone_uri(media_content_id: str) -> str: - """Convert media_content_id to Owntone URI.""" + """Convert media_content_id to OwnTone URI.""" return ":".join(media_content_id.split(":")[2:-1]) @@ -231,7 +231,7 @@ def create_browse_media_response( for item in result: if item.get("data_kind") == "spotify" or ( "path" in item and cast(str, item["path"]).startswith("spotify") - ): # Exclude spotify data from Owntone library + ): # Exclude spotify data from OwnTone library continue assert isinstance(item["uri"], str) media_type = OWNTONE_TYPE_TO_MEDIA_TYPE[item["uri"].split(":")[1]] @@ -275,7 +275,7 @@ def create_browse_media_response( def base_owntone_library() -> BrowseMedia: - """Return the base of our Owntone library.""" + """Return the base of our OwnTone library.""" children = [ BrowseMedia( title=name, @@ -290,10 +290,10 @@ def base_owntone_library() -> BrowseMedia: for name, (media_class, media_type, media_subtype) in TOP_LEVEL_LIBRARY.items() ] return BrowseMedia( - title="Owntone Library", + title="OwnTone Library", media_class=MediaClass.APP, media_content_id=create_media_content_id( - title="Owntone Library", media_type=MediaType.APP + title="OwnTone Library", media_type=MediaType.APP ), media_content_type=MediaType.APP, can_play=False, @@ -308,10 +308,10 @@ def library(other: Sequence[BrowseMedia] | None) -> BrowseMedia: top_level_items = [ BrowseMedia( - title="Owntone Library", + title="OwnTone Library", media_class=MediaClass.APP, media_content_id=create_media_content_id( - title="Owntone Library", media_type=MediaType.APP + title="OwnTone Library", media_type=MediaType.APP ), media_content_type=MediaType.APP, can_play=False, @@ -323,7 +323,7 @@ def library(other: Sequence[BrowseMedia] | None) -> BrowseMedia: top_level_items.extend(other) return BrowseMedia( - title="Owntone", + title="OwnTone", media_class=MediaClass.DIRECTORY, media_content_id="", media_content_type=MEDIA_TYPE_DIRECTORY, diff --git a/homeassistant/components/forked_daapd/const.py b/homeassistant/components/forked_daapd/const.py index f74fe0b049d..69438dc17f1 100644 --- a/homeassistant/components/forked_daapd/const.py +++ b/homeassistant/components/forked_daapd/const.py @@ -30,7 +30,7 @@ DEFAULT_TTS_PAUSE_TIME = 1.2 DEFAULT_TTS_VOLUME = 0.8 DEFAULT_UNMUTE_VOLUME = 0.6 DOMAIN = "forked_daapd" # key for hass.data -FD_NAME = "Owntone" +FD_NAME = "OwnTone" HASS_DATA_REMOVE_LISTENERS_KEY = "REMOVE_LISTENERS" HASS_DATA_UPDATER_KEY = "UPDATER" KNOWN_PIPES = {"librespot-java"} diff --git a/homeassistant/components/forked_daapd/manifest.json b/homeassistant/components/forked_daapd/manifest.json index 99064f28863..a7e64d159d5 100644 --- a/homeassistant/components/forked_daapd/manifest.json +++ b/homeassistant/components/forked_daapd/manifest.json @@ -1,6 +1,6 @@ { "domain": "forked_daapd", - "name": "Owntone", + "name": "OwnTone", "after_dependencies": ["spotify"], "codeowners": ["@uvjustin"], "config_flow": true, diff --git a/homeassistant/components/forked_daapd/strings.json b/homeassistant/components/forked_daapd/strings.json index 76a03abeb4b..a41bb4d6865 100644 --- a/homeassistant/components/forked_daapd/strings.json +++ b/homeassistant/components/forked_daapd/strings.json @@ -3,7 +3,7 @@ "flow_title": "{name} ({host})", "step": { "user": { - "title": "Set up Owntone device", + "title": "Set up OwnTone device", "data": { "name": "Friendly name", "host": "[%key:common::config_flow::data::host%]", @@ -13,23 +13,23 @@ } }, "error": { - "forbidden": "Unable to connect. Please check your Owntone network permissions.", - "websocket_not_enabled": "Owntone server websocket not enabled.", + "forbidden": "Unable to connect. Please check your OwnTone network permissions.", + "websocket_not_enabled": "OwnTone server websocket not enabled.", "wrong_host_or_port": "Unable to connect. Please check host and port.", "wrong_password": "Incorrect password.", - "wrong_server_type": "The Owntone integration requires an Owntone server with version >= 27.0.", + "wrong_server_type": "The OwnTone integration requires an OwnTone server with version >= 27.0.", "unknown_error": "[%key:common::config_flow::error::unknown%]" }, "abort": { "already_configured": "[%key:common::config_flow::abort::already_configured_device%]", - "not_forked_daapd": "Device is not an Owntone server." + "not_forked_daapd": "Device is not an OwnTone server." } }, "options": { "step": { "init": { - "title": "Configure Owntone options", - "description": "Set various options for the Owntone integration.", + "title": "Configure OwnTone options", + "description": "Set various options for the OwnTone integration.", "data": { "librespot_java_port": "Port for librespot-java pipe control (if used)", "max_playlists": "Max number of playlists used as sources", diff --git a/homeassistant/generated/integrations.json b/homeassistant/generated/integrations.json index 2e97341a195..cee5b2167a8 100644 --- a/homeassistant/generated/integrations.json +++ b/homeassistant/generated/integrations.json @@ -1739,7 +1739,7 @@ "iot_class": "cloud_polling" }, "forked_daapd": { - "name": "Owntone", + "name": "OwnTone", "integration_type": "hub", "config_flow": true, "iot_class": "local_push" diff --git a/tests/components/forked_daapd/test_browse_media.py b/tests/components/forked_daapd/test_browse_media.py index cc7735df980..3d540c1f5af 100644 --- a/tests/components/forked_daapd/test_browse_media.py +++ b/tests/components/forked_daapd/test_browse_media.py @@ -177,7 +177,7 @@ async def test_async_browse_media( """Browse the children of this BrowseMedia.""" nonlocal msg_id for child in children: - # Assert Spotify content is not passed through as Owntone media + # Assert Spotify content is not passed through as OwnTone media assert not ( is_owntone_media_content_id(child["media_content_id"]) and "Spotify" in MediaContent(child["media_content_id"]).title diff --git a/tests/components/forked_daapd/test_media_player.py b/tests/components/forked_daapd/test_media_player.py index f278bfa2503..ea9cf557570 100644 --- a/tests/components/forked_daapd/test_media_player.py +++ b/tests/components/forked_daapd/test_media_player.py @@ -355,7 +355,7 @@ def test_master_state(hass: HomeAssistant, mock_api_object) -> None: """Test master state attributes.""" state = hass.states.get(TEST_MASTER_ENTITY_NAME) assert state.state == STATE_PAUSED - assert state.attributes[ATTR_FRIENDLY_NAME] == "Owntone server" + assert state.attributes[ATTR_FRIENDLY_NAME] == "OwnTone server" assert state.attributes[ATTR_SUPPORTED_FEATURES] == SUPPORTED_FEATURES assert not state.attributes[ATTR_MEDIA_VOLUME_MUTED] assert state.attributes[ATTR_MEDIA_VOLUME_LEVEL] == 0.2 @@ -414,7 +414,7 @@ async def test_zone(hass: HomeAssistant, mock_api_object) -> None: """Test zone attributes and methods.""" zone_entity_name = TEST_ZONE_ENTITY_NAMES[0] state = hass.states.get(zone_entity_name) - assert state.attributes[ATTR_FRIENDLY_NAME] == "Owntone output (kitchen)" + assert state.attributes[ATTR_FRIENDLY_NAME] == "OwnTone output (kitchen)" assert state.attributes[ATTR_SUPPORTED_FEATURES] == SUPPORTED_FEATURES_ZONE assert state.state == STATE_ON assert state.attributes[ATTR_MEDIA_VOLUME_LEVEL] == 0.5