-
-
Notifications
You must be signed in to change notification settings - Fork 456
[WIP] Add a new feature media to simplify handling of media in Openhab #4709
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
8084f4d
to
2192a70
Compare
Hello @ALL, @florian-h05, @digitaldan, @lsiepel, I would apreciate if someone with more experience in core that me can give comments on this first version. I finally decide to drop my new BrowerMediaItem implementation, and modify the existing PlayerItem. The MediaType is a complex type compose of:
This command would be relay from core to addons, and addons would have to implement if to handle the play/queue request. Laurent |
Not sure if i can be of much help here. If i have more tim ei could look into it, but i think others have more knowledge about these parts. JFTR please don't use force-push as this makes it harder to review / keep track of changes. |
98231cf
to
2e88374
Compare
Hello, Make some progress on this today. Still a lot of work to be done on it. Laurent. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new media feature to simplify handling of media in OpenHAB, addressing issue #4710. The implementation adds comprehensive media management capabilities including new state and command types, a media service architecture, and REST endpoints for media browsing.
Key changes include:
- Addition of new media-related type classes (
MediaCommandType
,MediaStateType
,MediaCommandEnumType
) for enhanced player item functionality - Implementation of a complete media service framework with model classes for organizing media content hierarchically
- Introduction of REST endpoints and HTTP servlet for media browsing and device management
Reviewed Changes
Copilot reviewed 42 out of 43 changed files in this pull request and generated 6 comments.
Show a summary per file
File | Description |
---|---|
PlayerItem.java | Extended to support new media command and state types |
MediaCommandType.java | New complex type for media commands with device/binding context |
MediaStateType.java | New complex type for media state with playback information |
MediaCommandEnumType.java | Enum defining available media commands (PLAY, PAUSE, etc.) |
MediaService.java | Core service interface for media registry and device management |
MediaServlet.java | HTTP servlet providing web interface for media browsing |
MediaResource.java | REST endpoints for media sources and sinks |
Various model classes | Hierarchical media content organization (sources, albums, tracks, etc.) |
@@ -0,0 +1,7 @@ | |||
package org.openhab.core.media.model; |
Copilot
AI
Jul 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing copyright header and author documentation. All other files in the media bundle include proper copyright headers and Javadoc comments.
Copilot uses AI. Check for mistakes.
@@ -0,0 +1,67 @@ | |||
package org.openhab.core.media; |
Copilot
AI
Jul 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing copyright header. Additionally, this appears to be test/debug code that should not be included in production.
Copilot uses AI. Check for mistakes.
@@ -0,0 +1,21 @@ | |||
package org.openhab.core.io.rest.media.internal; |
Copilot
AI
Jul 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing copyright header and class documentation.
Copilot uses AI. Check for mistakes.
@@ -0,0 +1,21 @@ | |||
package org.openhab.core.io.rest.media.internal; |
Copilot
AI
Jul 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing copyright header and class documentation.
Copilot uses AI. Check for mistakes.
} | ||
|
||
public String getPlayerItemName() { | ||
return this.getPlayerItemName(); |
Copilot
AI
Jul 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recursive call to getPlayerItemName() will cause a StackOverflowError. Should return this.playerItemName instead.
return this.getPlayerItemName(); | |
return this.playerItemName; |
Copilot uses AI. Check for mistakes.
return artUri; | ||
} | ||
|
||
public String getExternalArtUri() { |
Copilot
AI
Jul 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential NullPointerException if getMediaRegistry() returns null. The method should include null checking before calling getMediaService().
public String getExternalArtUri() { | |
public String getExternalArtUri() { | |
if (this.getMediaRegistry() == null) { | |
throw new IllegalStateException("MediaRegistry is not available."); | |
} |
Copilot uses AI. Check for mistakes.
<parent> | ||
<groupId>org.openhab.core.bundles</groupId> | ||
<artifactId>org.openhab.core.reactor.bundles</artifactId> | ||
<version>5.0.0-SNAPSHOT</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<version>5.0.0-SNAPSHOT</version> | |
<version>5.1.0-SNAPSHOT</version> |
<parent> | ||
<groupId>org.openhab.core.bundles</groupId> | ||
<artifactId>org.openhab.core.reactor.bundles</artifactId> | ||
<version>5.0.0-SNAPSHOT</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<version>5.0.0-SNAPSHOT</version> | |
<version>5.1.0-SNAPSHOT</version> |
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
…ng PlayerItem Signed-off-by: Laurent ARNAL <laurent@clae.net>
…of command : PLAY, ENQUEUE Signed-off-by: Laurent ARNAL <laurent@clae.net>
…evice directly from oh-player-controls Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
…cenario like target device change (currently test with spotify binding) Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
…est / implements on upnp Binding) Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
…ify) Signed-off-by: Laurent ARNAL <laurent@clae.net>
…ify) Signed-off-by: Laurent ARNAL <laurent@clae.net>
- add mapping from MediaSink to item player name - extends mediaType to handle more state directly from binding : currentTrack, currentArtist, currentTrackPosition/Duration / volume Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Signed-off-by: Laurent ARNAL <laurent@clae.net>
Add a new feature media to simplify handling of media in Openhab
Description
See this issue for description :
#4710