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",
|
"url": "jdbc:sqlite:mptv.db",
|
||||||
"user": "",
|
"user": "",
|
||||||
"password": ""
|
"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 class SourceItem {
|
||||||
public enum SourceType {
|
public enum SourceType {
|
||||||
@JsonProperty("m3u")
|
@JsonProperty("m3u")
|
||||||
M3U
|
M3U,
|
||||||
|
|
||||||
|
@JsonProperty("m3u-local")
|
||||||
|
M3U_LOCAL
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public SourceType type;
|
public SourceType type;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public String url;
|
public String url;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public String path;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public String cookies;
|
public String cookies;
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,11 @@ public class TestConfig {
|
||||||
"url": "https://example.com/list.m3u",
|
"url": "https://example.com/list.m3u",
|
||||||
"cookies": null,
|
"cookies": null,
|
||||||
"singleCategory": null
|
"singleCategory": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "m3u-local",
|
||||||
|
"path": "test.m3u8",
|
||||||
|
"singleCategory": "test"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -76,7 +81,15 @@ public class TestConfig {
|
||||||
SourceItem m3u = config.sources.get(0);
|
SourceItem m3u = config.sources.get(0);
|
||||||
assertEquals(SourceItem.SourceType.M3U, m3u.type);
|
assertEquals(SourceItem.SourceType.M3U, m3u.type);
|
||||||
assertEquals("https://example.com/list.m3u", m3u.url);
|
assertEquals("https://example.com/list.m3u", m3u.url);
|
||||||
|
assertNull(m3u.path);
|
||||||
assertNull(m3u.cookies);
|
assertNull(m3u.cookies);
|
||||||
assertNull(m3u.singleCategory);
|
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