add m3u local source type
This commit is contained in:
parent
ca609e3848
commit
8f897ddf71
3 changed files with 37 additions and 2 deletions
|
|
@ -11,5 +11,19 @@
|
|||
"url": "jdbc:sqlite:mptv.db",
|
||||
"user": "",
|
||||
"password": ""
|
||||
}
|
||||
},
|
||||
|
||||
"sources": [
|
||||
{
|
||||
"type": "m3u",
|
||||
"url": "https://example.com/list.m3u",
|
||||
"cookies": null,
|
||||
"singleCategory": null
|
||||
},
|
||||
{
|
||||
"type": "m3u-local",
|
||||
"path": "test.m3u8",
|
||||
"singleCategory": "test"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -7,12 +7,20 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||
public class SourceItem {
|
||||
public enum SourceType {
|
||||
@JsonProperty("m3u")
|
||||
M3U
|
||||
M3U,
|
||||
|
||||
@JsonProperty("m3u-local")
|
||||
M3U_LOCAL
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public SourceType type;
|
||||
|
||||
@Nullable
|
||||
public String url;
|
||||
|
||||
@Nullable
|
||||
public String path;
|
||||
|
||||
@Nullable
|
||||
public String cookies;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,11 @@ public class TestConfig {
|
|||
"url": "https://example.com/list.m3u",
|
||||
"cookies": null,
|
||||
"singleCategory": null
|
||||
},
|
||||
{
|
||||
"type": "m3u-local",
|
||||
"path": "test.m3u8",
|
||||
"singleCategory": "test"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -76,7 +81,15 @@ public class TestConfig {
|
|||
SourceItem m3u = config.sources.get(0);
|
||||
assertEquals(SourceItem.SourceType.M3U, m3u.type);
|
||||
assertEquals("https://example.com/list.m3u", m3u.url);
|
||||
assertNull(m3u.path);
|
||||
assertNull(m3u.cookies);
|
||||
assertNull(m3u.singleCategory);
|
||||
|
||||
SourceItem m3uLocal = config.sources.get(1);
|
||||
assertEquals(SourceItem.SourceType.M3U_LOCAL, m3uLocal.type);
|
||||
assertEquals("test.m3u8", m3uLocal.path);
|
||||
assertEquals("test", m3uLocal.singleCategory);
|
||||
assertNull(m3uLocal.url);
|
||||
assertNull(m3uLocal.cookies);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue