@nuclearplayer/plugin-sdk 2.4.1 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -2067,11 +2067,27 @@ export declare class YtdlpAPI {
2067
2067
  get available(): boolean;
2068
2068
  search(query: string, maxResults?: number): Promise<YtdlpSearchResult[]>;
2069
2069
  getStream(videoId: string): Promise<YtdlpStreamInfo>;
2070
+ getPlaylist(url: string): Promise<YtdlpPlaylistInfo>;
2070
2071
  }
2071
2072
 
2072
2073
  export declare type YtdlpHost = {
2073
2074
  search: (query: string, maxResults?: number) => Promise<YtdlpSearchResult[]>;
2074
2075
  getStream: (videoId: string) => Promise<YtdlpStreamInfo>;
2076
+ getPlaylist: (url: string) => Promise<YtdlpPlaylistInfo>;
2077
+ };
2078
+
2079
+ export declare type YtdlpPlaylistEntry = {
2080
+ id: string;
2081
+ title: string;
2082
+ duration: number | null;
2083
+ thumbnails: YtdlpThumbnail[];
2084
+ channel: string | null;
2085
+ };
2086
+
2087
+ export declare type YtdlpPlaylistInfo = {
2088
+ id: string;
2089
+ title: string;
2090
+ entries: YtdlpPlaylistEntry[];
2075
2091
  };
2076
2092
 
2077
2093
  export declare type YtdlpSearchResult = {
@@ -2085,6 +2101,14 @@ export declare type YtdlpStreamInfo = {
2085
2101
  stream_url: string;
2086
2102
  duration: number | null;
2087
2103
  title: string | null;
2104
+ container: string | null;
2105
+ codec: string | null;
2106
+ };
2107
+
2108
+ export declare type YtdlpThumbnail = {
2109
+ url: string;
2110
+ width: number | null;
2111
+ height: number | null;
2088
2112
  };
2089
2113
 
2090
2114
  export { }
package/dist/index.js CHANGED
@@ -447,6 +447,11 @@ class We {
447
447
  throw new Error("YtdlpAPI: No host configured");
448
448
  return this.host.getStream(e);
449
449
  }
450
+ async getPlaylist(e) {
451
+ if (!this.host)
452
+ throw new Error("YtdlpAPI: No host configured");
453
+ return this.host.getPlaylist(e);
454
+ }
450
455
  }
