mirror of
https://github.com/antebudimir/feishin.git
synced 2025-12-31 18:13:31 +00:00
Replaygain support for Web Player (#243)
* replaygain! * resume context * don't fire both players * replaygain for jellyfin * actually remove console.log --------- Co-authored-by: Jeff <42182408+jeffvli@users.noreply.github.com> Co-authored-by: jeffvli <jeffvictorli@gmail.com>
This commit is contained in:
parent
fd264daffc
commit
65f28bb9dc
10 changed files with 190 additions and 17 deletions
|
|
@ -151,6 +151,11 @@ const normalizeSong = (
|
|||
createdAt: item.DateCreated,
|
||||
discNumber: (item.ParentIndexNumber && item.ParentIndexNumber) || 1,
|
||||
duration: item.RunTimeTicks / 10000,
|
||||
gain: item.LUFS
|
||||
? {
|
||||
track: -18 - item.LUFS,
|
||||
}
|
||||
: null,
|
||||
genres: item.GenreItems?.map((entry) => ({
|
||||
id: entry.Id,
|
||||
imageUrl: null,
|
||||
|
|
@ -165,6 +170,7 @@ const normalizeSong = (
|
|||
lyrics: null,
|
||||
name: item.Name,
|
||||
path: (item.MediaSources && item.MediaSources[0]?.Path) || null,
|
||||
peak: null,
|
||||
playCount: (item.UserData && item.UserData.PlayCount) || 0,
|
||||
playlistItemId: item.PlaylistItemId,
|
||||
// releaseDate: (item.ProductionYear && new Date(item.ProductionYear, 0, 1).toISOString()) || null,
|
||||
|
|
|
|||
|
|
@ -406,6 +406,7 @@ const song = z.object({
|
|||
ImageTags: imageTags,
|
||||
IndexNumber: z.number(),
|
||||
IsFolder: z.boolean(),
|
||||
LUFS: z.number().optional(),
|
||||
LocationType: z.string(),
|
||||
MediaSources: z.array(mediaSources),
|
||||
MediaType: z.string(),
|
||||
|
|
|
|||
|
|
@ -74,7 +74,6 @@ const normalizeSong = (
|
|||
});
|
||||
|
||||
const imagePlaceholderUrl = null;
|
||||
|
||||
return {
|
||||
album: item.album,
|
||||
albumArtists: [{ id: item.artistId, imageUrl: null, name: item.artist }],
|
||||
|
|
@ -90,6 +89,10 @@ const normalizeSong = (
|
|||
createdAt: item.createdAt.split('T')[0],
|
||||
discNumber: item.discNumber,
|
||||
duration: item.duration * 1000,
|
||||
gain:
|
||||
item.rgAlbumGain || item.rgTrackGain
|
||||
? { album: item.rgAlbumGain, track: item.rgTrackGain }
|
||||
: null,
|
||||
genres: item.genres?.map((genre) => ({
|
||||
id: genre.id,
|
||||
imageUrl: null,
|
||||
|
|
@ -104,6 +107,10 @@ const normalizeSong = (
|
|||
lyrics: item.lyrics ? item.lyrics : null,
|
||||
name: item.title,
|
||||
path: item.path,
|
||||
peak:
|
||||
item.rgAlbumPeak || item.rgTrackPeak
|
||||
? { album: item.rgAlbumPeak, track: item.rgTrackPeak }
|
||||
: null,
|
||||
playCount: item.playCount,
|
||||
playlistItemId,
|
||||
releaseDate: new Date(item.year, 0, 1).toISOString(),
|
||||
|
|
|
|||
|
|
@ -205,6 +205,10 @@ const song = z.object({
|
|||
playCount: z.number(),
|
||||
playDate: z.string(),
|
||||
rating: z.number().optional(),
|
||||
rgAlbumGain: z.number().optional(),
|
||||
rgAlbumPeak: z.number().optional(),
|
||||
rgTrackGain: z.number().optional(),
|
||||
rgTrackPeak: z.number().optional(),
|
||||
size: z.number(),
|
||||
sortAlbumArtistName: z.string(),
|
||||
sortArtistName: z.string(),
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ const normalizeSong = (
|
|||
createdAt: item.created,
|
||||
discNumber: item.discNumber || 1,
|
||||
duration: item.duration || 0,
|
||||
gain: null,
|
||||
genres: item.genre
|
||||
? [
|
||||
{
|
||||
|
|
@ -86,6 +87,7 @@ const normalizeSong = (
|
|||
lyrics: null,
|
||||
name: item.title,
|
||||
path: item.path,
|
||||
peak: null,
|
||||
playCount: item?.playCount || 0,
|
||||
releaseDate: null,
|
||||
releaseYear: item.year ? String(item.year) : null,
|
||||
|
|
|
|||
|
|
@ -171,6 +171,11 @@ export type Album = {
|
|||
userRating: number | null;
|
||||
} & { songs?: Song[] };
|
||||
|
||||
export type GainInfo = {
|
||||
album?: number;
|
||||
track?: number;
|
||||
};
|
||||
|
||||
export type Song = {
|
||||
album: string | null;
|
||||
albumArtists: RelatedArtist[];
|
||||
|
|
@ -186,6 +191,7 @@ export type Song = {
|
|||
createdAt: string;
|
||||
discNumber: number;
|
||||
duration: number;
|
||||
gain: GainInfo | null;
|
||||
genres: Genre[];
|
||||
id: string;
|
||||
imagePlaceholderUrl: string | null;
|
||||
|
|
@ -195,6 +201,7 @@ export type Song = {
|
|||
lyrics: string | null;
|
||||
name: string;
|
||||
path: string | null;
|
||||
peak: GainInfo | null;
|
||||
playCount: number;
|
||||
playlistItemId?: string;
|
||||
releaseDate: string | null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue