diff --git a/CODEOWNERS b/CODEOWNERS index 51ca14a5bd2..899c818aa13 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -267,6 +267,7 @@ /bundles/org.openhab.binding.pjlinkdevice/ @nils /bundles/org.openhab.binding.playstation/ @FluBBaOfWard /bundles/org.openhab.binding.plclogo/ @falkena +/bundles/org.openhab.binding.plex/ @aronbeurskens /bundles/org.openhab.binding.plugwise/ @wborn /bundles/org.openhab.binding.plugwiseha/ @lsiepel /bundles/org.openhab.binding.powermax/ @lolodomo diff --git a/bom/openhab-addons/pom.xml b/bom/openhab-addons/pom.xml index d55708c7fb9..54802e935c9 100644 --- a/bom/openhab-addons/pom.xml +++ b/bom/openhab-addons/pom.xml @@ -1326,6 +1326,11 @@ org.openhab.binding.plclogo ${project.version} + + org.openhab.addons.bundles + org.openhab.binding.plex + ${project.version} + org.openhab.addons.bundles org.openhab.binding.plugwise diff --git a/bundles/org.openhab.binding.plex/NOTICE b/bundles/org.openhab.binding.plex/NOTICE new file mode 100644 index 00000000000..38d625e3492 --- /dev/null +++ b/bundles/org.openhab.binding.plex/NOTICE @@ -0,0 +1,13 @@ +This content is produced and maintained by the openHAB project. + +* Project home: https://www.openhab.org + +== Declared Project Licenses + +This program and the accompanying materials are made available under the terms +of the Eclipse Public License 2.0 which is available at +https://www.eclipse.org/legal/epl-2.0/. + +== Source Code + +https://github.com/openhab/openhab-addons diff --git a/bundles/org.openhab.binding.plex/README.md b/bundles/org.openhab.binding.plex/README.md new file mode 100644 index 00000000000..8a48f8f1c11 --- /dev/null +++ b/bundles/org.openhab.binding.plex/README.md @@ -0,0 +1,167 @@ +# PLEX Binding + +This binding can read information from multiple PLEX players connected to a PLEX server. + +It can be used for multiple scenarios: + +* Drive light changes based on player status. For instances turn off the lights when movie starts playing and turn them back on when movie is stopped/paused +* Create a page that displays currently played media of one or more player connected to the server. +* Send social media messages when player plays new media +* Inform what the end time of the currently played media is + +The binding can also control `PLAY/PAUSE/NEXT/PREVIOUS` the players which can be used for: + +* Start playing some music when someone enters a room +* Pause the movie when motion is detected + +## Supported Things + +This binding supports 2 things. + +- `server`: The PLEX server will act as a bridge to read out the information from all connected players +- `player`: A PLEX client of any type / os connected to the server. + +## Discovery + +For the auto discovery to work correctly you first need to configure and add the `PLEX Server` Thing. +Next step is to *PLAY* something on the desired player. Only when media is played on the player it will show up in the auto discovery! + +## Thing Configuration + +The PLEX Server needs to be configured first. The hostname of the PLEX server is mandatory and the either the PLEX token (recommended) or the username/password of the PLEX server (not recommended). + +Then find the PLEX token please follow the instructions from the PLEX support forum: + +1. Sign in to your Plex account in Plex Web App +2. Browse to a library item and view the XML for it +3. Look in the URL and find the token as the X-Plex-Token value + +### `PLEX Server` Thing Configuration + +| Name | Type | Description | Default | Required | Advanced | +|-------------|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|----------|---------| +| host | text | PLEX host name or IP address | N/A | yes | no | +| portNumber | integer | Port Number (leave blank if PLEX installed on default port) | 32400 | no | no | +| refreshRate | integer | Interval in seconds at which PLEX server status is polled | 5 | no | no | +| username | text | If you're using Plex Home you need to supply the username and password of your Plex account here. If you don't want to enter your credentials you can also directly set your account token below instead. | N/A | no | no | +| password | text | If you're using Plex Home you need to supply the username and password of your Plex account here. If you don't want to enter your credentials you can also directly set your account token below instead. | N/A | no | no | +| token | text | The authentication token when username/password is left blank | N/A | no | no | + +### `PLEX Player` Thing Configuration + +You can add multiple PLEX players. You can choose to find the player by autodiscovery or add them manually. + +#### Autodiscovery + +Turn on the player you want to add and *play* some media on it. Navigate to `/settings/things/add/plex` and start the auto discover. +The player will be found and you can add it. + +#### Manual adding a player Thing + +When you want to add them manually go to the following url [https://plex.tv/devices.xml] and login when needed. + +It will display the following XML file. + +```xml + + + + + + + + + + + + + + + + + + + + + + +``` + +Find the `Device` block of the player you want to add and fill in the `clientIdentifier` as `playerID` + +| Name | Type | Description | Default | Required | Advanced | +|-------------|---------|--------------------------------------------------------------------------------------------|---------|----------|---------| +| playerID | text | The unique identifier of the player. `clientIdentifier` from [https://plex.tv/devices.xml] | N/A | yes | no | + +## Channels + +The PLEX Player supports the following channels: + +| Channel | Type | Read/Write | Description | +|----------------------|----------|------------|-----------------------------------------------------------------------| +| currentPlayers | Number | RO | The number of players currently configured to watch on PLEX | +| currentPlayersActive | Number | RO | The number of players currently being used on PLEX | +| state | String | RO | The current state of the Player (BUFFERING, PLAYING, PAUSED, STOPPED) | +| power | Switch | RO | The power status of the player | +| title | String | RO | The title of media that is playing | +| type | String | RO | The current type of playing media | +| endtime | DateTime | RO | Time at which the media that is playing will end | +| progress | Dimmer | RO | The current progress of playing media | +| art | String | RO | The URL of the background art for currently playing media | +| thumb | String | RO | The URL of the cover art for currently playing media | +| player | Player | RW | The control channel for the player `PLAY/PAUSE/NEXT/PREVIOUS` | + +## Full Example + +`.things` file: + +```java +Bridge plex:server:plexrServer "Bridge Plex : Plex" [host="IP.Address.Or.Hostname", token="SadhjsajjA3AG", refreshRate=5] +{ + Thing plex:player:MyViewerName01 "My Viewer Name 01" [playerID="ClientIdentifierFromDevices.XML1"] + Thing plex:player:MyViewerName02 "My Viewer Name 02" [playerID="ClientIdentifierFromDevices.XML2"] +} +``` + +`.items` file + +```java +String BridgePlexCurrent "Current players" {channel="plex:server:plexrServer:currentPlayers"} +String BridgePlexCurrentActive "Current players active" {channel="plex:server:plexrServer:currentPlayersActive"} +Switch PlexTVPower01 "Power" {channel="plex:player:MyViewerName01:power"} +String PlexTVStatus01 "Status [%s]" {channel="plex:player:MyViewerName01:state"} +String PlexTVTitle01 "Title [%s]" {channel="plex:player:MyViewerName01:title"} +String PlexTVType01 "Type [%s]" {channel="plex:player:MyViewerName01:type"} +String PlexTVEndTime01 "End time" {channel="plex:player:MyViewerName01:endtime"} +Dimmer PlexTVProgress01 "Progress [%.1f%%]" {channel="plex:player:MyViewerName01:progress"} +String PlexTVCover1 "Cover" {channel="plex:player:MyViewerName01:thumb"} +String ShellArt01 "Background art" {channel="plex:player:MyViewerName01:art"} +Switch PlexTVPower02 "Power" {channel="plex:player:MyViewerName02:power"} +String PlexTVStatus02 "Status [%s]" {channel="plex:player:MyViewerName02:state"} +String PlexTVTitle02 "Title [%s]" {channel="plex:player:MyViewerName02:title"} +String PlexTVType02 "Type [%s]" {channel="plex:player:MyViewerName02:type"} +String PlexTVEndTime02 "End time" {channel="plex:player:MyViewerName02:endtime"} +Dimmer PlexTVProgress02 "Progress [%.1f%%]" {channel="plex:player:MyViewerName02:progress"} +String PlexTVCover2 "Cover" {channel="plex:player:MyViewerName02:thumb"} +String ShellArt02 "Background art" {channel="plex:player:MyViewerName02:art"} +``` + +`.rules` file + +```java +rule "Send telegram with title for My Viewer Name 01" +when + Item PlexTVTitle01 changed +then + val telegramActionPlexBot = getActions("telegram","telegram:telegramBot:PlexBot") + telegramActionPlexBot.sendTelegram("Bedroom Roku is watching %s", PlexTVTitle01.state.toString) +end + +rule "Send telegram with title for My Viewer Name 02" +when + Item PlexTVTitle02 changed +then + val telegramActionPlexBot = getActions("telegram","telegram:telegramBot:PlexBot") + telegramActionPlexBot.sendTelegram("Bedroom Roku is watching %s", PlexTVTitle02.state.toString) +end +``` diff --git a/bundles/org.openhab.binding.plex/pom.xml b/bundles/org.openhab.binding.plex/pom.xml new file mode 100644 index 00000000000..d37438f757a --- /dev/null +++ b/bundles/org.openhab.binding.plex/pom.xml @@ -0,0 +1,17 @@ + + + + 4.0.0 + + + org.openhab.addons.bundles + org.openhab.addons.reactor.bundles + 4.0.0-SNAPSHOT + + + org.openhab.binding.plex + + openHAB Add-ons :: Bundles :: Plex Binding + + diff --git a/bundles/org.openhab.binding.plex/src/main/feature/feature.xml b/bundles/org.openhab.binding.plex/src/main/feature/feature.xml new file mode 100644 index 00000000000..892b597a003 --- /dev/null +++ b/bundles/org.openhab.binding.plex/src/main/feature/feature.xml @@ -0,0 +1,10 @@ + + + mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features + + + openhab-runtime-base + openhab.tp-jaxb + mvn:org.openhab.addons.bundles/org.openhab.binding.plex/${project.version} + + diff --git a/bundles/org.openhab.binding.plex/src/main/java/org/openhab/binding/plex/discovery/PlexDiscoveryService.java b/bundles/org.openhab.binding.plex/src/main/java/org/openhab/binding/plex/discovery/PlexDiscoveryService.java new file mode 100644 index 00000000000..a7b3659da55 --- /dev/null +++ b/bundles/org.openhab.binding.plex/src/main/java/org/openhab/binding/plex/discovery/PlexDiscoveryService.java @@ -0,0 +1,58 @@ +/** + * Copyright (c) 2010-2023 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.plex.discovery; + +import static org.openhab.binding.plex.internal.PlexBindingConstants.*; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.binding.plex.internal.handler.PlexServerHandler; +import org.openhab.core.config.discovery.AbstractDiscoveryService; +import org.openhab.core.config.discovery.DiscoveryResult; +import org.openhab.core.config.discovery.DiscoveryResultBuilder; +import org.openhab.core.thing.ThingTypeUID; +import org.openhab.core.thing.ThingUID; + +/** + * @author Brian Homeyer - Initial contribution + * @author Aron Beurskens - Binding development + */ +@NonNullByDefault +public class PlexDiscoveryService extends AbstractDiscoveryService { + private final PlexServerHandler bridgeHandler; + + public PlexDiscoveryService(PlexServerHandler bridgeHandler) { + super(SUPPORTED_THING_TYPES_UIDS, 10, false); + this.bridgeHandler = bridgeHandler; + } + + @Override + protected void startScan() { + for (String machineId : bridgeHandler.getAvailablePlayers()) { + ThingUID bridgeUID = bridgeHandler.getThing().getUID(); + ThingTypeUID thingTypeUID = UID_PLAYER; + ThingUID playerThingUid = new ThingUID(UID_PLAYER, bridgeUID, machineId); + + Map properties = new HashMap<>(); + properties.put(CONFIG_PLAYER_ID, machineId); + + DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(playerThingUid).withThingType(thingTypeUID) + .withProperties(properties).withBridge(bridgeUID).withRepresentationProperty(CONFIG_PLAYER_ID) + .withLabel("PLEX Player (" + machineId + ")").build(); + + thingDiscovered(discoveryResult); + } + } +} diff --git a/bundles/org.openhab.binding.plex/src/main/java/org/openhab/binding/plex/internal/PlexBindingConstants.java b/bundles/org.openhab.binding.plex/src/main/java/org/openhab/binding/plex/internal/PlexBindingConstants.java new file mode 100644 index 00000000000..33e4f37cb3a --- /dev/null +++ b/bundles/org.openhab.binding.plex/src/main/java/org/openhab/binding/plex/internal/PlexBindingConstants.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) 2010-2023 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.plex.internal; + +import java.util.Collections; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.core.thing.ThingTypeUID; + +/** + * The {@link PlexBindingConstants} class defines common constants, which are + * used across the whole binding. + * + * @author Brian Homeyer - Initial contribution + * @author Aron Beurskens - Binding development + */ +@NonNullByDefault +public class PlexBindingConstants { + private static final String BINDING_ID = "plex"; + + // Bridge thing + public static final String THING_TYPE_SERVER = "server"; + public static final ThingTypeUID UID_SERVER = new ThingTypeUID(BINDING_ID, THING_TYPE_SERVER); + public static final Set SUPPORTED_SERVER_THING_TYPES_UIDS = Set.of(UID_SERVER); + + // Monitor things + public static final String THING_TYPE_PLAYER = "player"; + public static final ThingTypeUID UID_PLAYER = new ThingTypeUID(BINDING_ID, THING_TYPE_PLAYER); + + // Collection of monitor thing types + public static final Set SUPPORTED_PLAYER_THING_TYPES_UIDS = Set.of(UID_PLAYER); + + // Collection of all supported thing types + public static final Set SUPPORTED_THING_TYPES_UIDS = Collections.unmodifiableSet( + Stream.concat(SUPPORTED_PLAYER_THING_TYPES_UIDS.stream(), SUPPORTED_SERVER_THING_TYPES_UIDS.stream()) + .collect(Collectors.toSet())); + // General purpose stuff + public static final int DEFAULT_REFRESH_PERIOD_SEC = 5; + // Config parameters + // Server + public static final String CONFIG_HOST = "host"; + public static final String CONFIG_PORT_NUMBER = "portNumber"; + public static final String CONFIG_TOKEN = "token"; + public static final String CONFIG_REFRESH_RATE = "refreshRate"; + // Player parameters + public static final String CONFIG_PLAYER_ID = "playerID"; + public static final String CONFIG_PLAYER_NAME = "playerName"; + + // List of all Channel ids + // Server + public static final String CHANNEL_SERVER_COUNT = "currentPlayers"; + public static final String CHANNEL_SERVER_COUNTACTIVE = "currentPlayersActive"; + // Player + public static final String CHANNEL_PLAYER_STATE = "state"; + public static final String CHANNEL_PLAYER_TITLE = "title"; + public static final String CHANNEL_PLAYER_TYPE = "type"; + public static final String CHANNEL_PLAYER_POWER = "power"; + public static final String CHANNEL_PLAYER_ART = "art"; + public static final String CHANNEL_PLAYER_THUMB = "thumb"; + public static final String CHANNEL_PLAYER_PROGRESS = "progress"; + public static final String CHANNEL_PLAYER_ENDTIME = "endtime"; + public static final String CHANNEL_PLAYER_CONTROL = "player"; + public static final String CHANNEL_PLAYER_USER = "user"; +} diff --git a/bundles/org.openhab.binding.plex/src/main/java/org/openhab/binding/plex/internal/PlexHandlerFactory.java b/bundles/org.openhab.binding.plex/src/main/java/org/openhab/binding/plex/internal/PlexHandlerFactory.java new file mode 100644 index 00000000000..8bd642cfc53 --- /dev/null +++ b/bundles/org.openhab.binding.plex/src/main/java/org/openhab/binding/plex/internal/PlexHandlerFactory.java @@ -0,0 +1,91 @@ +/** + * Copyright (c) 2010-2023 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.plex.internal; + +import static org.openhab.binding.plex.internal.PlexBindingConstants.*; + +import java.util.Hashtable; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; +import org.openhab.binding.plex.discovery.PlexDiscoveryService; +import org.openhab.binding.plex.internal.handler.PlexPlayerHandler; +import org.openhab.binding.plex.internal.handler.PlexServerHandler; +import org.openhab.core.config.discovery.DiscoveryService; +import org.openhab.core.io.net.http.HttpClientFactory; +import org.openhab.core.thing.Bridge; +import org.openhab.core.thing.Thing; +import org.openhab.core.thing.ThingTypeUID; +import org.openhab.core.thing.binding.BaseThingHandlerFactory; +import org.openhab.core.thing.binding.ThingHandler; +import org.openhab.core.thing.binding.ThingHandlerFactory; +import org.osgi.framework.ServiceRegistration; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; + +/** + * The {@link PlexHandlerFactory} is responsible for creating things and thing + * handlers. + * + * @author Brian Homeyer - Initial contribution + * @author Aron Beurskens - Binding development + */ +@NonNullByDefault +@Component(configurationPid = "binding.plex", service = ThingHandlerFactory.class) +public class PlexHandlerFactory extends BaseThingHandlerFactory { + private final HttpClientFactory httpClientFactory; + private @Nullable ServiceRegistration plexDiscoveryServiceRegistration; + + @Activate + public PlexHandlerFactory(final @Reference HttpClientFactory httpClientFactory) { + this.httpClientFactory = httpClientFactory; + } + + @Override + public boolean supportsThingType(ThingTypeUID thingTypeUID) { + return SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID); + } + + @Override + protected @Nullable ThingHandler createHandler(Thing thing) { + ThingTypeUID thingTypeUID = thing.getThingTypeUID(); + if (SUPPORTED_SERVER_THING_TYPES_UIDS.contains(thingTypeUID)) { + PlexServerHandler handler = new PlexServerHandler((Bridge) thing, httpClientFactory); + registerPlexDiscoveryService(handler); + return handler; + } else if (SUPPORTED_PLAYER_THING_TYPES_UIDS.contains(thingTypeUID)) { + return new PlexPlayerHandler(thing); + } + return null; + } + + @Override + protected synchronized void removeHandler(ThingHandler thingHandler) { + if (thingHandler instanceof PlexServerHandler) { + ServiceRegistration plexDiscoveryServiceRegistration = this.plexDiscoveryServiceRegistration; + if (plexDiscoveryServiceRegistration != null) { + // remove discovery service, if bridge handler is removed + plexDiscoveryServiceRegistration.unregister(); + } + } + } + + private void registerPlexDiscoveryService(PlexServerHandler handler) { + PlexDiscoveryService discoveryService = new PlexDiscoveryService(handler); + if (bundleContext != null) { + this.plexDiscoveryServiceRegistration = bundleContext.registerService(DiscoveryService.class.getName(), + discoveryService, new Hashtable<>()); + } + } +} diff --git a/bundles/org.openhab.binding.plex/src/main/java/org/openhab/binding/plex/internal/PlexStateDescriptionOptionProvider.java b/bundles/org.openhab.binding.plex/src/main/java/org/openhab/binding/plex/internal/PlexStateDescriptionOptionProvider.java new file mode 100644 index 00000000000..22025910e5d --- /dev/null +++ b/bundles/org.openhab.binding.plex/src/main/java/org/openhab/binding/plex/internal/PlexStateDescriptionOptionProvider.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) 2010-2023 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.plex.internal; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.core.thing.binding.BaseDynamicStateDescriptionProvider; +import org.openhab.core.thing.i18n.ChannelTypeI18nLocalizationService; +import org.openhab.core.thing.type.DynamicStateDescriptionProvider; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; + +/** + * Dynamic provider of state options while leaving other state description fields as original. + * + * @author Brian Homeyer - Initial contribution + * @author Aron Beurskens - Binding development + */ +@Component(service = { DynamicStateDescriptionProvider.class, PlexStateDescriptionOptionProvider.class }) +@NonNullByDefault +public class PlexStateDescriptionOptionProvider extends BaseDynamicStateDescriptionProvider { + @Reference + protected void setChannelTypeI18nLocalizationService( + final ChannelTypeI18nLocalizationService channelTypeI18nLocalizationService) { + this.channelTypeI18nLocalizationService = channelTypeI18nLocalizationService; + } + + protected void unsetChannelTypeI18nLocalizationService( + final ChannelTypeI18nLocalizationService channelTypeI18nLocalizationService) { + this.channelTypeI18nLocalizationService = null; + } +} diff --git a/bundles/org.openhab.binding.plex/src/main/java/org/openhab/binding/plex/internal/config/PlexPlayerConfiguration.java b/bundles/org.openhab.binding.plex/src/main/java/org/openhab/binding/plex/internal/config/PlexPlayerConfiguration.java new file mode 100644 index 00000000000..cb18fb3ee47 --- /dev/null +++ b/bundles/org.openhab.binding.plex/src/main/java/org/openhab/binding/plex/internal/config/PlexPlayerConfiguration.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) 2010-2023 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.plex.internal.config; + +import org.eclipse.jdt.annotation.NonNullByDefault; + +/** + * The {@link PlexPlayerConfiguration} is the class used to match the + * thing configuration. + * + * @author Brian Homeyer - Initial contribution + * @author Aron Beurskens - Binding development + */ +@NonNullByDefault +public class PlexPlayerConfiguration { + public String playerID = ""; +} diff --git a/bundles/org.openhab.binding.plex/src/main/java/org/openhab/binding/plex/internal/config/PlexServerConfiguration.java b/bundles/org.openhab.binding.plex/src/main/java/org/openhab/binding/plex/internal/config/PlexServerConfiguration.java new file mode 100644 index 00000000000..27ae78f014c --- /dev/null +++ b/bundles/org.openhab.binding.plex/src/main/java/org/openhab/binding/plex/internal/config/PlexServerConfiguration.java @@ -0,0 +1,33 @@ +/** + * Copyright (c) 2010-2023 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.plex.internal.config; + +import org.eclipse.jdt.annotation.NonNullByDefault; + +/** + * The {@link PlexServerConfiguration} is the class used to match the + * bridge configuration. + * + * @author Brian Homeyer - Initial contribution + * @author Aron Beurskens - Binding development + */ +@NonNullByDefault +public class PlexServerConfiguration { + public String host = ""; + public Integer portNumber = 32400; + public String token = ""; + public Integer refreshRate = 5; + public String username = ""; + public String password = ""; + public String scheme = ""; +} diff --git a/bundles/org.openhab.binding.plex/src/main/java/org/openhab/binding/plex/internal/dto/MediaContainer.java b/bundles/org.openhab.binding.plex/src/main/java/org/openhab/binding/plex/internal/dto/MediaContainer.java new file mode 100644 index 00000000000..f4caa7eac86 --- /dev/null +++ b/bundles/org.openhab.binding.plex/src/main/java/org/openhab/binding/plex/internal/dto/MediaContainer.java @@ -0,0 +1,277 @@ +/** + * Copyright (c) 2010-2023 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.plex.internal.dto; + +import java.util.List; + +import com.thoughtworks.xstream.annotations.XStreamAlias; +import com.thoughtworks.xstream.annotations.XStreamAsAttribute; +import com.thoughtworks.xstream.annotations.XStreamImplicit; + +/** + * + * @author Brian Homeyer - Initial contribution + * @author Aron Beurskens - Binding development + */ +@XStreamAlias("MediaContainer") +public class MediaContainer { + @XStreamAsAttribute + private Integer size; + @XStreamImplicit + @XStreamAsAttribute + private List