mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-07 20:40:15 +02:00
feat: Add explicit status for Navidrome and OpenSubsonic (#1220)
* add navidrome explicit status * add ExplicitStatus enum and support opensubsonic * add explicit status to cards
This commit is contained in:
@@ -245,6 +245,7 @@ const normalizeSong = (
|
||||
discNumber: (item.ParentIndexNumber && item.ParentIndexNumber) || 1,
|
||||
discSubtitle: null,
|
||||
duration: item.RunTimeTicks / 10000,
|
||||
explicitStatus: null,
|
||||
gain:
|
||||
item.NormalizationGain !== undefined
|
||||
? {
|
||||
@@ -317,6 +318,7 @@ const normalizeAlbum = (
|
||||
comment: null,
|
||||
createdAt: item.DateCreated,
|
||||
duration: item.RunTimeTicks / 10000,
|
||||
explicitStatus: null,
|
||||
genres: item.GenreItems?.map((entry) => ({
|
||||
id: entry.Id,
|
||||
imageUrl: null,
|
||||
|
||||
@@ -13,6 +13,7 @@ export enum NDAlbumListSort {
|
||||
ALBUM_ARTIST = 'album_artist',
|
||||
ARTIST = 'artist',
|
||||
DURATION = 'duration',
|
||||
EXPLICIT_STATUS = 'explicitStatus',
|
||||
NAME = 'name',
|
||||
PLAY_COUNT = 'play_count',
|
||||
PLAY_DATE = 'play_date',
|
||||
@@ -46,6 +47,7 @@ export enum NDSongListSort {
|
||||
CHANNELS = 'channels',
|
||||
COMMENT = 'comment',
|
||||
DURATION = 'duration',
|
||||
EXPLICIT_STATUS = 'explicitStatus',
|
||||
FAVORITED = 'starred_at',
|
||||
GENRE = 'genre',
|
||||
ID = 'id',
|
||||
|
||||
@@ -7,6 +7,7 @@ import { ssType } from '/@/shared/api/subsonic/subsonic-types';
|
||||
import {
|
||||
Album,
|
||||
AlbumArtist,
|
||||
ExplicitStatus,
|
||||
Genre,
|
||||
LibraryItem,
|
||||
Playlist,
|
||||
@@ -164,6 +165,12 @@ const normalizeSong = (
|
||||
discNumber: item.discNumber,
|
||||
discSubtitle: item.discSubtitle ? item.discSubtitle : null,
|
||||
duration: item.duration * 1000,
|
||||
explicitStatus:
|
||||
item.explicitStatus === 'e'
|
||||
? ExplicitStatus.EXPLICIT
|
||||
: item.explicitStatus === 'c'
|
||||
? ExplicitStatus.CLEAN
|
||||
: null,
|
||||
gain:
|
||||
item.rgAlbumGain || item.rgTrackGain
|
||||
? { album: item.rgAlbumGain, track: item.rgTrackGain }
|
||||
@@ -237,6 +244,12 @@ const normalizeAlbum = (
|
||||
comment: item.comment || null,
|
||||
createdAt: item.createdAt.split('T')[0],
|
||||
duration: item.duration !== undefined ? item.duration * 1000 : null,
|
||||
explicitStatus:
|
||||
item.explicitStatus === 'e'
|
||||
? ExplicitStatus.EXPLICIT
|
||||
: item.explicitStatus === 'c'
|
||||
? ExplicitStatus.CLEAN
|
||||
: null,
|
||||
genres: (item.genres || []).map((genre) => ({
|
||||
id: genre.id,
|
||||
imageUrl: null,
|
||||
|
||||
@@ -134,6 +134,7 @@ const album = z.object({
|
||||
coverArtPath: z.string().optional(), // Removed after v0.48.0
|
||||
createdAt: z.string(),
|
||||
duration: z.number().optional(),
|
||||
explicitStatus: z.string().optional(),
|
||||
fullText: z.string(),
|
||||
genre: z.string(),
|
||||
genres: z.array(genre).nullable(),
|
||||
@@ -200,6 +201,7 @@ const song = z.object({
|
||||
discSubtitle: z.string().optional(),
|
||||
duration: z.number(),
|
||||
embedArtPath: z.string().optional(),
|
||||
explicitStatus: z.string().optional(),
|
||||
externalInfoUpdatedAt: z.string().optional(),
|
||||
externalUrl: z.string().optional(),
|
||||
fullText: z.string(),
|
||||
|
||||
@@ -5,6 +5,7 @@ import { ssType } from '/@/shared/api/subsonic/subsonic-types';
|
||||
import {
|
||||
Album,
|
||||
AlbumArtist,
|
||||
ExplicitStatus,
|
||||
Genre,
|
||||
LibraryItem,
|
||||
Playlist,
|
||||
@@ -146,6 +147,12 @@ const normalizeSong = (
|
||||
discNumber: item.discNumber || 1,
|
||||
discSubtitle: null,
|
||||
duration: item.duration ? item.duration * 1000 : 0,
|
||||
explicitStatus:
|
||||
item.explicitStatus === 'explicit'
|
||||
? ExplicitStatus.EXPLICIT
|
||||
: item.explicitStatus === 'clean'
|
||||
? ExplicitStatus.CLEAN
|
||||
: null,
|
||||
gain:
|
||||
item.replayGain && (item.replayGain.albumGain || item.replayGain.trackGain)
|
||||
? {
|
||||
@@ -247,6 +254,12 @@ const normalizeAlbum = (
|
||||
comment: null,
|
||||
createdAt: item.created,
|
||||
duration: item.duration * 1000,
|
||||
explicitStatus:
|
||||
item.explicitStatus === 'explicit'
|
||||
? ExplicitStatus.EXPLICIT
|
||||
: item.explicitStatus === 'clean'
|
||||
? ExplicitStatus.CLEAN
|
||||
: null,
|
||||
genres: getGenres(item),
|
||||
id: item.id.toString(),
|
||||
imagePlaceholderUrl: null,
|
||||
|
||||
@@ -95,6 +95,7 @@ const song = z.object({
|
||||
created: z.string(),
|
||||
discNumber: z.number(),
|
||||
duration: z.number().optional(),
|
||||
explicitStatus: z.string().optional(),
|
||||
genre: z.string().optional(),
|
||||
genres: z.array(genreItem).optional(),
|
||||
id,
|
||||
@@ -125,6 +126,7 @@ const album = z.object({
|
||||
coverArt: z.string(),
|
||||
created: z.string(),
|
||||
duration: z.number(),
|
||||
explicitStatus: z.string().optional(),
|
||||
genre: z.string().optional(),
|
||||
genres: z.array(genreItem).optional(),
|
||||
id,
|
||||
|
||||
Reference in New Issue
Block a user