forked from BrenekH/go-plex-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.go
847 lines (793 loc) · 33.1 KB
/
models.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
package plex
import (
"encoding/json"
"encoding/xml"
"net/http"
"time"
)
// Plex contains fields that are required to make
// an api call to your plex server
type Plex struct {
URL string
Token string
ClientIdentifier string
Headers headers
HTTPClient http.Client
}
// SearchResults a list of media returned when searching
// for media via your plex server
// Provider ...
type Provider struct {
Key string `json:"key"`
Title string `json:"title"`
Type string `json:"type"`
}
// SearchMediaContainer ...
type SearchMediaContainer struct {
MediaContainer
Provider []Provider
}
// SearchResults ...
type SearchResults struct {
MediaContainer SearchMediaContainer `json:"MediaContainer"`
}
// Metadata ...
type Metadata struct {
Player Player `json:"Player"`
Session Session `json:"Session"`
User User `json:"User"`
AddedAt int `json:"addedAt"`
Art string `json:"art"`
ContentRating string `json:"contentRating"`
Duration int `json:"duration"`
GrandparentArt string `json:"grandparentArt"`
GrandparentKey string `json:"grandparentKey"`
GrandparentRatingKey string `json:"grandparentRatingKey"`
GrandparentTheme string `json:"grandparentTheme"`
GrandparentThumb string `json:"grandparentThumb"`
GrandparentTitle string `json:"grandparentTitle"`
GUID string `json:"guid"`
AltGUIDs []AltGUID `json:"Guid"`
Index int64 `json:"index"`
Key string `json:"key"`
LastViewedAt int `json:"lastViewedAt"`
LibrarySectionID int `json:"librarySectionID"`
LibrarySectionKey string `json:"librarySectionKey"`
LibrarySectionTitle string `json:"librarySectionTitle"`
OriginallyAvailableAt string `json:"originallyAvailableAt"`
ParentIndex int64 `json:"parentIndex"`
ParentKey string `json:"parentKey"`
ParentRatingKey string `json:"parentRatingKey"`
ParentThumb string `json:"parentThumb"`
ParentTitle string `json:"parentTitle"`
RatingCount string `json:"ratingCount"`
Rating float64 `json:"rating"`
RatingKey string `json:"ratingKey"`
SessionKey string `json:"sessionKey"`
Summary string `json:"summary"`
Thumb string `json:"thumb"`
Media []Media `json:"Media"`
Title string `json:"title"`
TitleSort string `json:"titleSort"`
Type string `json:"type"`
UpdatedAt int `json:"updatedAt"`
ViewCount json.Number `json:"viewCount"`
ViewOffset int `json:"viewOffset"`
Year int `json:"year"`
Director []TaggedData `json:"Director"`
Writer []TaggedData `json:"Writer"`
}
// AltGUID represents a Globally Unique Identifier for a metadata provider that is not actively being used.
type AltGUID struct {
ID string `json:"id"`
}
// MetadataV1 ...
type MetadataV1 struct {
Metadata
Index int64 `json:"index,string"`
ParentIndex int64 `json:"parentIndex,string"`
AddedAt string `json:"addedAt"`
Duration string `json:"duration"`
LastViewedAt string `json:"lastViewedAt"`
LibrarySectionID string `json:"librarySectionID"`
Media []MediaV1 `json:"Media"`
Rating string `json:"rating"`
UpdatedAt string `json:"updatedAt"`
ViewOffset string `json:"viewOffset"`
Year string `json:"year"`
}
// Media media info
type Media struct {
AspectRatio float32 `json:"aspectRatio"`
AudioChannels int `json:"audioChannels"`
AudioCodec string `json:"audioCodec"`
AudioProfile string `json:"audioProfile"`
Bitrate int `json:"bitrate"`
Container string `json:"container"`
Duration int `json:"duration"`
Has64bitOffsets bool `json:"has64bitOffsets"`
Height int `json:"height"`
ID int `json:"id"`
OptimizedForStreaming int `json:"optimizedForStreaming"`
Selected bool `json:"selected"`
VideoCodec string `json:"videoCodec"`
VideoFrameRate string `json:"videoFrameRate"`
VideoProfile string `json:"videoProfile"`
VideoResolution string `json:"videoResolution"`
Width int `json:"width"`
Part []Part `json:"Part"`
}
// MediaV1 media information version 1
type MediaV1 struct {
Media
Part []PartV1 `json:"Part"`
AudioChannels float32 `json:"audioChannels,string"`
AspectRatio float32 `json:"aspectRatio,string"`
Bitrate int `json:"bitrate,string"`
Duration int `json:"duration,string"`
Has64bitOffsets string `json:"has64bitOffsets"`
Height int `json:"height,string"`
ID int `json:"id,string"`
OptimizedForStreaming int `json:"optimizedForStreaming,string"`
Width int `json:"width,string"`
}
// MediaContainer contains media info
type MediaContainer struct {
Metadata []Metadata `json:"Metadata"`
AllowSync bool `json:"allowSync"`
Identifier string `json:"identifier"`
LibrarySectionID int `json:"librarySectionID"`
LibrarySectionTitle string `json:"librarySectionTitle"`
LibrarySectionUUID string `json:"librarySectionUUID"`
MediaTagPrefix string `json:"mediaTagPrefix"`
MediaTagVersion int `json:"mediaTagVersion"`
Size int `json:"size"`
}
// MediaMetadata ...
type MediaMetadata struct {
MediaContainer MediaContainer `json:"MediaContainer"`
}
// Location is the path of a plex server directory
type Location struct {
ID int `json:"id"`
Path string `json:"path"`
}
// Directory shows plex directory metadata
type Directory struct {
Location []Location `json:"Location"`
Agent string `json:"agent"`
AllowSync bool `json:"allowSync"`
Art string `json:"art"`
Composite string `json:"composite"`
CreatedAt int `json:"createdAt"`
Filter bool `json:"filters"`
Key string `json:"key"`
Language string `json:"language"`
Refreshing bool `json:"refreshing"`
Scanner string `json:"scanner"`
Thumb string `json:"thumb"`
Title string `json:"title"`
Type string `json:"type"`
UpdatedAt int `json:"updatedAt"`
UUID string `json:"uuid"`
}
// LibrarySections metadata of your library contents
type LibrarySections struct {
MediaContainer struct {
Directory []Directory `json:"Directory"`
} `json:"MediaContainer"`
}
// TaggedData ...
type TaggedData struct {
Tag string `json:"tag"`
Filter string `json:"filter"`
ID json.Number `json:"id"`
}
// Role ...
type Role struct {
TaggedData
Role string `json:"role"`
Thumb string `json:"thumb"`
}
// MetadataChildren returns metadata about a piece of media (tv show, movie, music, etc)
type MetadataChildren struct {
MediaContainer MediaContainer `json:"MediaContainer"`
}
// SearchResultsEpisode contains metadata about an episode
type SearchResultsEpisode struct {
MediaContainer MediaContainer `json:"MediaContainer"`
}
type plexResponse struct {
Children []struct {
ElementType string `json:"_elementType"`
Count string `json:"count"`
Key string `json:"key"`
Title string `json:"title"`
} `json:"_children"`
ElementType string `json:"_elementType"`
AllowCameraUpload string `json:"allowCameraUpload"`
AllowChannelAccess string `json:"allowChannelAccess"`
AllowSync string `json:"allowSync"`
BackgroundProcessing string `json:"backgroundProcessing"`
Certificate string `json:"certificate"`
CompanionProxy string `json:"companionProxy"`
FriendlyName string `json:"friendlyName"`
HubSearch string `json:"hubSearch"`
MachineIdentifier string `json:"machineIdentifier"`
Multiuser string `json:"multiuser"`
MyPlex string `json:"myPlex"`
MyPlexMappingState string `json:"myPlexMappingState"`
MyPlexSigninState string `json:"myPlexSigninState"`
MyPlexSubscription string `json:"myPlexSubscription"`
MyPlexUsername string `json:"myPlexUsername"`
Platform string `json:"platform"`
PlatformVersion string `json:"platformVersion"`
RequestParametersInCookie string `json:"requestParametersInCookie"`
Sync string `json:"sync"`
TranscoderActiveVideoSessions string `json:"transcoderActiveVideoSessions"`
TranscoderAudio string `json:"transcoderAudio"`
TranscoderLyrics string `json:"transcoderLyrics"`
TranscoderPhoto string `json:"transcoderPhoto"`
TranscoderSubtitles string `json:"transcoderSubtitles"`
TranscoderVideo string `json:"transcoderVideo"`
TranscoderVideoBitrates string `json:"transcoderVideoBitrates"`
TranscoderVideoQualities string `json:"transcoderVideoQualities"`
TranscoderVideoResolutions string `json:"transcoderVideoResolutions"`
UpdatedAt string `json:"updatedAt"`
Version string `json:"version"`
}
type killTranscodeResponse struct {
Children []struct {
ElementType string `json:"_elementType"`
AudioChannels int `json:"audioChannels"`
AudioCodec string `json:"audioCodec"`
AudioDecision string `json:"audioDecision"`
Container string `json:"container"`
Context string `json:"context"`
Duration int `json:"duration"`
Height int `json:"height"`
Key string `json:"key"`
Progress float64 `json:"progress"`
Protocol string `json:"protocol"`
Remaining int `json:"remaining"`
Speed float64 `json:"speed"`
Throttled bool `json:"throttled"`
VideoCodec string `json:"videoCodec"`
VideoDecision string `json:"videoDecision"`
Width int `json:"width"`
} `json:"_children"`
ElementType string `json:"_elementType"`
}
// CreateLibraryParams params required to create a library
type CreateLibraryParams struct {
Name string
Location string
LibraryType string
Agent string
Scanner string
Language string
}
// DevicesResponse metadata of a device that has connected to your server
type DevicesResponse struct {
ID int `json:"id"`
LastSeenAt string `json:"lastSeenAt"`
Name string `json:"name"`
Product string `json:"product"`
Version string `json:"version"`
}
// Friends are the plex accounts that have access to your server
type Friends struct {
ID int `xml:"id,attr"`
Title string `xml:"title,attr"`
Thumb string `xml:"thumb,attr"`
Protected string `xml:"protected,attr"`
Home string `xml:"home,attr"`
AllowSync string `xml:"allowSync,attr"`
AllowCameraUpload string `xml:"allowCameraUpload,attr"`
AllowChannels string `xml:"allowChannels,attr"`
FilterAll string `xml:"filterAll,attr"`
FilterMovies string `xml:"filterMovies,attr"`
FilterMusic string `xml:"filterMusic,attr"`
FilterPhotos string `xml:"filterPhotos,attr"`
FilterTelevision string `xml:"filterTelevision,attr"`
Restricted string `xml:"restricted,attr"`
Username string `xml:"username,attr"`
Email string `xml:"email,attr"`
RecommendationsPlaylistID string `xml:"recommendationsPlaylistId,attr"`
Server struct {
ID string `xml:"id,attr"`
ServerID string `xml:"serverId,attr"`
MachineIdentifier string `xml:"machineIdentifier,attr"`
Name string `xml:"name,attr"`
LastSeenAt string `xml:"lastSeenAt,attr"`
NumLibraries string `xml:"numLibraries,attr"`
AllLibraries string `xml:"allLibraries,attr"`
Owned string `xml:"owned,attr"`
Pending string `xml:"pending,attr"`
} `xml:"Server"`
}
type friendsResponse struct {
XMLName xml.Name `xml:"MediaContainer"`
FriendlyName string `xml:"friendlyName,attr"`
Identifier string `xml:"identifier,attr"`
MachineIdentifier string `xml:"machineIdentifier,attr"`
TotalSize string `xml:"totalSize,attr"`
Size int `xml:"size,attr"`
User []Friends `xml:"User"`
}
type resultResponse struct {
XMLName xml.Name `xml:"Response"`
Response struct {
Code int `xml:"code,attr"`
Status string `xml:"status,attr"`
} `xml:"Response"`
}
type inviteFriendResponse struct {
ID json.Number `json:"id"`
Name string `json:"name"`
OwnerID json.Number `json:"ownerId"`
InvitedID json.Number `json:"invitedId"`
InvitedEmail string `json:"invitedEmail"`
ServerID json.Number `json:"serverId"`
Accepted bool `json:"accepted"`
AcceptedAt string `json:"acceptedAt"`
DeletedAt string `json:"deletedAt"`
LeftAt string `json:"leftAt"`
Owned bool `json:"owned"`
InviteToken string `json:"inviteToken"`
MachineIdentifier string `json:"machineIdentifier"`
LastSeenAt time.Time `json:"lastSeenAt"`
NumLibraries json.Number `json:"numLibraries"`
Invited struct {
ID json.Number `json:"id"`
UUID string `json:"uuid"`
Title string `json:"title"`
Username string `json:"username"`
Restricted bool `json:"restricted"`
Thumb string `json:"thumb"`
Status string `json:"status"`
} `json:"invited"`
SharingSettings struct {
AllowChannels bool `json:"allowChannels"`
FilterMovies string `json:"filterMovies"`
FilterMusic string `json:"filterMusic"`
FilterPhotos string `json:"filterPhotos"`
FilterTelevision string `json:"filterTelevision"`
// FilterAll ??? I get null when testing. idk the true type
FilterAll interface{} `json:"filterAll"`
AllowSync bool `json:"allowSync"`
AllowCameraUpload bool `json:"allowCameraUpload"`
AllowSubtitleAdmin bool `json:"allowSubtitleAdmin"`
AllowTuners json.Number `json:"allowTuners"`
} `json:"sharingSettings"`
Libraries []struct {
ID json.Number `json:"id"`
Key json.Number `json:"key"`
Title string `json:"title"`
Type string `json:"type"`
} `json:"libraries"`
AllLibraries bool `json:"allLibraries"`
}
// InviteFriendParams are the params to invite a friend
type InviteFriendParams struct {
UsernameOrEmail string
MachineID string
Label string
LibraryIDs []int
}
// UpdateFriendParams optional parameters to update your friends access to your server
type UpdateFriendParams struct {
AllowSync string
AllowCameraUpload string
AllowChannels string
FilterMovies string
FilterTelevision string
FilterMusic string
FilterPhotos string
}
type inviteFriendBody struct {
InvitedEmail string `json:"invitedEmail"`
LibrarySectionIDs []int `json:"librarySectionIds"`
MachineIdentifier string `json:"machineIdentifier"`
Settings inviteFriendSettings `json:"settings"`
}
type inviteFriendSettings struct {
AllowCameraUpload string `json:"allowCameraUpload"`
AllowSync string `json:"allowSync"`
FilterMovies string `json:"filterMovies"`
FilterMusic string `json:"filterMusic"`
FilterTelevision string `json:"filterTelevision"`
}
type resourcesResponse struct {
XMLName xml.Name `xml:"MediaContainer"`
Size int `xml:"size,attr"`
Device []PMSDevices `xml:"Device"`
}
type terminateSessionResponse struct {
XMLName xml.Name `xml:"MediaContainer"`
Size int `xml:"size,attr"`
}
// PMSDevices is the result of the https://plex.tv/pms/resources endpoint
type PMSDevices struct {
Name string `json:"name" xml:"name,attr"`
Product string `json:"product" xml:"product,attr"`
ProductVersion string `json:"productVersion" xml:"productVersion,attr"`
Platform string `json:"platform" xml:"platform,attr"`
PlatformVersion string `json:"platformVersion" xml:"platformVersion,attr"`
Device string `json:"device" xml:"device,attr"`
ClientIdentifier string `json:"clientIdentifier" xml:"clientIdentifier,attr"`
CreatedAt string `json:"createdAt" xml:"createdAt,attr"`
LastSeenAt string `json:"lastSeenAt" xml:"lastSeenAt,attr"`
Provides string `json:"provides" xml:"provides,attr"`
Owned string `json:"owned" xml:"owned,attr"`
AccessToken string `json:"accessToken" xml:"accessToken,attr"`
HTTPSRequired int `json:"httpsRequired" xml:"httpsRequired,attr"`
Synced string `json:"synced" xml:"synced,attr"`
Relay int `json:"relay" xml:"relay,attr"`
PublicAddressMatches string `json:"publicAddressMatches" xml:"publicAddressMatches,attr"`
PublicAddress string `json:"publicAddress" xml:"publicAddress,attr"`
Presence string `json:"presence" xml:"presence,attr"`
Connection []Connection `json:"connection" xml:"Connection"`
}
// Connection lists options to connect to a device
type Connection struct {
Protocol string `json:"protocol" xml:"protocol,attr"`
Address string `json:"address" xml:"address,attr"`
Port string `json:"port" xml:"port,attr"`
URI string `json:"uri" xml:"uri,attr"`
Local int `json:"local" xml:"local,attr"`
}
// BaseAPIResponse info about the Plex Media Server
type BaseAPIResponse struct {
MediaContainer struct {
Directory []struct {
Count int64 `json:"count"`
Key string `json:"key"`
Title string `json:"title"`
} `json:"Directory"`
AllowCameraUpload bool `json:"allowCameraUpload"`
AllowChannelAccess bool `json:"allowChannelAccess"`
AllowSharing bool `json:"allowSharing"`
AllowSync bool `json:"allowSync"`
BackgroundProcessing bool `json:"backgroundProcessing"`
Certificate bool `json:"certificate"`
CompanionProxy bool `json:"companionProxy"`
CountryCode string `json:"countryCode"`
Diagnostics string `json:"diagnostics"`
EventStream bool `json:"eventStream"`
FriendlyName string `json:"friendlyName"`
HubSearch bool `json:"hubSearch"`
ItemClusters bool `json:"itemClusters"`
Livetv int64 `json:"livetv"`
MachineIdentifier string `json:"machineIdentifier"`
MediaProviders bool `json:"mediaProviders"`
Multiuser bool `json:"multiuser"`
MyPlex bool `json:"myPlex"`
MyPlexMappingState string `json:"myPlexMappingState"`
MyPlexSigninState string `json:"myPlexSigninState"`
MyPlexSubscription bool `json:"myPlexSubscription"`
MyPlexUsername string `json:"myPlexUsername"`
OwnerFeatures string `json:"ownerFeatures"`
PhotoAutoTag bool `json:"photoAutoTag"`
Platform string `json:"platform"`
PlatformVersion string `json:"platformVersion"`
PluginHost bool `json:"pluginHost"`
ReadOnlyLibraries bool `json:"readOnlyLibraries"`
RequestParametersInCookie bool `json:"requestParametersInCookie"`
Size int64 `json:"size"`
StreamingBrainABRVersion int64 `json:"streamingBrainABRVersion"`
StreamingBrainVersion int64 `json:"streamingBrainVersion"`
Sync bool `json:"sync"`
TranscoderActiveVideoSessions int64 `json:"transcoderActiveVideoSessions"`
TranscoderAudio bool `json:"transcoderAudio"`
TranscoderLyrics bool `json:"transcoderLyrics"`
TranscoderPhoto bool `json:"transcoderPhoto"`
TranscoderSubtitles bool `json:"transcoderSubtitles"`
TranscoderVideo bool `json:"transcoderVideo"`
TranscoderVideoBitrates string `json:"transcoderVideoBitrates"`
TranscoderVideoQualities string `json:"transcoderVideoQualities"`
TranscoderVideoResolutions string `json:"transcoderVideoResolutions"`
UpdatedAt int64 `json:"updatedAt"`
Updater bool `json:"updater"`
Version string `json:"version"`
VoiceSearch bool `json:"voiceSearch"`
} `json:"MediaContainer"`
}
// UserPlexTV plex.tv user. should be used when interacting with plex.tv as the id is an int
type UserPlexTV struct {
// ID is an int when signing in to Plex.tv but a string when access own server
ID int `json:"id"`
UUID string `json:"uuid"`
Email string `json:"email"`
JoinedAt string `json:"joined_at"`
Username string `json:"username"`
Thumb string `json:"thumb"`
HasPassword bool `json:"hasPassword"`
AuthToken string `json:"authToken"`
AuthenticationToken string `json:"authenticationToken"`
Subscription struct {
Active bool `json:"active"`
Status string `json:"Active"`
Plan string `json:"lifetime"`
Features []string `json:"features"`
} `json:"subscription"`
Roles struct {
Roles []string `json:"roles"`
} `json:"roles"`
Entitlements []string `json:"entitlements"`
ConfirmedAt string `json:"confirmedAt"`
ForumID json.Number `json:"forumId"`
RememberMe bool `json:"rememberMe"`
Title string `json:"title"`
}
// User plex server user. only difference is id is a string
type User struct {
// ID is an int when signing in to Plex.tv but a string when access own server
ID string `json:"id"`
UUID string `json:"uuid"`
Email string `json:"email"`
JoinedAt string `json:"joined_at"`
Username string `json:"username"`
Thumb string `json:"thumb"`
HasPassword bool `json:"hasPassword"`
AuthToken string `json:"authToken"`
AuthenticationToken string `json:"authenticationToken"`
Subscription struct {
Active bool `json:"active"`
Status string `json:"Active"`
Plan string `json:"lifetime"`
Features []string `json:"features"`
} `json:"subscription"`
Roles struct {
Roles []string `json:"roles"`
} `json:"roles"`
Entitlements []string `json:"entitlements"`
ConfirmedAt string `json:"confirmedAt"`
ForumID string `json:"forumId"`
RememberMe bool `json:"rememberMe"`
Title string `json:"title"`
}
// SignInResponse ...
type SignInResponse struct {
User UserPlexTV `json:"user"`
}
// ServerInfo is the result of the https://plex.tv/api/servers endpoint
type ServerInfo struct {
XMLName xml.Name `xml:"MediaContainer"`
FriendlyName string `xml:"friendlyName,attr"`
Identifier string `xml:"identifier,attr"`
MachineIdentifier string `xml:"machineIdentifier,attr"`
Size int `xml:"size,attr"`
Server []struct {
AccessToken string `xml:"accessToken,attr"`
Name string `xml:"name,attr"`
Address string `xml:"address,attr"`
Port string `xml:"port,attr"`
Version string `xml:"version,attr"`
Scheme string `xml:"scheme,attr"`
Host string `xml:"host,attr"`
LocalAddresses string `xml:"localAddresses,attr"`
MachineIdentifier string `xml:"machineIdentifier,attr"`
CreatedAt string `xml:"createdAt,attr"`
UpdatedAt string `xml:"updatedAt,attr"`
Owned string `xml:"owned,attr"`
Synced string `xml:"synced,attr"`
} `xml:"Server"`
}
// SectionIDResponse the section id (or library id) of your server
// useful when inviting a user to the server
type SectionIDResponse struct {
XMLName xml.Name `xml:"MediaContainer"`
FriendlyName string `xml:"friendlyName,attr"`
Identifier string `xml:"identifier,attr"`
MachineIdentifier string `xml:"machineIdentifier,attr"`
Size int `xml:"size,attr"`
Server []struct {
Name string `xml:"name,attr"`
Address string `xml:"address,attr"`
Port string `xml:"port,attr"`
Version string `xml:"version,attr"`
Scheme string `xml:"scheme,attr"`
Host string `xml:"host,attr"`
LocalAddresses string `xml:"localAddresses,attr"`
MachineIdentifier string `xml:"machineIdentifier,attr"`
CreatedAt int `xml:"createdAt,attr"`
UpdatedAt int `xml:"updatedAt,attr"`
Owned int `xml:"owned,attr"`
Synced string `xml:"synced,attr"`
Section []ServerSections `xml:"Section"`
} `xml:"Server"`
}
// ServerSections contains information of your library sections
type ServerSections struct {
ID int `xml:"id,attr"`
Key string `xml:"key,attr"`
Type string `xml:"type,attr"`
Title string `xml:"title,attr"`
}
// LibraryLabels are the existing labels set on your server
type LibraryLabels struct {
ElementType string `json:"_elementType"`
AllowSync string `json:"allowSync"`
Art string `json:"art"`
Content string `json:"content"`
Identifier string `json:"identifier"`
MediaTagPrefix string `json:"mediaTagPrefix"`
MediaTagVersion string `json:"mediaTagVersion"`
Thumb string `json:"thumb"`
Title1 string `json:"title1"`
Title2 string `json:"title2"`
ViewGroup string `json:"viewGroup"`
ViewMode string `json:"viewMode"`
Children []struct {
ElementType string `json:"_elementType"`
FastKey string `json:"fastKey"`
Key string `json:"key"`
Title string `json:"title"`
} `json:"_children"`
}
type headers struct {
Platform string
PlatformVersion string
Provides string
Product string
Version string
Device string
ContainerSize string
ContainerStart string
Token string
Accept string
ContentType string
ClientIdentifier string
TargetClientIdentifier string
}
type request struct {
headers
}
// Sessions
// TranscodeSessionsResponse is the result for transcode session endpoint /transcode/sessions
type TranscodeSessionsResponse struct {
Children []struct {
ElementType string `json:"_elementType"`
AudioChannels int `json:"audioChannels"`
AudioCodec string `json:"audioCodec"`
AudioDecision string `json:"audioDecision"`
Container string `json:"container"`
Context string `json:"context"`
Duration int `json:"duration"`
Height int `json:"height"`
Key string `json:"key"`
Progress float64 `json:"progress"`
Protocol string `json:"protocol"`
Remaining int `json:"remaining"`
Speed float64 `json:"speed"`
Throttled bool `json:"throttled"`
VideoCodec string `json:"videoCodec"`
VideoDecision string `json:"videoDecision"`
Width int `json:"width"`
} `json:"_children"`
ElementType string `json:"_elementType"`
}
// Stream ...
type Stream struct {
AlbumGain string `json:"albumGain"`
AlbumPeak string `json:"albumPeak"`
AlbumRange string `json:"albumRange"`
Anamorphic bool `json:"anamorphic"`
AudioChannelLayout string `json:"audioChannelLayout"`
BitDepth int `json:"bitDepth"`
Bitrate int `json:"bitrate"`
BitrateMode string `json:"bitrateMode"`
Cabac string `json:"cabac"`
Channels int `json:"channels"`
ChromaLocation string `json:"chromaLocation"`
ChromaSubsampling string `json:"chromaSubsampling"`
Codec string `json:"codec"`
CodecID string `json:"codecID"`
ColorRange string `json:"colorRange"`
ColorSpace string `json:"colorSpace"`
Default bool `json:"default"`
DisplayTitle string `json:"displayTitle"`
Duration string `json:"duration"`
FrameRate float64 `json:"frameRate"`
FrameRateMode string `json:"frameRateMode"`
Gain string `json:"gain"`
HasScalingMatrix bool `json:"hasScalingMatrix"`
Height int `json:"height"`
ID int `json:"id"`
Index int `json:"index"`
Language string `json:"language"`
LanguageCode string `json:"languageCode"`
Level int `json:"level"`
Location string `json:"location"`
Loudness string `json:"loudness"`
Lra string `json:"lra"`
Peak string `json:"peak"`
PixelAspectRatio string `json:"pixelAspectRatio"`
PixelFormat string `json:"pixelFormat"`
Profile string `json:"profile"`
RefFrames int `json:"refFrames"`
SamplingRate int `json:"samplingRate"`
ScanType string `json:"scanType"`
Selected bool `json:"selected"`
StreamIdentifier string `json:"streamIdentifier"`
StreamType int `json:"streamType"`
Width int `json:"width"`
}
// StreamV1 stream info version 1
type StreamV1 struct {
Stream
BitDepth int `json:"bitDepth,string"`
Default string `json:"default"`
Bitrate int `json:"bitrate,string"`
FrameRate float64 `json:"frameRate,string"`
HasScalingMatrix string `json:"hasScalingMatrix"`
Height int `json:"height,string"`
Width int `json:"width,string"`
ID int `json:"id,string"`
Index int `json:"index,string"`
Level int `json:"level,string"`
RefFrames int `json:"refFrames,string"`
StreamType int `json:"streamType,string"`
Channels int `json:"channels,string"`
SamplingRate int `json:"samplingRate,string"`
Selected string `json:"selected"`
}
// Part ...
type Part struct {
AudioProfile string `json:"audioProfile"`
Container string `json:"container"`
Decision string `json:"decision"`
Duration int `json:"duration"`
File string `json:"file"`
Has64bitOffsets bool `json:"has64bitOffsets"`
HasThumbnail string `json:"hasThumbnail"`
ID int `json:"id"`
Key string `json:"key"`
OptimizedForStreaming bool `json:"optimizedForStreaming"`
Selected bool `json:"selected"`
Size int `json:"size"`
Stream []Stream `json:"Stream"`
VideoProfile string `json:"videoProfile"`
}
// PartV1 part version 1
type PartV1 struct {
Part
Duration int `json:"duration,string"`
Has64bitOffsets string `json:"has64bitOffsets"`
ID int `json:"id,string"`
OptimizedForStreaming string `json:"optimizedForStreaming"`
Size int `json:"size,string"`
Stream []StreamV1 `json:"Stream"`
}
// Player ...
type Player struct {
Address string `json:"address"`
Device string `json:"device"`
Local bool `json:"local"`
MachineIdentifier string `json:"machineIdentifier"`
Model string `json:"model"`
Platform string `json:"platform"`
PlatformVersion string `json:"platformVersion"`
Product string `json:"product"`
Profile string `json:"profile"`
RemotePublicAddress string `json:"remotePublicAddress"`
State string `json:"state"`
Title string `json:"title"`
UserID int `json:"userID"`
Vendor string `json:"vendor"`
Version string `json:"version"`
}
// Session ...
type Session struct {
Bandwidth int `json:"bandwidth"`
ID string `json:"id"`
Location string `json:"location"`
}
// CurrentSessions metadata of users consuming media
type CurrentSessions struct {
MediaContainer struct {
Metadata []MetadataV1 `json:"Metadata"`
Size int `json:"size"`
} `json:"MediaContainer"`
}