Skip to content

Commit

Permalink
[jellyfin] add play by id channels and update sdk (#13389)
Browse files Browse the repository at this point in the history
* [jellyfin] add play by id channels and update sdk
* [jellyfin] add missed Playing Item Id channel

Signed-off-by: Miguel Álvarez <miguelwork92@gmail.com>
  • Loading branch information
GiviMAD authored Sep 18, 2022
1 parent b2d9fe5 commit 4ebcb70
Show file tree
Hide file tree
Showing 8 changed files with 214 additions and 53 deletions.
8 changes: 7 additions & 1 deletion bundles/org.openhab.binding.jellyfin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ This is the binding for [Jellyfin](https://jellyfin.org) the volunteer-built med
Stream to any device from your own server, with no strings attached.
Your media, your server, your way.
This binding allows connect to Jellyfin clients that supports remote control, it's build on top of the official Jellyfin kotlin sdk.
Compatible with Jellyfin servers in version 10.8.x.

## Supported Things

Expand Down Expand Up @@ -48,6 +49,7 @@ In order to assist you with this process the binding expose a simple login form
|----------|--------|------------------------------|
| send-notification | String | Display message in client |
| media-control | Player | Control media playback |
| playing-item-id | String | Id of the item currently playing (readonly) |
| playing-item-name | String | Name of the item currently playing (readonly) |
| playing-item-series-name | String | Name of the item's series currently playing, only have value when item is an episode (readonly) |
| playing-item-season-name | String | Name of the item's season currently playing, only have value when item is an episode (readonly) |
Expand All @@ -62,7 +64,10 @@ In order to assist you with this process the binding expose a simple login form
| play-next-by-terms | String | Add to playback queue as next by terms, works for series, episodes and movies; terms search is explained bellow |
| play-last-by-terms | String | Add to playback queue as last by terms, works for series, episodes and movies; terms search is explained bellow |
| browse-by-terms | String | Browse media by terms, works for series, episodes and movies; terms search is explained bellow |

| play-by-id | String | Play media by id, works for series, episodes and movies; id search is explained bellow |
| play-next-by-id | String | Add to playback queue as next by id, works for series, episodes and movies |
| play-last-by-id | String | Add to playback queue as last by id, works for series, episodes and movies |
| browse-by-id | String | Browse media by id, works for series, episodes and movies |
### Terms search:

The terms search has a default behavior that can be modified sending some predefined prefixes.
Expand Down Expand Up @@ -106,6 +111,7 @@ Thing jellyfin:client:exampleServerId:<JELLYFIN_DEVICE_ID> "Jellyfin Android cli
```
String strJellyfinAndroidSendNotification { channel="jellyfin:client:exampleServerId:<JELLYFIN_DEVICE_ID>:send-notification " }
Player plJellyfinAndroidMediaControl { channel="jellyfin:client:exampleServerId:<JELLYFIN_DEVICE_ID>:media-control" }
String strJellyfinAndroidPlayingItemId { channel="jellyfin:client:exampleServerId:<JELLYFIN_DEVICE_ID>:playing-item-id" }
String strJellyfinAndroidPlayingItemName { channel="jellyfin:client:exampleServerId:<JELLYFIN_DEVICE_ID>:playing-item-name" }
String strJellyfinAndroidPlayingItemSeriesName { channel="jellyfin:client:exampleServerId:<JELLYFIN_DEVICE_ID>:playing-item-series-name" }
String strJellyfinAndroidPlayingItemSeasonName { channel="jellyfin:client:exampleServerId:<JELLYFIN_DEVICE_ID>:playing-item-season-name" }
Expand Down
8 changes: 4 additions & 4 deletions bundles/org.openhab.binding.jellyfin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@
<dependency>
<groupId>org.jellyfin.sdk</groupId>
<artifactId>jellyfin-core-jvm</artifactId>
<version>1.2.0</version>
<version>1.3.5</version>
</dependency>
<dependency>
<groupId>org.jellyfin.sdk</groupId>
<artifactId>jellyfin-api-jvm</artifactId>
<version>1.2.0</version>
<version>1.3.5</version>
</dependency>
<dependency>
<groupId>org.jellyfin.sdk</groupId>
<artifactId>jellyfin-model-jvm</artifactId>
<version>1.2.0</version>
<version>1.3.5</version>
</dependency>
<dependency>
<groupId>io.ktor</groupId>
Expand Down Expand Up @@ -90,7 +90,7 @@
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-coroutines-core-jvm</artifactId>
<version>1.6.1</version>
<version>1.6.2</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class JellyfinBindingConstants {
public static final String SEND_NOTIFICATION_CHANNEL = "send-notification";
public static final String MEDIA_CONTROL_CHANNEL = "media-control";
public static final String PLAYING_ITEM_PERCENTAGE_CHANNEL = "playing-item-percentage";
public static final String PLAYING_ITEM_ID_CHANNEL = "playing-item-id";
public static final String PLAYING_ITEM_NAME_CHANNEL = "playing-item-name";
public static final String PLAYING_ITEM_SERIES_NAME_CHANNEL = "playing-item-series-name";
public static final String PLAYING_ITEM_SEASON_NAME_CHANNEL = "playing-item-season-name";
Expand All @@ -50,7 +51,10 @@ public class JellyfinBindingConstants {
public static final String PLAY_NEXT_BY_TERMS_CHANNEL = "play-next-by-terms";
public static final String PLAY_LAST_BY_TERMS_CHANNEL = "play-last-by-terms";
public static final String BROWSE_ITEM_BY_TERMS_CHANNEL = "browse-by-terms";

public static final String PLAY_BY_ID_CHANNEL = "play-by-id";
public static final String PLAY_NEXT_BY_ID_CHANNEL = "play-next-by-id";
public static final String PLAY_LAST_BY_ID_CHANNEL = "play-last-by-id";
public static final String BROWSE_ITEM_BY_ID_CHANNEL = "browse-by-id";
// Discovery
public static final int DISCOVERY_RESULT_TTL_SEC = 600;
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.jellyfin.sdk.api.client.exception.ApiClientException;
import org.jellyfin.sdk.api.operations.SystemApi;
import org.jellyfin.sdk.compatibility.JavaFlow;
import org.jellyfin.sdk.compatibility.JavaFlow.FlowJob;
import org.jellyfin.sdk.model.ClientInfo;
import org.jellyfin.sdk.model.DeviceInfo;
import org.jellyfin.sdk.model.api.PublicSystemInfo;
Expand All @@ -53,7 +54,8 @@
@Component(service = DiscoveryService.class, configurationPid = "discovery.jellyfin")
public class JellyfinServerDiscoveryService extends AbstractDiscoveryService {
private final Logger logger = LoggerFactory.getLogger(JellyfinServerDiscoveryService.class);
private JavaFlow.@Nullable FlowJob cancelDiscovery;
@Nullable
private FlowJob cancelDiscovery;

public JellyfinServerDiscoveryService() throws IllegalArgumentException {
super(Set.of(THING_TYPE_CLIENT), 60);
Expand Down
Loading

0 comments on commit 4ebcb70

Please sign in to comment.