451
456
  class qe {
452
457
  Settings;
@@ -1034,7 +1039,7 @@ class v {
1034
1039
  return this.nullable().optional();
1035
1040
  }
1036
1041
  array() {
1037
- return A.create(this);
1042
+ return T.create(this);
1038
1043
  }
1039
1044
  promise() {
1040
1045
  return Y.create(this, this._def);
@@ -2028,7 +2033,7 @@ me.create = (r) => new me({
2028
2033
  typeName: p.ZodVoid,
2029
2034
  ...g(r)
2030
2035
  });
2031
- class A extends v {
2036
+ class T extends v {
2032
2037
  _parse(e) {
2033
2038
  const { ctx: t, status: s } = this._processInputParams(e), a = this._def;
2034
2039
  if (t.parsedType !== l.array)
@@ -2072,19 +2077,19 @@ class A extends v {
2072
2077
  return this._def.type;
2073
2078
  }
2074
2079
  min(e, t) {
2075
- return new A({
2080
+ return new T({
2076
2081
  ...this._def,
2077
2082
  minLength: { value: e, message: h.toString(t) }
2078
2083
  });
2079
2084
  }
2080
2085
  max(e, t) {
2081
- return new A({
2086
+ return new T({
2082
2087
  ...this._def,
2083
2088
  maxLength: { value: e, message: h.toString(t) }
2084
2089
  });
2085
2090
  }
2086
2091
  length(e, t) {
2087
- return new A({
2092
+ return new T({
2088
2093
  ...this._def,
2089
2094
  exactLength: { value: e, message: h.toString(t) }
2090
2095
  });
@@ -2093,7 +2098,7 @@ class A extends v {
2093
2098
  return this.min(1, e);
2094
2099
  }
2095
2100
  }
2096
- A.create = (r, e) => new A({
2101
+ T.create = (r, e) => new T({
2097
2102
  type: r,
2098
2103
  minLength: null,
2099
2104
  maxLength: null,
@@ -2112,7 +2117,7 @@ function $(r) {
2112
2117
  ...r._def,
2113
2118
  shape: () => e
2114
2119
  });
2115
- } else return r instanceof A ? new A({
2120
+ } else return r instanceof T ? new T({
2116
2121
  ...r._def,
2117
2122
  type: $(r.element)
2118
2123
  }) : r instanceof O ? O.create($(r.unwrap())) : r instanceof D ? D.create($(r.unwrap())) : r instanceof P ? P.create(r.items.map((e) => $(e))) : r;
@@ -2180,10 +2185,10 @@ class k extends v {
2180
2185
  return a.common.async ? Promise.resolve().then(async () => {
2181
2186
  const f = [];
2182
2187
  for (const y of u) {
2183
- const Z = await y.key, Ae = await y.value;
2188
+ const Z = await y.key, Te = await y.value;
2184
2189
  f.push({
2185
2190
  key: Z,
2186
- value: Ae,
2191
+ value: Te,
2187
2192
  alwaysSet: y.alwaysSet
2188
2193
  });
2189
2194
  }
@@ -3125,44 +3130,44 @@ var p;
3125
3130
  })(p || (p = {}));
3126
3131
  const b = N.create, j = V.create, we = K.create, bt = ee.create;
3127
3132
  E.create;
3128
- const C = A.create, T = k.create, kt = q.create;
3133
+ const C = T.create, A = k.create, kt = q.create;
3129
3134
  Q.create;
3130
3135
  P.create;
3131
3136
  const xt = L.create;
3132
3137
  Y.create;
3133
3138
  O.create;
3134
3139
  D.create;
3135
- const J = T({
3140
+ const J = A({
3136
3141
  provider: b(),
3137
3142
  id: b(),
3138
3143
  url: b().optional()
3139
- }), wt = T({
3144
+ }), wt = A({
3140
3145
  url: b(),
3141
3146
  width: j().optional(),
3142
3147
  height: j().optional(),
3143
3148
  purpose: xt(["avatar", "cover", "background", "thumbnail"]).optional(),
3144
3149
  source: J.optional()
3145
- }), Te = T({
3150
+ }), Ae = A({
3146
3151
  items: C(wt)
3147
- }), Tt = T({
3152
+ }), At = A({
3148
3153
  name: b(),
3149
3154
  roles: C(b()),
3150
3155
  source: J.optional()
3151
- }), At = T({
3156
+ }), Tt = A({
3152
3157
  title: b(),
3153
- artists: C(Tt),
3158
+ artists: C(At),
3154
3159
  durationMs: j().optional(),
3155
3160
  source: J
3156
- }).passthrough(), St = T({
3161
+ }).passthrough(), St = A({
3157
3162
  id: b(),
3158
- track: At,
3163
+ track: Tt,
3159
3164
  note: b().optional(),
3160
3165
  addedAtIso: b()
3161
- }), $t = 1, Ct = T({
3166
+ }), $t = 1, Ct = A({
3162
3167
  id: b(),
3163
3168
  name: b(),
3164
3169
  description: b().optional(),
3165
- artwork: Te.optional(),
3170
+ artwork: Ae.optional(),
3166
3171
  tags: C(b()).optional(),
3167
3172
  createdAtIso: b(),
3168
3173
  lastModifiedIso: b(),
@@ -3170,30 +3175,30 @@ const J = T({
3170
3175
  isReadOnly: we(),
3171
3176
  parentId: b().optional(),
3172
3177
  items: C(St)
3173
- }), Mt = T({
3178
+ }), Mt = A({
3174
3179
  version: j(),
3175
3180
  playlist: Ct
3176
- }), It = T({
3181
+ }), It = A({
3177
3182
  id: b(),
3178
3183
  name: b(),
3179
3184
  createdAtIso: b(),
3180
3185
  lastModifiedIso: b(),
3181
3186
  isReadOnly: we(),
3182
- artwork: Te.optional(),
3187
+ artwork: Ae.optional(),
3183
3188
  itemCount: j(),
3184
3189
  totalDurationMs: j(),
3185
3190
  thumbnails: C(b()).default([])
3186
- }), Vt = C(It), Nt = T({
3191
+ }), Vt = C(It), Nt = A({
3187
3192
  uuid: b().optional(),
3188
3193
  artist: b().optional(),
3189
3194
  name: b().optional(),
3190
3195
  album: b().optional(),
3191
3196
  thumbnail: b().optional(),
3192
3197
  duration: kt([j(), b().transform(Number)]).refine((r) => Number.isFinite(r), { message: "Invalid duration" }).optional()
3193
- }), Ot = T({
3198
+ }), Ot = A({
3194
3199
  name: b(),
3195
3200
  tracks: C(Nt)
3196
- }), Lt = T({
3201
+ }), Lt = A({
3197
3202
  playlists: C(bt())
3198
3203
  }).refine(
3199
3204
  (r) => r.playlists.some(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuclearplayer/plugin-sdk",
3
- "version": "2.4.1",
3
+ "version": "2.5.0",
4
4
  "description": "Plugin SDK for Nuclear music player",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",