-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSickRage.php
1276 lines (1147 loc) · 36.2 KB
/
SickRage.php
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
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
namespace Kryptonit3\SickRage;
use GuzzleHttp\Client;
use Kryptonit3\SickRage\Exceptions\InvalidException;
class SickRage
{
protected $url;
protected $apiKey;
protected $httpAuthUsername;
protected $httpAuthPassword;
public function __construct($url, $apiKey, $httpAuthUsername = null, $httpAuthPassword = null)
{
$this->url = rtrim($url, '/\\'); // Example: http://127.0.0.1:8081 (no trailing forward-backward slashes)
$this->apiKey = $apiKey;
$this->httpAuthUsername = $httpAuthUsername;
$this->httpAuthPassword = $httpAuthPassword;
}
/**
* Displays the information of a specific episode matching the corresponding tvdbid, season and episode number.
*
* @param int $tvdbId tvdbid unique show id
* @param int $season season number
* @param int $episode episode number
* @param int $fullPath 0: file name only 1: full path
* @return string
* @throws InvalidException
*/
public function episode($tvdbId, $season, $episode, $fullPath = 0)
{
$uri = 'episode';
$uriData = [
'tvdbid' => $tvdbId,
'season' => $season,
'episode' => $episode,
'full_path' => $fullPath
];
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => $uriData
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Initiate a search for a specific episode matching the corresponding tvdbid, season and episode number.
*
* @param int $tvdbId tvdbid unique show id
* @param int $season season number
* @param int $episode episode number
* @return string
* @throws InvalidException
*/
public function episodeSearch($tvdbId, $season, $episode)
{
$uri = 'episode';
$uriData = [
'tvdbid' => $tvdbId,
'season' => $season,
'episode' => $episode
];
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => $uriData
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Set the status of an epsiode or season.
*
* @param int $tvdbId tvdbid unique show id
* @param int $season season number
* @param string $status wanted, skipped, archived, ignored
* @param int|null $episode episode number
* --- if an episode is not provided, then the whole seasons' status will be set.
* @param int $force 0: not existing episodes 1: include existing episodes (can replace downloaded episodes)
* @return string
* @throws InvalidException
*/
public function episodeSetStatus($tvdbId, $season, $status, $episode = null, $force = 0)
{
$uri = 'episode.setstatus';
$uriData = [
'tvdbid' => $tvdbId,
'season' => $season,
'status' => $status,
'force' => $force
];
if ( $episode ) { $uriData['episode'] = $episode; }
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => $uriData
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Display scene exceptions for all or a given show.
*
* @param int|null $tvdbId tvdbid unique show id
* @return string
* @throws InvalidException
*/
public function exceptions($tvdbId = null)
{
$uri = 'exceptions';
$uriData = [];
if ( $tvdbId ) { $uriData['tvdbid'] = $tvdbId; }
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => $uriData
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Display the upcoming episodes for the shows currently added in the users' database.
*
* @param string $sort date, network, name
* @param string $type missed, today, soon, later - multiple types can be passed when delimited by |
* --- missed - show's date is older than today
* --- today - show's date is today
* --- soon - show's date greater than today but less than a week
* --- later - show's date greater than a week
* @param int|null $paused 0: do not show paused 1: show paused
* --- if not set then the user's default setting in SickRage is used
* @return string
* @throws InvalidException
*/
public function future($sort = 'date', $type = 'missed|today|soon|later', $paused = null)
{
$uri = 'future';
$uriData = [
'sort' => $sort,
'type' => $type
];
if ( $paused ) { $uriData['paused'] = $paused; }
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => $uriData
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Display SickRage's downloaded/snatched history.
*
* @param int $limit Use 0 if you want to see all history, note this could cause
* --- heavy cpu/disk usage for the user as well as cause your application to time out
* --- while it's waiting for the data.
* @param string|null $type downloaded, snatched
* @return string
* @throws InvalidException
*/
public function history($limit = 100, $type = null)
{
$uri = 'history';
$uriData = [
'limit' => $limit
];
if ( $type ) { $uriData['type'] = $type; }
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => $uriData
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Clear SickRage's history.
*
* @return string
* @throws InvalidException
*/
public function historyClear()
{
$uri = 'history.clear';
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => []
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Trim SickRage's history by removing entries greater than 30 days old.
*
* @return string
* @throws InvalidException
*/
public function historyTrim()
{
$uri = 'history.trim';
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => []
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* View SickRage's log.
*
* @param string $minLevel debug, info, warning, error
* @return string
* @throws InvalidException
*/
public function logs($minLevel = 'error')
{
$uri = 'history.trim';
$uriData = [
'min_level' => $minLevel
];
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => $uriData
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Display information for a given show.
*
* @param int $tvdbId tvdbid unique show id
* @return string
* @throws InvalidException
*/
public function show($tvdbId)
{
$uri = 'show';
$uriData = [
'tvdbid' => $tvdbId
];
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => $uriData
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Add a show to SickRage using an existing folder.
*
* @param int $tvdbId tvdbid unique show id
* @param string $location path to existing show folder
* @param int|null $flattenFolders
* --- 0: use season folders if part of rename string
* --- 1: do not use season folders
* --- if not provided then the config setting (default) is used
* @param string|null $initial multiple types can be passed when delimited by |
* --- sdtv, sddvd, hdtv, rawhdtv, fullhdtv, hdwebdl, fullhdwebdl, hdbluray, fullhdbluray, unknown
* --- if not provided then the config setting (default) is used
* @param string|null $archive multiple types can be passed when delimited by |
* --- sddvd, hdtv, rawhdtv, fullhdtv, hdwebdl, fullhdwebdl, hdbluray, fullhdbluray
* --- if not provided then the config setting (default) is used
* @return string
* @throws InvalidException
*/
public function showAddExisting($tvdbId, $location, $flattenFolders = null, $initial = null, $archive = null)
{
$uri = 'show.addexisting';
$uriData = [
'tvdbid' => $tvdbId,
'location' => $location
];
if ( $flattenFolders ) { $uriData['flatten_folders'] = $flattenFolders; }
if ( $initial ) { $uriData['initial'] = $initial; }
if ( $archive ) { $uriData['archive'] = $archive; }
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => $uriData
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Add a show to SickRage providing the parent directory where the tv shows folder should be created.
*
* @param int $tvdbId tvdbid unique show id
* @param string|null $location path to existing folder to store show
* --- if not provided then the config setting (default) is used -- if valid
* @param string $lang two letter tvdb language, en = english
* --- en, zh, hr, cs, da, nl, fi, fr, de, el, he, hu, it, ja, ko, no, pl, pt, ru, sl, es, sv, tr
* @param int|null $flattenFolders
* --- 0: use season folders if part of rename string
* --- 1: do not use season folders
* --- if not provided then the config setting (default) is used
* @param string|null $status wanted, skipped, archived, ignored
* --- if not provided then the config setting (default) is used
* @param string|null $initial multiple types can be passed when delimited by |
* --- sdtv, sddvd, hdtv, rawhdtv, fullhdtv, hdwebdl, fullhdwebdl, hdbluray, fullhdbluray, unknown
* --- if not provided then the config setting (default) is used
* @param string|null $archive multiple types can be passed when delimited by |
* --- sddvd, hdtv, rawhdtv, fullhdtv, hdwebdl, fullhdwebdl, hdbluray, fullhdbluray
* --- if not provided then the config setting (default) is used
* @return string
* @throws InvalidException
*/
public function showAddNew($tvdbId, $location = null, $lang = 'en', $flattenFolders = null,
$status = null, $initial = null, $archive = null)
{
$uri = 'show.addnew';
$uriData = [
'tvdbid' => $tvdbId,
'lang' => $lang
];
if ( $flattenFolders ) { $uriData['flatten_folders'] = $flattenFolders; }
if ( $initial ) { $uriData['initial'] = $initial; }
if ( $archive ) { $uriData['archive'] = $archive; }
if ( $status ) { $uriData['status'] = $status; }
if ( $location ) { $uriData['location'] = $location; }
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => $uriData
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Display if the poster/banner SickRage's image cache is valid.
*
* @param int $tvdbId tvdbid unique show id
* @return string
* @throws InvalidException
*/
public function showCache($tvdbId)
{
$uri = 'show.cache';
$uriData = [
'tvdbid' => $tvdbId
];
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => $uriData
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Delete a show from SickRage.
*
* @param int $tvdbId tvdbid unique show id
* @return string
* @throws InvalidException
*/
public function showDelete($tvdbId)
{
$uri = 'show.delete';
$uriData = [
'tvdbid' => $tvdbId
];
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => $uriData
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Retrieve the stored banner image from SickRage's cache for a particular tvdbid.
* If no image is found then the default sb banner is shown.
*
* @param int $tvdbId tvdbid unique show id
* @return string
* @throws InvalidException
*/
public function showGetBanner($tvdbId)
{
$uri = 'show.getbanner';
$uriData = [
'tvdbid' => $tvdbId
];
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => $uriData
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Retrieve the stored poster image from SickRage's cache for a particular tvdbid.
* If no image is found then the default sb poster is shown.
*
* @param int $tvdbId tvdbid unique show id
* @return string
* @throws InvalidException
*/
public function showGetPoster($tvdbId)
{
$uri = 'show.getposter';
$uriData = [
'tvdbid' => $tvdbId
];
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => $uriData
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Get quality settings of a show in SickRage.
*
* @param int $tvdbId tvdbid unique show id
* @return string
* @throws InvalidException
*/
public function showGetQuality($tvdbId)
{
$uri = 'show.getquality';
$uriData = [
'tvdbid' => $tvdbId
];
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => $uriData
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Set a show's paused state in SickRage.
*
* @param int $tvdbId tvdbid unique show id
* @param int $pause 0: unpause show 1: pause show
* @return string
* @throws InvalidException
*/
public function showPause($tvdbId, $pause = 0)
{
$uri = 'show.pause';
$uriData = [
'tvdbid' => $tvdbId,
'pause' => $pause
];
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => $uriData
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Refresh a show in SickRage by rescanning local files.
*
* @param int $tvdbId tvdbid unique show id
* @return string
* @throws InvalidException
*/
public function showRefresh($tvdbId)
{
$uri = 'show.refresh';
$uriData = [
'tvdbid' => $tvdbId
];
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => $uriData
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Display the season list for a given show.
*
* @param int $tvdbId tvdbid unique show id
* @param string $sort asc, desc
* @return string
* @throws InvalidException
*/
public function showSeasonList($tvdbId, $sort = 'desc')
{
$uri = 'show.seasonlist';
$uriData = [
'tvdbid' => $tvdbId,
'sort' => $sort
];
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => $uriData
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Display a listing of episodes for all or a given season.
*
* @param int $tvdbId tvdbid unique show id
* @param int|null $season season number
* @return string
* @throws InvalidException
*/
public function showSeasons($tvdbId, $season = null)
{
$uri = 'show.seasons';
$uriData = [
'tvdbid' => $tvdbId
];
if ( is_numeric($season) ) { $uriData['season'] = $season; }
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => $uriData
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Set desired quality of a show in SickRage.
*
* @param int $tvdbId tvdbid unique show id
* @param string|null $initial multiple types can be passed when delimited by |
* --- sdtv, sddvd, hdtv, rawhdtv, fullhdtv, hdwebdl, fullhdwebdl, hdbluray, fullhdbluray, unknown
* @param string|null $archive multiple types can be passed when delimited by |
* --- sddvd, hdtv, rawhdtv, fullhdtv, hdwebdl, fullhdwebdl, hdbluray, fullhdbluray
* @return string
* @throws InvalidException
*/
public function showSetQuality($tvdbId, $initial = null, $archive = null)
{
$uri = 'show.setquality';
$uriData = [
'tvdbid' => $tvdbId
];
if ( $initial ) { $uriData['initial'] = $initial; }
if ( $archive ) { $uriData['archive'] = $archive; }
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => $uriData
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Display episode statistics for a given show.
*
* @param int $tvdbId tvdbid unique show id
* @return string
* @throws InvalidException
*/
public function showStats($tvdbId)
{
$uri = 'show.stats';
$uriData = [
'tvdbid' => $tvdbId
];
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => $uriData
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Update a show in SickRage by pulling down information from TVDB and rescan local files.
*
* @param int $tvdbId tvdbid unique show id
* @return string
* @throws InvalidException
*/
public function showUpdate($tvdbId)
{
$uri = 'show.update';
$uriData = [
'tvdbid' => $tvdbId
];
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => $uriData
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Display a list of all shows in SickRage.
*
* @param string $sort id, name
* --- id - sort by tvdbid
* --- name - sort by show name
* @param int|null $paused if not set then both paused and non paused are shown
* --- 0: show only non paused
* --- 1: show only paused
* @return string
* @throws InvalidException
*/
public function shows($sort = 'id', $paused = null)
{
$uri = 'shows';
$uriData = [
'sort' => $sort
];
if ( $paused ) { $uriData['paused'] = $paused; }
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => $uriData
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Display global episode and show statistics.
*
* @return string
* @throws InvalidException
*/
public function showsStats()
{
$uri = 'shows.stats';
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => []
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Display misc SickRage related information.
* This is also the default command that the api will show if none is specified.
*
* @return string
* @throws InvalidException
*/
public function sb()
{
$uri = 'sb';
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => []
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Add a root (parent) directory (only if it is a valid location),
* and set as the default root dir if requested to SickRages's config.
*
* @param string $location full path to a root (parent) directory of tv shows
* @param int $default
* --- 0: do not change global default
* --- 1: set location as the new global default
* @return string
* @throws InvalidException
*/
public function sbAddRootDir($location, $default = 0)
{
$uri = 'sb.addrootdir';
$uriData = [
'location' => $location,
'default' => $default
];
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => $uriData
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Query the SickBeard scheduler.
*
* @return string
* @throws InvalidException
*/
public function sbCheckScheduler()
{
$uri = 'sb.checkscheduler';
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => []
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Delete a root (parent) directory from the root directory list in SickRage's config.
*
* @param string $location
* @return string
* @throws InvalidException
*/
public function sbDeleteRootDir($location)
{
$uri = 'sb.deleterootdir';
$uriData = [
'location' => $location
];
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => $uriData
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Force the episode search early.
*
* @return string
* @throws InvalidException
*/
public function sbForceSearch()
{
$uri = 'sb.forcesearch';
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'get',
'data' => []
]
);
} catch (\Exception $e) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
}
/**
* Get default settings from SickBeard's config.
*
* @return string
* @throws InvalidException
*/