Skip to content

Commit b1d296d

Browse files
feat: update with latest opensubsonic changes
Signed-off-by: Henry Gressmann <[email protected]>
1 parent 5dc61e6 commit b1d296d

File tree

4 files changed

+114
-35
lines changed

4 files changed

+114
-35
lines changed

bun.lock

Lines changed: 31 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
},
2929
"devDependencies": {
3030
"@biomejs/biome": "^1.9.4",
31-
"bun-types": "^1.2.4",
32-
"esbuild": "^0.25.0",
31+
"bun-types": "^1.2.9",
32+
"esbuild": "^0.25.2",
3333
"release-it": "^18.1.2"
3434
},
3535
"release-it": {
@@ -46,6 +46,6 @@
4646
"engineStrict": false,
4747
"trustedDependencies": ["@biomejs/biome", "esbuild"],
4848
"dependencies": {
49-
"typescript": "^5.8.2"
49+
"typescript": "^5.8.3"
5050
}
5151
}

src/index.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { md5 } from "./md5.js";
22
import { arrayBufferToBase64 } from "./utils.js";
33

44
// biome-ignore format:
5-
import type { AlbumInfo, AlbumList, AlbumList2, AlbumWithSongsID3, ArtistInfo, ArtistInfo2, ArtistWithAlbumsID3, ArtistsID3, Bookmarks, ChatMessages, Child, Directory, Genres, Indexes, InternetRadioStations, JukeboxPlaylist, JukeboxStatus, License, Lyrics, MusicFolders, NewestPodcasts, NowPlaying, OpenSubsonicExtensions, PlayQueue, Playlist, PlaylistWithSongs, Playlists, Podcasts, ScanStatus, SearchResult2, SearchResult3, Shares, SimilarSongs, SimilarSongs2, Songs, Starred, Starred2, StructuredLyrics, TopSongs, User, Users, VideoInfo, Videos } from "./types.js";
5+
import type { AlbumInfo, AlbumList, AlbumList2, AlbumWithSongsID3, ArtistInfo, ArtistInfo2, ArtistWithAlbumsID3, ArtistsID3, Bookmarks, ChatMessages, Child, Directory, Genres, Indexes, InternetRadioStations, JukeboxPlaylist, JukeboxStatus, License, Lyrics, MusicFolders, NewestPodcasts, NowPlaying, OpenSubsonicExtensions, PlayQueue, Playlist, PlaylistWithSongs, Playlists, PodcastEpisode, Podcasts, ScanStatus, SearchResult2, SearchResult3, Shares, SimilarSongs, SimilarSongs2, Songs, Starred, Starred2, StructuredLyrics, TopSongs, User, Users, VideoInfo, Videos } from "./types.js";
66
export * from "./types.js";
77

88
interface SubsonicConfig {
@@ -737,6 +737,20 @@ export default class SubsonicAPI {
737737
return this.#request("downloadPodcastEpisode", args);
738738
}
739739

740+
/**
741+
* Returns details for a podcast episode.
742+
* Only supported by OpenSubsonic compatible servers with the `getPodcastEpisode` extension.
743+
*
744+
* https://opensubsonic.netlify.app/docs/endpoints/getPodcastEpisode/
745+
*/
746+
async getPodcastEpisode(args: { id: string }) {
747+
return this.#requestJSON<
748+
SubsonicBaseResponse & {
749+
podcastEpisode: PodcastEpisode;
750+
}
751+
>("getPodcastEpisode", args);
752+
}
753+
740754
async jukeboxControl(args: {
741755
action:
742756
| "start"

src/types.ts

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,37 @@ export interface AlbumID3 {
1111
songCount: number;
1212
starred?: Date;
1313
year?: number;
14+
version?: string;
15+
played?: string;
16+
userRating?: number;
17+
recordLabels?: RecordLabel[];
18+
musicBrainzId?: string;
19+
genres?: string[];
20+
artists?: ArtistID3[];
21+
displayArtist?: string;
22+
releaseTypes?: string[];
23+
moods?: string[];
24+
sortName?: string;
25+
originalReleaseDate?: ItemDate;
26+
releaseDate?: ItemDate;
27+
isCompilation?: boolean;
28+
explicitStatus?: string;
29+
discTitles?: DiscTitle[];
30+
}
31+
32+
export interface DiscTitle {
33+
disc: number;
34+
title: string;
35+
}
36+
37+
export interface ItemDate {
38+
year?: number;
39+
month?: number;
40+
day?: number;
41+
}
42+
43+
export interface RecordLabel {
44+
name: string;
1445
}
1546

1647
export interface AlbumInfo {
@@ -50,6 +81,9 @@ export interface ArtistID3 {
5081
id: string;
5182
name: string;
5283
starred?: Date;
84+
musicBrainzId?: string;
85+
sortName?: string;
86+
roles?: string[];
5387
}
5488

5589
export interface ArtistInfo extends ArtistInfoBase {
@@ -146,6 +180,36 @@ export interface Child {
146180
type?: MediaType;
147181
userRating?: number;
148182
year?: number;
183+
played?: string;
184+
bpm?: number;
185+
comment?: string;
186+
sortName?: string;
187+
musicBrainzId?: string;
188+
genres?: string[];
189+
artists?: ArtistID3[];
190+
displayArtist?: string;
191+
albumArtists?: ArtistID3[];
192+
displayAlbumArtist?: string;
193+
contributors?: Contributor[];
194+
displayComposer?: string;
195+
moods?: string[];
196+
replayGain?: ReplayGain;
197+
explicitStatus?: string;
198+
}
199+
200+
export interface Contributor {
201+
role: string;
202+
subRole?: string;
203+
artist?: ArtistID3;
204+
}
205+
206+
export interface ReplayGain {
207+
trackGain: number;
208+
albumGain: number;
209+
trackPeak: number;
210+
albumPeak: number;
211+
baseGain: number;
212+
fallbackGain: number;
149213
}
150214

151215
export interface Directory {
@@ -162,6 +226,7 @@ export interface Directory {
162226
export interface Error {
163227
code: number;
164228
message?: string;
229+
helpUrl?: string;
165230
}
166231

167232
export interface Genre {

0 commit comments

Comments
 (0)