mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-09 22:02:19 +02:00
Remove stream url, cleanup old audio player (#1269)
* Remove stream url, cleanup old audio player * remove unused api in playerbar waveform * make jellyfin transcoding work?
This commit is contained in:
@@ -13,30 +13,6 @@ import {
|
||||
} from '/@/shared/types/domain-types';
|
||||
import { ServerListItem, ServerType } from '/@/shared/types/types';
|
||||
|
||||
const getStreamUrl = (args: {
|
||||
container?: string;
|
||||
deviceId: string;
|
||||
eTag?: string;
|
||||
id: string;
|
||||
mediaSourceId?: string;
|
||||
server: null | ServerListItem;
|
||||
}) => {
|
||||
const { deviceId, id, server } = args;
|
||||
|
||||
return (
|
||||
`${server?.url}/audio` +
|
||||
`/${id}/universal` +
|
||||
`?userId=${server?.userId}` +
|
||||
`&deviceId=${deviceId}` +
|
||||
'&audioCodec=aac' +
|
||||
`&apiKey=${server?.credential}` +
|
||||
`&playSessionId=${deviceId}` +
|
||||
'&container=opus,mp3,aac,m4a,m4b,flac,wav,ogg' +
|
||||
'&transcodingContainer=ts' +
|
||||
'&transcodingProtocol=http'
|
||||
);
|
||||
};
|
||||
|
||||
const getAlbumArtistCoverArtUrl = (args: {
|
||||
baseUrl: string;
|
||||
item: z.infer<typeof jfType._response.albumArtist>;
|
||||
@@ -182,7 +158,6 @@ const getTags = (item: AlbumOrSong): null | Record<string, string[]> => {
|
||||
const normalizeSong = (
|
||||
item: z.infer<typeof jfType._response.song>,
|
||||
server: null | ServerListItem,
|
||||
deviceId: string,
|
||||
imageSize?: number,
|
||||
): Song => {
|
||||
let bitRate = 0;
|
||||
@@ -191,7 +166,6 @@ const normalizeSong = (
|
||||
let path: null | string = null;
|
||||
let sampleRate: null | number = null;
|
||||
let size = 0;
|
||||
let streamUrl = '';
|
||||
|
||||
if (item.MediaSources?.length) {
|
||||
const source = item.MediaSources[0];
|
||||
@@ -200,15 +174,6 @@ const normalizeSong = (
|
||||
path = source.Path;
|
||||
size = source.Size;
|
||||
|
||||
streamUrl = getStreamUrl({
|
||||
container: container,
|
||||
deviceId,
|
||||
eTag: source.ETag,
|
||||
id: item.Id,
|
||||
mediaSourceId: source.Id,
|
||||
server,
|
||||
});
|
||||
|
||||
if ((source.MediaStreams?.length || 0) > 0) {
|
||||
for (const stream of source.MediaStreams) {
|
||||
if (stream.Type === 'Audio') {
|
||||
@@ -296,7 +261,6 @@ const normalizeSong = (
|
||||
releaseYear: item.ProductionYear || null,
|
||||
sampleRate,
|
||||
size,
|
||||
streamUrl,
|
||||
tags: getTags(item),
|
||||
trackNumber: item.IndexNumber,
|
||||
updatedAt: item.DateCreated,
|
||||
@@ -361,7 +325,7 @@ const normalizeAlbum = (
|
||||
releaseYear: item.ProductionYear || null,
|
||||
size: null,
|
||||
songCount: item?.ChildCount || null,
|
||||
songs: item.Songs?.map((song) => normalizeSong(song, server, '', imageSize)),
|
||||
songs: item.Songs?.map((song) => normalizeSong(song, server, imageSize)),
|
||||
tags: getTags(item),
|
||||
updatedAt: item?.DateLastMediaAdded || item.DateCreated,
|
||||
userFavorite: item.UserData?.IsFavorite || false,
|
||||
|
||||
@@ -136,8 +136,6 @@ const normalizeSong = (
|
||||
size: size || 300,
|
||||
}) || null;
|
||||
|
||||
const streamUrl = `${server?.url}/rest/stream.view?id=${item.id}&v=1.13.0&c=Feishin&${server?.credential}`;
|
||||
|
||||
return {
|
||||
_itemType: LibraryItem.SONG,
|
||||
_serverId: server?.id || 'unknown',
|
||||
@@ -194,7 +192,6 @@ const normalizeSong = (
|
||||
releaseYear: item.year || null,
|
||||
sampleRate: item.samplingRate || null,
|
||||
size: item.size,
|
||||
streamUrl,
|
||||
tags: null,
|
||||
trackNumber: item.track || 1,
|
||||
updatedAt: '',
|
||||
|
||||
@@ -370,7 +370,6 @@ export type Song = {
|
||||
releaseYear: null | number;
|
||||
sampleRate: null | number;
|
||||
size: number;
|
||||
streamUrl: string;
|
||||
tags: null | Record<string, string[]>;
|
||||
trackNumber: number;
|
||||
updatedAt: string;
|
||||
@@ -1224,10 +1223,10 @@ export type ControllerEndpoint = {
|
||||
getSongDetail: (args: SongDetailArgs) => Promise<SongDetailResponse>;
|
||||
getSongList: (args: SongListArgs) => Promise<SongListResponse>;
|
||||
getSongListCount: (args: SongListCountArgs) => Promise<number>;
|
||||
getStreamUrl: (args: StreamArgs) => string;
|
||||
getStructuredLyrics?: (args: StructuredLyricsArgs) => Promise<StructuredLyric[]>;
|
||||
getTags?: (args: TagArgs) => Promise<TagResponses>;
|
||||
getTopSongs: (args: TopSongListArgs) => Promise<TopSongListResponse>;
|
||||
getTranscodingUrl: (args: TranscodingArgs) => string;
|
||||
getUserList?: (args: UserListArgs) => Promise<UserListResponse>;
|
||||
movePlaylistItem?: (args: MoveItemArgs) => Promise<void>;
|
||||
removeFromPlaylist: (args: RemoveFromPlaylistArgs) => Promise<RemoveFromPlaylistResponse>;
|
||||
@@ -1314,12 +1313,12 @@ export type InternalControllerEndpoint = {
|
||||
getSongDetail: (args: ReplaceApiClientProps<SongDetailArgs>) => Promise<SongDetailResponse>;
|
||||
getSongList: (args: ReplaceApiClientProps<SongListArgs>) => Promise<SongListResponse>;
|
||||
getSongListCount: (args: ReplaceApiClientProps<SongListCountArgs>) => Promise<number>;
|
||||
getStreamUrl: (args: ReplaceApiClientProps<StreamArgs>) => string;
|
||||
getStructuredLyrics?: (
|
||||
args: ReplaceApiClientProps<StructuredLyricsArgs>,
|
||||
) => Promise<StructuredLyric[]>;
|
||||
getTags?: (args: ReplaceApiClientProps<TagArgs>) => Promise<TagResponses>;
|
||||
getTopSongs: (args: ReplaceApiClientProps<TopSongListArgs>) => Promise<TopSongListResponse>;
|
||||
getTranscodingUrl: (args: ReplaceApiClientProps<TranscodingArgs>) => string;
|
||||
getUserList?: (args: ReplaceApiClientProps<UserListArgs>) => Promise<UserListResponse>;
|
||||
movePlaylistItem?: (args: ReplaceApiClientProps<MoveItemArgs>) => Promise<void>;
|
||||
removeFromPlaylist: (
|
||||
@@ -1380,6 +1379,17 @@ export type SimilarSongsQuery = {
|
||||
songId: string;
|
||||
};
|
||||
|
||||
export type StreamArgs = BaseEndpointArgs & {
|
||||
query: StreamQuery;
|
||||
};
|
||||
|
||||
export type StreamQuery = {
|
||||
bitrate?: number;
|
||||
format?: string;
|
||||
id: string;
|
||||
transcode: boolean;
|
||||
};
|
||||
|
||||
export type StructuredLyric = (StructuredSyncedLyric | StructuredUnsyncedLyric) & {
|
||||
lang: string;
|
||||
};
|
||||
@@ -1417,16 +1427,6 @@ export type TagResponses = {
|
||||
enumTags?: Tag[];
|
||||
};
|
||||
|
||||
export type TranscodingArgs = BaseEndpointArgs & {
|
||||
query: TranscodingQuery;
|
||||
};
|
||||
|
||||
export type TranscodingQuery = {
|
||||
base: string;
|
||||
bitrate?: number;
|
||||
format?: string;
|
||||
};
|
||||
|
||||
type BaseEndpointArgsWithServer = {
|
||||
apiClientProps: {
|
||||
server: null | ServerListItemWithCredential;
|
||||
|
||||
Reference in New Issue
Block a user