Skip to content
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

[freeboxos] Fix media playing #17244

Merged
merged 3 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,11 @@ public enum MediaType {
UNKNOWN
}

private static record Request(String password, Action action, MediaType mediaType, @Nullable String media,
private static record Request(String password, String action, String mediaType, @Nullable String media,
int position) {
Request(String password, Action action, MediaType mediaType, @Nullable String media, int position) {
this(password, action.name().toLowerCase(), mediaType.name().toLowerCase(), media, position);
}
}

public MediaReceiverManager(FreeboxOsSession session, UriBuilder uriBuilder) throws FreeboxException {
Expand All @@ -77,6 +80,6 @@ public void sendToReceiver(String receiver, String password, Action action, Medi
}

private void sendToReceiver(String receiver, Request payload) throws FreeboxException {
post(payload, GenericResponse.class, receiver);
post(payload, receiver);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import javax.ws.rs.core.UriBuilder;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.freeboxos.internal.api.FreeboxException;
import org.openhab.binding.freeboxos.internal.api.PermissionException;
import org.openhab.binding.freeboxos.internal.api.Response;
Expand Down Expand Up @@ -83,7 +84,11 @@ protected <F, T extends Response<F>> F post(Object payload, Class<T> clazz, Stri
}

protected void post(String... pathElements) throws FreeboxException {
session.execute(buildUri(pathElements), POST, GenericResponse.class, null);
post(null, pathElements);
}

protected <F> void post(@Nullable F payload, String... pathElements) throws FreeboxException {
session.execute(buildUri(pathElements), POST, GenericResponse.class, payload);
}

protected <F, T extends Response<F>> F put(Class<T> clazz, F payload, String... pathElements)
Expand Down