[squeezebox] Add I18N support for Thing status descriptions (#18344)
* Add I18N support for thing status descriptions Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>pull/18348/head
parent
8623016be8
commit
72682766b3
|
@ -165,12 +165,13 @@ public class SqueezeBoxPlayerHandler extends BaseThingHandler implements Squeeze
|
|||
if (bridgeStatus == ThingStatus.OFFLINE) {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE);
|
||||
} else if (!this.connected) {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE);
|
||||
updateStatus(ThingStatus.OFFLINE);
|
||||
} else if (bridgeStatus == ThingStatus.ONLINE && getThing().getStatus() != ThingStatus.ONLINE) {
|
||||
updateStatus(ThingStatus.ONLINE, ThingStatusDetail.NONE);
|
||||
updateStatus(ThingStatus.ONLINE);
|
||||
}
|
||||
} else {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Bridge not found");
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
|
||||
"@text/offline.conf-error.bridge-not-found");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -485,18 +486,24 @@ public class SqueezeBoxPlayerHandler extends BaseThingHandler implements Squeeze
|
|||
// Only get the image if this is my PlayerHandler instance
|
||||
if (isMe(mac)) {
|
||||
if (url != null && !url.isEmpty()) {
|
||||
String sanitizedUrl = sanitizeUrl(url);
|
||||
RawType image = IMAGE_CACHE.putIfAbsentAndGet(url, () -> {
|
||||
logger.debug("Trying to download the content of URL {}", sanitizedUrl);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Trying to download the content of URL {}", sanitizeUrl(url));
|
||||
}
|
||||
try {
|
||||
return HttpUtil.downloadImage(url);
|
||||
} catch (IllegalArgumentException e) {
|
||||
logger.debug("IllegalArgumentException when downloading image from {}", sanitizedUrl, e);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("IllegalArgumentException when downloading image from {}", sanitizeUrl(url),
|
||||
e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
if (image == null) {
|
||||
logger.debug("Failed to download the content of URL {}", sanitizedUrl);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Failed to download the content of URL {}", sanitizeUrl(url));
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
return image;
|
||||
|
|
|
@ -389,7 +389,8 @@ public class SqueezeBoxServerHandler extends BaseBridgeHandler {
|
|||
this.password = config.password;
|
||||
|
||||
if (host.isEmpty()) {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.CONFIGURATION_ERROR, "host is not set");
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.CONFIGURATION_ERROR,
|
||||
"@text/offline.conf-error.host-not-set");
|
||||
return;
|
||||
}
|
||||
// Create URL for jsonrpc interface
|
||||
|
@ -486,7 +487,6 @@ public class SqueezeBoxServerHandler extends BaseBridgeHandler {
|
|||
}
|
||||
} catch (IOException e) {
|
||||
if (!terminate) {
|
||||
logger.warn("failed to read line from squeeze server socket: {}", e.getMessage());
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage());
|
||||
scheduleReconnect();
|
||||
}
|
||||
|
@ -503,9 +503,8 @@ public class SqueezeBoxServerHandler extends BaseBridgeHandler {
|
|||
|
||||
// check for end of stream from readLine
|
||||
if (endOfStream && !terminate) {
|
||||
logger.info("end of stream received from socket during readLine");
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
|
||||
"end of stream on socket read");
|
||||
"@text/offline.comm-error.end-of-stream");
|
||||
scheduleReconnect();
|
||||
}
|
||||
if (requestFavoritesJob != null && !requestFavoritesJob.isDone()) {
|
||||
|
@ -648,8 +647,9 @@ public class SqueezeBoxServerHandler extends BaseBridgeHandler {
|
|||
});
|
||||
break;
|
||||
default:
|
||||
logger.trace("Unhandled mixer message type '{}'", Arrays.toString(messageParts));
|
||||
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Unhandled mixer message type '{}'", Arrays.toString(messageParts));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -666,7 +666,9 @@ public class SqueezeBoxServerHandler extends BaseBridgeHandler {
|
|||
} else if ("disconnect".equals(action) || "forget".equals(action)) {
|
||||
connected = false;
|
||||
} else {
|
||||
logger.trace("Unhandled client message type '{}'", Arrays.toString(messageParts));
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Unhandled client message type '{}'", Arrays.toString(messageParts));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -876,7 +878,9 @@ public class SqueezeBoxServerHandler extends BaseBridgeHandler {
|
|||
return;
|
||||
} else {
|
||||
// Added so that actions (such as delete, index, jump, open) are not treated as "play"
|
||||
logger.trace("Unhandled playlist message type '{}'", Arrays.toString(messageParts));
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Unhandled playlist message type '{}'", Arrays.toString(messageParts));
|
||||
}
|
||||
return;
|
||||
}
|
||||
final String value = mode;
|
||||
|
|
|
@ -111,3 +111,9 @@ channel-type.squeezebox.year.description = Release year of the current song
|
|||
|
||||
channel-type.config.squeezebox.favoritesList.quoteList.label = Quote Favorites
|
||||
channel-type.config.squeezebox.favoritesList.quoteList.description = Wrap the right hand side of the favorites in quotes
|
||||
|
||||
# thing status descriptions
|
||||
|
||||
offline.conf-error.bridge-not-found = Bridge not found
|
||||
offline.conf-error.host-not-set = host is not set
|
||||
offline.comm-error.end-of-stream = end of stream on socket read
|
||||
|
|
Loading…
Reference in New Issue