Skip to content

Commit 73fc755

Browse files
committed
Add new field to Stream
1 parent 76882b5 commit 73fc755

3 files changed

Lines changed: 31 additions & 1 deletion

File tree

library/src/main/java/me/proxer/library/entity/anime/Stream.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,11 @@ public class Stream implements ProxerIdItem, ProxerImageItem, ProxerDateItem {
8080
@Getter
8181
@Json(name = "tname")
8282
private String translatorGroupName;
83+
84+
/**
85+
* Returns if the stream is hosted at an official hoster like Crunchyroll.
86+
*/
87+
@Getter
88+
@Json(name = "legal")
89+
public boolean isOfficial;
8390
}

library/src/test/java/me/proxer/library/api/anime/StreamsEndpointTest.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@ public void testDefault() throws IOException, ProxerException {
3030
assertThat(result).first().isEqualTo(buildTestStream());
3131
}
3232

33+
@Test
34+
public void testOfficial() throws IOException, ProxerException {
35+
server.enqueue(new MockResponse().setBody(fromResource("streams.json")));
36+
37+
final List<Stream> result = api.anime()
38+
.streams("3", 4, AnimeLanguage.GERMAN_SUB)
39+
.build()
40+
.execute();
41+
42+
assertThat(result).element(2).isEqualTo(buildOfficialTestStream());
43+
}
44+
3345
@Test
3446
public void testPath() throws ProxerException, IOException, InterruptedException {
3547
server.enqueue(new MockResponse().setBody(fromResource("streams.json")));
@@ -71,6 +83,12 @@ public void testProxerStreamFalse() throws ProxerException, IOException, Interru
7183
private Stream buildTestStream() {
7284
return new Stream("565484", "dailymotion", "Dailymotion", "dailymotion.png",
7385
"217857", "kollenbad", new Date(1454414911L * 1000), "698",
74-
"Grim-Subs");
86+
"Grim-Subs", false);
87+
}
88+
89+
private Stream buildOfficialTestStream() {
90+
return new Stream("565924", "novamov", "Auroravid/Novamov", "novamov.png",
91+
"66", "ProxerBot", new Date(1454767407L * 1000), "92",
92+
"Chinurarete-Subs", true);
7593
}
7694
}

library/src/test/resources/streams.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"htype": "iframe",
99
"name": "Dailymotion",
1010
"img": "dailymotion.png",
11+
"legal": "0",
1112
"replace": "//www.dailymotion.com/embed/video/#",
1213
"uploader": "217857",
1314
"username": "kollenbad",
@@ -21,6 +22,7 @@
2122
"htype": "iframe",
2223
"name": "MP4Upload",
2324
"img": "mp4upload.png",
25+
"legal": "0",
2426
"replace": "http://www.mp4upload.com/embed-#.html",
2527
"uploader": "66",
2628
"username": "ProxerBot",
@@ -34,6 +36,7 @@
3436
"htype": "iframe",
3537
"name": "Auroravid/Novamov",
3638
"img": "novamov.png",
39+
"legal": "1",
3740
"replace": "http://embed.novamov.com/embed.php?width=728&height=504&v=#&px=1",
3841
"uploader": "66",
3942
"username": "ProxerBot",
@@ -47,6 +50,7 @@
4750
"htype": "link",
4851
"name": "Streamcloud",
4952
"img": "streamcloud.png",
53+
"legal": "0",
5054
"replace": "http://streamcloud.eu/#",
5155
"uploader": "66",
5256
"username": "ProxerBot",
@@ -60,6 +64,7 @@
6064
"htype": "iframe",
6165
"name": "VideoWeed",
6266
"img": "videoweed.png",
67+
"legal": "0",
6368
"replace": "http://embed.videoweed.es/embed.php?v=#&width=728&height=504",
6469
"uploader": "66",
6570
"username": "ProxerBot",

0 commit comments

Comments
 (0)