@ctrl/plex 1.5.3 → 2.0.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/README.md +3 -2
- package/dist/src/alert.d.ts +12 -0
- package/dist/src/alert.js +29 -0
- package/dist/src/alert.types.d.ts +59 -0
- package/dist/src/alert.types.js +1 -0
- package/dist/{base → src/base}/partialPlexObject.d.ts +18 -12
- package/dist/{base → src/base}/partialPlexObject.js +29 -23
- package/dist/{base → src/base}/playable.d.ts +2 -2
- package/dist/src/base/playable.js +8 -0
- package/dist/{base → src/base}/plexObject.d.ts +8 -1
- package/dist/{base → src/base}/plexObject.js +21 -18
- package/dist/{baseFunctionality.d.ts → src/baseFunctionality.d.ts} +17 -1
- package/dist/{baseFunctionality.js → src/baseFunctionality.js} +7 -15
- package/dist/{client.d.ts → src/client.d.ts} +2 -2
- package/dist/{client.js → src/client.js} +12 -20
- package/dist/src/client.types.js +1 -0
- package/dist/src/config.js +35 -0
- package/dist/src/exceptions.d.ts +20 -0
- package/dist/src/exceptions.js +40 -0
- package/dist/src/index.d.ts +12 -0
- package/dist/src/index.js +11 -0
- package/dist/{library.d.ts → src/library.d.ts} +207 -21
- package/dist/{library.js → src/library.js} +348 -132
- package/dist/{library.types.d.ts → src/library.types.d.ts} +59 -1
- package/dist/src/library.types.js +1 -0
- package/dist/{media.d.ts → src/media.d.ts} +16 -4
- package/dist/{media.js → src/media.js} +42 -49
- package/dist/src/media.types.d.ts +7 -0
- package/dist/src/media.types.js +1 -0
- package/dist/{myplex.d.ts → src/myplex.d.ts} +16 -6
- package/dist/{myplex.js → src/myplex.js} +71 -57
- package/dist/src/myplex.types.js +10 -0
- package/dist/src/playlist.d.ts +75 -0
- package/dist/src/playlist.js +142 -0
- package/dist/src/playlist.types.d.ts +17 -0
- package/dist/src/playlist.types.js +1 -0
- package/dist/{search.d.ts → src/search.d.ts} +4 -3
- package/dist/{search.js → src/search.js} +13 -19
- package/dist/src/search.types.js +1 -0
- package/dist/{server.d.ts → src/server.d.ts} +22 -10
- package/dist/{server.js → src/server.js} +65 -50
- package/dist/src/server.types.js +1 -0
- package/dist/src/settings.d.ts +79 -0
- package/dist/src/settings.js +160 -0
- package/dist/{util.d.ts → src/util.d.ts} +2 -1
- package/dist/{util.js → src/util.js} +8 -12
- package/dist/{video.d.ts → src/video.d.ts} +38 -60
- package/dist/{video.js → src/video.js} +109 -92
- package/dist/{video.types.d.ts → src/video.types.d.ts} +1 -1
- package/dist/src/video.types.js +6 -0
- package/package.json +46 -44
- package/dist/base/playable.js +0 -12
- package/dist/client.types.js +0 -2
- package/dist/config.js +0 -41
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -23
- package/dist/library.types.js +0 -2
- package/dist/myplex.types.js +0 -13
- package/dist/playlist.d.ts +0 -7
- package/dist/playlist.js +0 -19
- package/dist/search.types.js +0 -2
- package/dist/server.types.js +0 -2
- package/dist/video.types.js +0 -9
- /package/dist/{client.types.d.ts → src/client.types.d.ts} +0 -0
- /package/dist/{config.d.ts → src/config.d.ts} +0 -0
- /package/dist/{myplex.types.d.ts → src/myplex.types.d.ts} +0 -0
- /package/dist/{search.types.d.ts → src/search.types.d.ts} +0 -0
- /package/dist/{server.types.d.ts → src/server.types.d.ts} +0 -0
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class Video extends playable_1.Playable {
|
|
8
|
-
constructor(server, data, initpath, parent) {
|
|
9
|
-
super(server, data, initpath, parent);
|
|
10
|
-
this.server = server;
|
|
1
|
+
import { Playable } from './base/playable.js';
|
|
2
|
+
import { fetchItem, fetchItems, findItems } from './baseFunctionality.js';
|
|
3
|
+
import { Chapter, Collection, Country, Director, Genre, Guid, Marker, Media, Producer, Role, Similar, Writer, } from './media.js';
|
|
4
|
+
class Video extends Playable {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
11
7
|
/** Hardcoded as 'video' (useful for search filters). */
|
|
12
8
|
this.listType = 'video';
|
|
13
9
|
}
|
|
@@ -25,13 +21,11 @@ class Video extends playable_1.Playable {
|
|
|
25
21
|
* the most specific thumbnail for that item.
|
|
26
22
|
*/
|
|
27
23
|
get thumbUrl() {
|
|
28
|
-
|
|
29
|
-
const thumb = (_b = (_a = this.thumb) !== null && _a !== void 0 ? _a : this.parentThumb) !== null && _b !== void 0 ? _b : this.granparentThumb;
|
|
24
|
+
const thumb = this.thumb ?? this.parentThumb ?? this.granparentThumb;
|
|
30
25
|
return this.server.url(thumb, true);
|
|
31
26
|
}
|
|
32
27
|
get artUrl() {
|
|
33
|
-
|
|
34
|
-
const art = (_a = this.art) !== null && _a !== void 0 ? _a : this.grandparentArt;
|
|
28
|
+
const art = this.art ?? this.grandparentArt;
|
|
35
29
|
return this.server.url(art, true);
|
|
36
30
|
}
|
|
37
31
|
/**
|
|
@@ -55,30 +49,34 @@ class Video extends playable_1.Playable {
|
|
|
55
49
|
await this.server.query(key);
|
|
56
50
|
await this.reload();
|
|
57
51
|
}
|
|
52
|
+
async extras() {
|
|
53
|
+
const data = await this.server.query(this._detailsKey);
|
|
54
|
+
return findItems(data.MediaContainer.Metadata[0].Extras?.Metadata, undefined, Extra, this.server, this);
|
|
55
|
+
}
|
|
58
56
|
_loadData(data) {
|
|
59
|
-
var _a, _b;
|
|
60
|
-
this.addedAt = new Date(data.addedAt * 1000);
|
|
61
|
-
this.librarySectionID = data.librarySectionID;
|
|
62
|
-
this.lastViewedAt = data.lastViewedAt
|
|
63
|
-
? new Date(data.lastViewedAt * 1000)
|
|
64
|
-
: undefined;
|
|
65
|
-
this.updatedAt = data.lastViewedAt ? new Date(data.updatedAt * 1000) : undefined;
|
|
66
57
|
this.key = data.key;
|
|
67
58
|
this.ratingKey = data.ratingKey;
|
|
68
|
-
this.viewCount = (_a = data.viewCount) !== null && _a !== void 0 ? _a : 0;
|
|
69
59
|
this.title = data.title;
|
|
70
60
|
this.summary = data.summary;
|
|
71
61
|
this.thumb = data.thumb;
|
|
72
62
|
this.title = data.title;
|
|
73
|
-
this.titleSort = (_b = data.titleSort) !== null && _b !== void 0 ? _b : this.title;
|
|
74
63
|
this.type = data.type;
|
|
64
|
+
this.librarySectionID = data.librarySectionID;
|
|
65
|
+
this.addedAt = new Date(data.addedAt * 1000);
|
|
66
|
+
this.lastViewedAt = data.lastViewedAt
|
|
67
|
+
? new Date(data.lastViewedAt * 1000)
|
|
68
|
+
: undefined;
|
|
69
|
+
this.updatedAt = data.lastViewedAt ? new Date(data.updatedAt * 1000) : undefined;
|
|
70
|
+
this.viewCount = data.viewCount ?? 0;
|
|
71
|
+
this.titleSort = data.titleSort ?? this.title;
|
|
75
72
|
this.viewCount = data.viewCount;
|
|
73
|
+
this.playlistItemID = data.playlistItemID;
|
|
76
74
|
}
|
|
77
75
|
}
|
|
78
76
|
/**
|
|
79
77
|
* Represents a single Movie.
|
|
80
78
|
*/
|
|
81
|
-
class Movie extends Video {
|
|
79
|
+
export class Movie extends Video {
|
|
82
80
|
constructor() {
|
|
83
81
|
super(...arguments);
|
|
84
82
|
this.TAG = 'Video';
|
|
@@ -89,15 +87,31 @@ class Movie extends Video {
|
|
|
89
87
|
return this.roles;
|
|
90
88
|
}
|
|
91
89
|
async locations() {
|
|
92
|
-
var _a, _b;
|
|
93
90
|
if (!this.isFullObject) {
|
|
94
91
|
await this.reload();
|
|
95
92
|
}
|
|
96
|
-
const parts = (
|
|
93
|
+
const parts = (this.media?.map(media => media.parts) ?? []).flat();
|
|
97
94
|
return parts.map(part => part.file);
|
|
98
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Returns True if this movie has an intro marker
|
|
98
|
+
*/
|
|
99
|
+
async hasIntroMarker() {
|
|
100
|
+
if (!this.isFullObject) {
|
|
101
|
+
await this.reload();
|
|
102
|
+
}
|
|
103
|
+
return this.markers.some(marker => marker.type === 'intro');
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Returns True if this movie has a credits marker
|
|
107
|
+
*/
|
|
108
|
+
async hasCreditsMarker() {
|
|
109
|
+
if (!this.isFullObject) {
|
|
110
|
+
await this.reload();
|
|
111
|
+
}
|
|
112
|
+
return this.markers.some(marker => marker.type === 'credits');
|
|
113
|
+
}
|
|
99
114
|
_loadData(data) {
|
|
100
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
101
115
|
super._loadData(data);
|
|
102
116
|
this.art = data.art;
|
|
103
117
|
this.audienceRating = data.audienceRating;
|
|
@@ -107,45 +121,42 @@ class Movie extends Video {
|
|
|
107
121
|
this.duration = data.duration;
|
|
108
122
|
this.guid = data.guid;
|
|
109
123
|
this.originalTitle = data.originalTitle;
|
|
110
|
-
this.originallyAvailableAt =
|
|
124
|
+
this.originallyAvailableAt = data.originallyAvailableAt;
|
|
111
125
|
this.primaryExtraKey = data.primaryExtraKey;
|
|
112
126
|
this.rating = data.rating;
|
|
113
127
|
this.ratingImage = data.ratingImage;
|
|
114
128
|
this.studio = data.studio;
|
|
115
129
|
this.tagline = data.tagline;
|
|
116
130
|
this.userRating = data.userRating;
|
|
117
|
-
this.viewOffset =
|
|
131
|
+
this.viewOffset = data.viewOffset ?? 0;
|
|
118
132
|
this.year = data.year;
|
|
119
133
|
this.librarySectionID = data.librarySectionID;
|
|
120
|
-
this.directors =
|
|
121
|
-
|
|
122
|
-
this.
|
|
123
|
-
(_e = (_d = data.Country) === null || _d === void 0 ? void 0 : _d.map(data => new media_1.Country(this.server, data, undefined, this))) !== null && _e !== void 0 ? _e : [];
|
|
124
|
-
this.writers = (_g = (_f = data.Writer) === null || _f === void 0 ? void 0 : _f.map(data => new media_1.Writer(this.server, data, undefined, this))) !== null && _g !== void 0 ? _g : [];
|
|
134
|
+
this.directors = data.Director?.map(d => new Director(this.server, d, undefined, this)) ?? [];
|
|
135
|
+
this.countries = data.Country?.map(d => new Country(this.server, d, undefined, this)) ?? [];
|
|
136
|
+
this.writers = data.Writer?.map(d => new Writer(this.server, d, undefined, this)) ?? [];
|
|
125
137
|
this.collections =
|
|
126
|
-
|
|
127
|
-
this.roles =
|
|
128
|
-
this.similar =
|
|
129
|
-
this.genres =
|
|
130
|
-
this.producers =
|
|
131
|
-
|
|
132
|
-
this.
|
|
138
|
+
data.Collection?.map(d => new Collection(this.server, d, undefined, this)) ?? [];
|
|
139
|
+
this.roles = data.Role?.map(d => new Role(this.server, d, undefined, this)) ?? [];
|
|
140
|
+
this.similar = data.Similar?.map(d => new Similar(this.server, d, undefined, this)) ?? [];
|
|
141
|
+
this.genres = data.Genre?.map(d => new Genre(this.server, d, undefined, this)) ?? [];
|
|
142
|
+
this.producers = data.Producer?.map(d => new Producer(this.server, d, undefined, this)) ?? [];
|
|
143
|
+
this.media = data.Media?.map(d => new Media(this.server, d, undefined, this)) ?? [];
|
|
144
|
+
this.guids = data.Guid?.map(d => new Guid(this.server, d, undefined, this)) ?? [];
|
|
145
|
+
this.markers = data.Marker?.map(d => new Marker(this.server, d, undefined, this)) ?? [];
|
|
133
146
|
}
|
|
134
147
|
_loadFullData(data) {
|
|
135
|
-
var _a, _b, _c;
|
|
136
148
|
const metadata = data.Metadata[0];
|
|
137
149
|
this._loadData(metadata);
|
|
138
150
|
this.librarySectionID = metadata.librarySectionID;
|
|
139
|
-
this.chapters =
|
|
151
|
+
this.chapters = metadata.Chapter?.map(chapter => new Chapter(this.server, chapter));
|
|
140
152
|
this.collections =
|
|
141
|
-
|
|
153
|
+
metadata.Collection?.map(collection => new Collection(this.server, collection, undefined, this)) ?? [];
|
|
142
154
|
}
|
|
143
155
|
}
|
|
144
|
-
exports.Movie = Movie;
|
|
145
156
|
/**
|
|
146
157
|
* Represents a single Show (including all seasons and episodes).
|
|
147
158
|
*/
|
|
148
|
-
class Show extends Video {
|
|
159
|
+
export class Show extends Video {
|
|
149
160
|
constructor() {
|
|
150
161
|
super(...arguments);
|
|
151
162
|
this.TAG = 'Directory';
|
|
@@ -176,17 +187,16 @@ class Show extends Video {
|
|
|
176
187
|
// }
|
|
177
188
|
async seasons(query) {
|
|
178
189
|
const key = `/library/metadata/${this.ratingKey}/children?excludeAllLeaves=1`;
|
|
179
|
-
return
|
|
190
|
+
return fetchItems(this.server, key, query, Season, this);
|
|
180
191
|
}
|
|
181
192
|
async episodes(query) {
|
|
182
193
|
const key = `/library/metadata/${this.ratingKey}/allLeaves`;
|
|
183
|
-
const episodes = await
|
|
194
|
+
const episodes = await fetchItems(this.server, key, query);
|
|
184
195
|
return episodes.map(episode => new Episode(this.server, episode, key, this));
|
|
185
196
|
}
|
|
186
197
|
_loadData(data) {
|
|
187
|
-
var _a, _b, _c, _d, _e;
|
|
188
198
|
super._loadData(data);
|
|
189
|
-
this.key = (
|
|
199
|
+
this.key = (data.key ?? '').replace('/children', '');
|
|
190
200
|
this.art = data.art;
|
|
191
201
|
this.banner = data.banner;
|
|
192
202
|
this.childCount = data.childCount;
|
|
@@ -202,18 +212,17 @@ class Show extends Video {
|
|
|
202
212
|
this.theme = data.theme;
|
|
203
213
|
this.viewedLeafCount = data.viewedLeafCount;
|
|
204
214
|
this.year = data.year;
|
|
205
|
-
this.genres =
|
|
206
|
-
this.roles =
|
|
215
|
+
this.genres = data.Genre?.map(genre => new Genre(this.server, genre)) ?? [];
|
|
216
|
+
this.roles = data.Role?.map(role => new Role(this.server, role)) ?? [];
|
|
207
217
|
}
|
|
208
218
|
_loadFullData(data) {
|
|
209
219
|
this._loadData(data.Metadata[0]);
|
|
210
220
|
}
|
|
211
221
|
}
|
|
212
|
-
exports.Show = Show;
|
|
213
222
|
/**
|
|
214
223
|
* Represents a single Show Season (including all episodes).
|
|
215
224
|
*/
|
|
216
|
-
class Season extends Video {
|
|
225
|
+
export class Season extends Video {
|
|
217
226
|
constructor() {
|
|
218
227
|
super(...arguments);
|
|
219
228
|
this.TAG = 'Directory';
|
|
@@ -233,7 +242,7 @@ class Season extends Video {
|
|
|
233
242
|
*/
|
|
234
243
|
async episodes(query) {
|
|
235
244
|
const key = `/library/metadata/${this.ratingKey}/children`;
|
|
236
|
-
const episodes = await
|
|
245
|
+
const episodes = await fetchItems(this.server, key, query);
|
|
237
246
|
return episodes.map(episode => new Episode(this.server, episode, key, this));
|
|
238
247
|
}
|
|
239
248
|
_loadData(data) {
|
|
@@ -247,34 +256,13 @@ class Season extends Video {
|
|
|
247
256
|
this._loadData(data);
|
|
248
257
|
}
|
|
249
258
|
}
|
|
250
|
-
|
|
251
|
-
class Episode extends Video {
|
|
259
|
+
export class Episode extends Video {
|
|
252
260
|
constructor() {
|
|
253
261
|
super(...arguments);
|
|
254
262
|
this.TYPE = 'episode';
|
|
255
263
|
this.METADATA_TYPE = 'episode';
|
|
256
|
-
this._INCLUDES = {
|
|
257
|
-
checkFiles: 1,
|
|
258
|
-
includeAllConcerts: 1,
|
|
259
|
-
includeBandwidths: 1,
|
|
260
|
-
includeChapters: 1,
|
|
261
|
-
includeChildren: 1,
|
|
262
|
-
includeConcerts: 1,
|
|
263
|
-
includeExternalMedia: 1,
|
|
264
|
-
includeExtras: 1,
|
|
265
|
-
includeFields: 'thumbBlurHash,artBlurHash',
|
|
266
|
-
includeGeolocation: 1,
|
|
267
|
-
includeLoudnessRamps: 1,
|
|
268
|
-
includeMarkers: 1,
|
|
269
|
-
includeOnDeck: 1,
|
|
270
|
-
includePopularLeaves: 1,
|
|
271
|
-
includePreferences: 1,
|
|
272
|
-
includeRelated: 1,
|
|
273
|
-
includeRelatedCount: 1,
|
|
274
|
-
includeReviews: 1,
|
|
275
|
-
includeStations: 1,
|
|
276
|
-
};
|
|
277
264
|
}
|
|
265
|
+
static { this.TAG = 'Video'; }
|
|
278
266
|
/**
|
|
279
267
|
* Returns this episodes season number.
|
|
280
268
|
*/
|
|
@@ -291,16 +279,15 @@ class Episode extends Video {
|
|
|
291
279
|
return `s${seasonNumber}e${episodeNumber}`;
|
|
292
280
|
}
|
|
293
281
|
async season() {
|
|
294
|
-
const data = await
|
|
282
|
+
const data = await fetchItem(this.server, this.parentKey);
|
|
295
283
|
return new Season(this.server, data, this.parentKey, this);
|
|
296
284
|
}
|
|
297
285
|
async show() {
|
|
298
|
-
const data = await
|
|
286
|
+
const data = await fetchItem(this.server, this.grandparentKey);
|
|
299
287
|
return new Show(this.server, data, this.grandparentKey, this);
|
|
300
288
|
}
|
|
301
289
|
locations() {
|
|
302
|
-
|
|
303
|
-
const parts = ((_b = (_a = this.media) === null || _a === void 0 ? void 0 : _a.map(media => media.parts)) !== null && _b !== void 0 ? _b : []).flat();
|
|
290
|
+
const parts = (this.media?.map(media => media.parts) ?? []).flat();
|
|
304
291
|
return parts.map(part => part.file);
|
|
305
292
|
}
|
|
306
293
|
/**
|
|
@@ -312,8 +299,16 @@ class Episode extends Video {
|
|
|
312
299
|
}
|
|
313
300
|
return this.markers.some(marker => marker.type === 'intro');
|
|
314
301
|
}
|
|
302
|
+
/**
|
|
303
|
+
* Returns True if this episode has a credits marker
|
|
304
|
+
*/
|
|
305
|
+
async hasCreditsMarker() {
|
|
306
|
+
if (!this.isFullObject) {
|
|
307
|
+
await this.reload();
|
|
308
|
+
}
|
|
309
|
+
return this.markers.some(marker => marker.type === 'credits');
|
|
310
|
+
}
|
|
315
311
|
_loadData(data) {
|
|
316
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
317
312
|
super._loadData(data);
|
|
318
313
|
this.key = (data.key || '').replace('/children', '');
|
|
319
314
|
this.title = data.title;
|
|
@@ -339,18 +334,40 @@ class Episode extends Video {
|
|
|
339
334
|
this.rating = data.rating;
|
|
340
335
|
this.viewOffset = data.viewOffset;
|
|
341
336
|
this.year = data.year;
|
|
342
|
-
this.directors =
|
|
343
|
-
|
|
344
|
-
this.
|
|
345
|
-
this.media = (_e = data.Media) === null || _e === void 0 ? void 0 : _e.map(data => new media_1.Media(this.server, data, undefined, this));
|
|
337
|
+
this.directors = data.Director?.map(d => new Director(this.server, d, undefined, this)) ?? [];
|
|
338
|
+
this.writers = data.Writer?.map(d => new Writer(this.server, d, undefined, this)) ?? [];
|
|
339
|
+
this.media = data.Media?.map(d => new Media(this.server, d, undefined, this));
|
|
346
340
|
this.collections =
|
|
347
|
-
|
|
348
|
-
this.chapters =
|
|
349
|
-
|
|
350
|
-
|
|
341
|
+
data.Collection?.map(d => new Collection(this.server, d, undefined, this)) ?? [];
|
|
342
|
+
this.chapters = data.Chapter?.map(d => new Chapter(this.server, d, undefined, this)) ?? [];
|
|
343
|
+
this.markers = data.Marker?.map(d => new Marker(this.server, d, undefined, this)) ?? [];
|
|
344
|
+
}
|
|
345
|
+
_loadFullData(data) {
|
|
346
|
+
this._loadData(data.Metadata[0]);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
export class Clip extends Video {
|
|
350
|
+
constructor() {
|
|
351
|
+
super(...arguments);
|
|
352
|
+
this.TYPE = 'clip';
|
|
353
|
+
this.METADATA_TYPE = 'clip';
|
|
354
|
+
}
|
|
355
|
+
static { this.TAG = 'Video'; }
|
|
356
|
+
_loadData(data) {
|
|
357
|
+
super._loadData(data);
|
|
358
|
+
}
|
|
359
|
+
_loadFullData(data) {
|
|
360
|
+
this._loadData(data.Metadata[0]);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Represents a single Extra (trailer, behindTheScenes, etc).
|
|
365
|
+
*/
|
|
366
|
+
export class Extra extends Clip {
|
|
367
|
+
_loadData(data) {
|
|
368
|
+
super._loadData(data);
|
|
351
369
|
}
|
|
352
370
|
_loadFullData(data) {
|
|
353
371
|
this._loadData(data.Metadata[0]);
|
|
354
372
|
}
|
|
355
373
|
}
|
|
356
|
-
Episode.TAG = 'Video';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ctrl/plex",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "plex api client in typescript",
|
|
5
5
|
"author": "Scott Cooper <scttcper@gmail.com>",
|
|
6
6
|
"publishConfig": {
|
|
@@ -8,10 +8,11 @@
|
|
|
8
8
|
},
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": "scttcper/plex",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
11
|
+
"type": "module",
|
|
12
|
+
"main": "./dist/src/index.js",
|
|
13
|
+
"typings": "./dist/src/index.d.ts",
|
|
13
14
|
"files": [
|
|
14
|
-
"dist"
|
|
15
|
+
"dist/src"
|
|
15
16
|
],
|
|
16
17
|
"sideEffects": false,
|
|
17
18
|
"keywords": [
|
|
@@ -19,56 +20,57 @@
|
|
|
19
20
|
"typescript"
|
|
20
21
|
],
|
|
21
22
|
"scripts": {
|
|
22
|
-
"lint": "eslint --ext .
|
|
23
|
-
"lint:fix": "eslint --fix --ext .
|
|
23
|
+
"lint": "eslint --ext .ts .",
|
|
24
|
+
"lint:fix": "eslint --fix --ext .ts .",
|
|
24
25
|
"prepare": "npm run build",
|
|
25
|
-
"build": "tsc
|
|
26
|
+
"build": "tsc",
|
|
26
27
|
"build:docs": "typedoc",
|
|
27
|
-
"test": "
|
|
28
|
-
"test:ci": "
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
28
|
+
"test": "vitest run",
|
|
29
|
+
"test:ci": "vitest run --coverage --reporter=default --reporter=junit --outputFile=./junit.xml",
|
|
30
|
+
"bootstraptest": "node --loader ts-node/esm scripts/bootstraptest.ts",
|
|
31
|
+
"teardowntest": "node --loader ts-node/esm scripts/teardowntest.ts",
|
|
32
|
+
"claim-server": "node --loader ts-node/esm scripts/claim-server.ts",
|
|
33
|
+
"add-media": "node --loader ts-node/esm scripts/add-media.ts",
|
|
34
|
+
"test-cleanup": "node --loader ts-node/esm scripts/test-cleanup.ts"
|
|
32
35
|
},
|
|
33
36
|
"dependencies": {
|
|
34
|
-
"@ctrl/mac-address": "^
|
|
35
|
-
"got": "^
|
|
36
|
-
"p-any": "^
|
|
37
|
-
"type-fest": "^
|
|
38
|
-
"
|
|
37
|
+
"@ctrl/mac-address": "^3.0.3",
|
|
38
|
+
"got": "^13.0.0",
|
|
39
|
+
"p-any": "^4.0.0",
|
|
40
|
+
"type-fest": "^4.15.0",
|
|
41
|
+
"ws": "^8.16.0",
|
|
42
|
+
"xml2js": "^0.6.2"
|
|
39
43
|
},
|
|
40
44
|
"devDependencies": {
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
43
|
-
"@
|
|
44
|
-
"@types/
|
|
45
|
-
"@types/node": "
|
|
46
|
-
"@types/
|
|
47
|
-
"@types/xml2js": "0.4.
|
|
48
|
-
"@
|
|
49
|
-
"
|
|
50
|
-
"
|
|
45
|
+
"@ctrl/eslint-config": "4.0.14",
|
|
46
|
+
"@sindresorhus/tsconfig": "5.0.0",
|
|
47
|
+
"@types/lodash": "4.17.0",
|
|
48
|
+
"@types/micromatch": "4.0.7",
|
|
49
|
+
"@types/node": "20.12.7",
|
|
50
|
+
"@types/ws": "8.5.10",
|
|
51
|
+
"@types/xml2js": "0.4.14",
|
|
52
|
+
"@types/yargs": "17.0.32",
|
|
53
|
+
"@vitest/coverage-v8": "^1.5.0",
|
|
54
|
+
"delay": "6.0.0",
|
|
55
|
+
"execa": "8.0.1",
|
|
56
|
+
"glob": "10.3.12",
|
|
57
|
+
"globby": "14.0.1",
|
|
51
58
|
"lodash": "4.17.21",
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
"babel": {
|
|
61
|
-
"presets": [
|
|
62
|
-
"@babel/preset-typescript"
|
|
63
|
-
],
|
|
64
|
-
"plugins": [
|
|
65
|
-
"@babel/plugin-transform-modules-commonjs"
|
|
66
|
-
]
|
|
59
|
+
"make-dir": "4.0.0",
|
|
60
|
+
"ora": "8.0.1",
|
|
61
|
+
"p-retry": "6.2.0",
|
|
62
|
+
"ts-node": "10.9.2",
|
|
63
|
+
"typedoc": "0.25.13",
|
|
64
|
+
"typescript": "5.4.5",
|
|
65
|
+
"vitest": "1.5.0",
|
|
66
|
+
"yargs": "17.7.2"
|
|
67
67
|
},
|
|
68
68
|
"release": {
|
|
69
|
-
"
|
|
69
|
+
"branches": [
|
|
70
|
+
"master"
|
|
71
|
+
]
|
|
70
72
|
},
|
|
71
73
|
"engines": {
|
|
72
|
-
"node": ">=10"
|
|
74
|
+
"node": ">=16.10"
|
|
73
75
|
}
|
|
74
76
|
}
|
package/dist/base/playable.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Playable = void 0;
|
|
4
|
-
const partialPlexObject_1 = require("./partialPlexObject");
|
|
5
|
-
/**
|
|
6
|
-
* This is a general place to store functions specific to media that is Playable.
|
|
7
|
-
* Things were getting mixed up a bit when dealing with Shows, Season, Artists,
|
|
8
|
-
* Albums which are all not playable.
|
|
9
|
-
*/
|
|
10
|
-
class Playable extends partialPlexObject_1.PartialPlexObject {
|
|
11
|
-
}
|
|
12
|
-
exports.Playable = Playable;
|
package/dist/client.types.js
DELETED
package/dist/config.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.BASE_HEADERS = exports.X_PLEX_IDENTIFIER = exports.X_PLEX_DEVICE_NAME = exports.X_PLEX_DEVICE = exports.X_PLEX_VERSION = exports.X_PLEX_PRODUCT = exports.X_PLEX_PLATFORM_VERSION = exports.X_PLEX_PLATFORM = exports.X_PLEX_PROVIDES = exports.X_PLEX_ENABLE_FAST_CONNECT = exports.X_PLEX_CONTAINER_SIZE = exports.TIMEOUT = exports.VERSION = exports.PROJECT = void 0;
|
|
7
|
-
const os_1 = __importDefault(require("os"));
|
|
8
|
-
const mac_address_1 = require("@ctrl/mac-address");
|
|
9
|
-
// TODO: Load User Defined Config
|
|
10
|
-
// const DEFAULT_CONFIG_PATH = os.path.expanduser('~/.config/plexapi/config.ini');
|
|
11
|
-
// const CONFIG_PATH = os.environ.get('PLEXAPI_CONFIG_PATH', DEFAULT_CONFIG_PATH);
|
|
12
|
-
// const CONFIG = PlexConfig(CONFIG_PATH);
|
|
13
|
-
// PlexAPI Settings
|
|
14
|
-
exports.PROJECT = 'PlexAPI';
|
|
15
|
-
exports.VERSION = '3.3.0';
|
|
16
|
-
exports.TIMEOUT = 30000;
|
|
17
|
-
exports.X_PLEX_CONTAINER_SIZE = 100;
|
|
18
|
-
exports.X_PLEX_ENABLE_FAST_CONNECT = false;
|
|
19
|
-
// Plex Header Configuation
|
|
20
|
-
exports.X_PLEX_PROVIDES = 'controller';
|
|
21
|
-
exports.X_PLEX_PLATFORM = os_1.default.type();
|
|
22
|
-
exports.X_PLEX_PLATFORM_VERSION = os_1.default.release();
|
|
23
|
-
exports.X_PLEX_PRODUCT = exports.PROJECT;
|
|
24
|
-
exports.X_PLEX_VERSION = exports.VERSION;
|
|
25
|
-
exports.X_PLEX_DEVICE = exports.X_PLEX_PLATFORM;
|
|
26
|
-
exports.X_PLEX_DEVICE_NAME = os_1.default.hostname();
|
|
27
|
-
const mac = mac_address_1.getMAC();
|
|
28
|
-
const base16Mac = mac_address_1.parseMAC(mac).toLong().toString(16);
|
|
29
|
-
exports.X_PLEX_IDENTIFIER = `0x${base16Mac}`;
|
|
30
|
-
exports.BASE_HEADERS = {
|
|
31
|
-
'X-Plex-Platform': exports.X_PLEX_PLATFORM,
|
|
32
|
-
'X-Plex-Platform-Version': exports.X_PLEX_PLATFORM_VERSION,
|
|
33
|
-
'X-Plex-Provides': exports.X_PLEX_PROVIDES,
|
|
34
|
-
'X-Plex-Product': exports.X_PLEX_PRODUCT,
|
|
35
|
-
'X-Plex-Version': exports.X_PLEX_VERSION,
|
|
36
|
-
'X-Plex-Device': exports.X_PLEX_DEVICE,
|
|
37
|
-
'X-Plex-Device-Name': exports.X_PLEX_DEVICE_NAME,
|
|
38
|
-
'X-Plex-Client-Identifier': exports.X_PLEX_IDENTIFIER,
|
|
39
|
-
'X-Plex-Sync-Version': '2',
|
|
40
|
-
'X-Plex-Language': 'en',
|
|
41
|
-
};
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.Agent = exports.SearchResult = void 0;
|
|
14
|
-
__exportStar(require("./client"), exports);
|
|
15
|
-
__exportStar(require("./server"), exports);
|
|
16
|
-
__exportStar(require("./myplex"), exports);
|
|
17
|
-
__exportStar(require("./library"), exports);
|
|
18
|
-
__exportStar(require("./video"), exports);
|
|
19
|
-
__exportStar(require("./media"), exports);
|
|
20
|
-
__exportStar(require("./playlist"), exports);
|
|
21
|
-
var search_1 = require("./search");
|
|
22
|
-
Object.defineProperty(exports, "SearchResult", { enumerable: true, get: function () { return search_1.SearchResult; } });
|
|
23
|
-
Object.defineProperty(exports, "Agent", { enumerable: true, get: function () { return search_1.Agent; } });
|
package/dist/library.types.js
DELETED
package/dist/myplex.types.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Protocol = exports.Status = void 0;
|
|
4
|
-
var Status;
|
|
5
|
-
(function (Status) {
|
|
6
|
-
Status["Online"] = "online";
|
|
7
|
-
Status["Offline"] = "offline";
|
|
8
|
-
})(Status = exports.Status || (exports.Status = {}));
|
|
9
|
-
var Protocol;
|
|
10
|
-
(function (Protocol) {
|
|
11
|
-
Protocol["HTTP"] = "http";
|
|
12
|
-
Protocol["HTTPS"] = "https";
|
|
13
|
-
})(Protocol = exports.Protocol || (exports.Protocol = {}));
|
package/dist/playlist.d.ts
DELETED
package/dist/playlist.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Playlist = void 0;
|
|
4
|
-
const playable_1 = require("./base/playable");
|
|
5
|
-
class Playlist extends playable_1.Playable {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.TYPE = 'playlist';
|
|
9
|
-
}
|
|
10
|
-
_loadData(data) {
|
|
11
|
-
// console.log(JSON.stringify(data));
|
|
12
|
-
// TODO
|
|
13
|
-
}
|
|
14
|
-
_loadFullData(data) {
|
|
15
|
-
this._loadData(data);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.Playlist = Playlist;
|
|
19
|
-
Playlist.TAG = 'Playlist';
|
package/dist/search.types.js
DELETED
package/dist/server.types.js
DELETED