mirror of
https://github.com/atsunatsu/Look4Sat.git
synced 2026-10-02 03:15:37 +00:00
v3.1.1 - R4UAB source, minor fixes, libs update
This commit is contained in:
14 files changed
+29
-254
No files matched your search
@@ -40,9 +40,7 @@ interface IDataRepository {
|
||||
|
||||
fun updateFromFile(uri: String)
|
||||
|
||||
fun updateFromWeb(urls: List<String>)
|
||||
|
||||
fun updateFromWebNew()
|
||||
fun updateFromWeb()
|
||||
|
||||
fun setUpdateStateHandled()
|
||||
|
||||
|
||||
@@ -21,13 +21,6 @@ import com.rtbishop.look4sat.domain.predict.GeoPos
|
||||
|
||||
interface ISettingsManager {
|
||||
|
||||
val defaultSources: List<String>
|
||||
get() = listOf(
|
||||
"https://www.prismnet.com/~mmccants/tles/inttles.zip",
|
||||
"https://www.prismnet.com/~mmccants/tles/classfd.zip",
|
||||
"https://celestrak.com/NORAD/elements/gp.php?GROUP=active&FORMAT=csv",
|
||||
"https://amsat.org/tle/current/nasabare.txt"
|
||||
)
|
||||
val sourcesMap: Map<String, String>
|
||||
get() = mapOf(
|
||||
"All" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=active&FORMAT=csv",
|
||||
@@ -47,6 +40,7 @@ interface ISettingsManager {
|
||||
"New" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=last-30-days&FORMAT=csv",
|
||||
"OneWeb" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=oneweb&FORMAT=csv",
|
||||
"Orbcomm" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=orbcomm&FORMAT=csv",
|
||||
"R4UAB" to "https://r4uab.ru/satonline.txt",
|
||||
"Resource" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=resource&FORMAT=csv",
|
||||
"SatNOGS" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=satnogs&FORMAT=csv",
|
||||
"Science" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=science&FORMAT=csv",
|
||||
@@ -128,8 +122,4 @@ interface ISettingsManager {
|
||||
fun getBTFormat(): String
|
||||
|
||||
fun setBTFormat(value: String)
|
||||
|
||||
fun loadDataSources(): List<String>
|
||||
|
||||
fun saveDataSources(sources: List<String>)
|
||||
}
|
||||
@@ -66,38 +66,7 @@ class DataRepository(
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateFromWeb(urls: List<String>) {
|
||||
_updateState.value = DataState.Loading
|
||||
repositoryScope.launch(exceptionHandler) {
|
||||
val streams = mutableListOf<InputStream>()
|
||||
val entries = mutableListOf<SatEntry>()
|
||||
val jobs = urls.associateWith { url -> async { remoteSource.getDataStream(url) } }
|
||||
jobs.mapValues { job -> job.value.await() }.forEach { result ->
|
||||
result.value?.let { stream ->
|
||||
when {
|
||||
result.key.contains("=csv", true) -> {
|
||||
val orbitalData = dataParser.parseCSVStream(stream)
|
||||
entries.addAll(orbitalData.map { data -> SatEntry(data) })
|
||||
}
|
||||
result.key.contains(".zip", true) -> {
|
||||
streams.add(ZipInputStream(stream).apply { nextEntry })
|
||||
}
|
||||
else -> streams.add(stream)
|
||||
}
|
||||
}
|
||||
}
|
||||
streams.forEach { stream -> entries.addAll(importSatellites(stream)) }
|
||||
entrySource.insertEntries(entries)
|
||||
}
|
||||
repositoryScope.launch(exceptionHandler) {
|
||||
remoteSource.getDataStream(remoteSource.radioApi)?.let { stream ->
|
||||
radioSource.insertRadios(dataParser.parseJSONStream(stream))
|
||||
_updateState.value = DataState.Success(0L)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateFromWebNew() {
|
||||
override fun updateFromWeb() {
|
||||
_updateState.value = DataState.Loading
|
||||
repositoryScope.launch(exceptionHandler) {
|
||||
val importedEntries = mutableListOf<SatEntry>()
|
||||
@@ -106,7 +75,7 @@ class DataRepository(
|
||||
jobsMap.mapValues { job -> job.value.await() }.forEach { entry ->
|
||||
entry.value?.let { stream ->
|
||||
when (val type = entry.key) {
|
||||
"AMSAT" -> {
|
||||
"AMSAT", "R4UAB" -> {
|
||||
// parse tle stream
|
||||
val satellites = importSatellites(stream)
|
||||
val catnums = satellites.map { it.data.catnum }
|
||||
|
||||
Reference in new issue
Block a user