Skip to content

Commit

Permalink
Server: More fixes!
Browse files Browse the repository at this point in the history
  • Loading branch information
e3ndr committed Jan 8, 2025
1 parent 46389a8 commit 5a6440f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class InternalRoutes implements HttpProvider {
private MediaStreamRoutes streamRoutes = new MediaStreamRoutes();

@HttpEndpoint(uri = "/_internal/media/:mediaId/stream")
@HttpEndpoint(uri = "/_internal/media/:mediaId/stream/raw")
public HttpResponse onStreamRAW(SoraHttpSession session) {
return this.streamRoutes.onStreamRAW(session);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package xyz.e3ndr.athena.service.special;

import java.util.LinkedList;
import java.util.List;

import co.casterlabs.rhs.protocol.StandardHttpStatus;
Expand Down Expand Up @@ -40,24 +41,20 @@ public HttpResponse onSearch(SoraHttpSession session) {
}

private static String generatePlaylistForMedia(String host, List<Media> mediaList) {
StringBuilder playlistResponse = new StringBuilder();
playlistResponse.append("[Playlist]\r\n");
List<String> playlistResponse = new LinkedList<>();
playlistResponse.add("#EXTM3U");

int idx = 1;
for (Media media : mediaList) {
String url = String.format(
"http://%s/_internal/media/%s/stream/raw?quality=SD&format=MKV&videoCodec=H264&audioCodec=AAC",
"http://%s/_internal/media/%s/stream/raw?quality=SD&format=MKV&videoCodec=H264_BASELINE&audioCodec=AAC&subtitleCodec=ASS",
host, media.getId()
);

playlistResponse.append(String.format("File%d=%s\r\n", idx, url));
playlistResponse.append(String.format("Title%d=%s\r\n", idx, media.toString()));
playlistResponse.append(String.format("Length%d=0\r\n", idx));
playlistResponse.append("\r\n");
idx++;
playlistResponse.add(String.format("#EXTINF:-1=\"%s\",%s", media.getFiles().getImages().getPosterUrl(), media.toString()));
playlistResponse.add(url);
}

return playlistResponse.toString();
return String.join("\r\n", playlistResponse);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public enum SubtitleCodec {

// @formatter:off
WEBVTT ("webvtt"),
STR ("srt"),
SRT ("srt"),
ASS ("ass"),
// @formatter:on
;
Expand Down

0 comments on commit 5a6440f

Please sign in to comment.