use simpler FahrplanLecture for importing favorites

This commit is contained in:
Felix 2020-01-03 17:30:50 +01:00
parent cca71e499d
commit c14df7e961
2 changed files with 13 additions and 38 deletions

View file

@ -1,35 +1,10 @@
package de.nicidienase.chaosflix.common.eventimport package de.nicidienase.chaosflix.common.eventimport
import com.google.gson.annotations.SerializedName
data class FahrplanLecture( data class FahrplanLecture(
var lectureId: String = "", var lectureId: String? = null,
var title: String, var title: String,
var subtitle: String = "", var subtitle: String? = null,
var day: Int = 0,
var room: String? = null,
var slug: String? = null,
var url: String? = null,
var startTime: Int = 0,
var duration: Int = 0,
var speakers: String? = null,
var track: String? = null,
var type: String? = null,
var lang: String? = null,
@SerializedName("abstractt")
var abstract: String = "",
var description: String = "",
var relStartTime: Int = 0,
var links: String? = null, var links: String? = null,
var date: String? = null, var track: String? = null,
var dateUTC: Long = 0, var description: String? = null
var roomIndex: Int = 0, )
var recordingLicense: String? = null,
var recordingOptOut: Boolean = false
) {
companion object {
val RECORDING_OPTOUT_ON = true
val RECORDING_OPTOUT_OFF = false
}
}

View file

@ -60,16 +60,16 @@ class FavoritesImportViewModel(
} }
} }
private suspend fun updateConferences(conference: String) { private suspend fun updateConferences(conferenceName: String) {
val fahrplanMappings = mappingService.getFahrplanMappings() val fahrplanMappings = mappingService.getFahrplanMappings()
Log.d(TAG, "Updating conferences for $conference, mappings=$fahrplanMappings") Log.d(TAG, "Updating conferences for $conferenceName, mappings=$fahrplanMappings")
if (fahrplanMappings.containsKey(conference)) { if (fahrplanMappings.containsKey(conferenceName)) {
fahrplanMappings[conference]?.let { keys -> fahrplanMappings[conferenceName]?.let { keys ->
for (conf in keys) { for (conferenceAcronym in keys) {
conferenceDao.findConferenceByAcronymSync(conf)?.let { conf -> conferenceDao.findConferenceByAcronymSync(conferenceAcronym)?.let { conference ->
val list = val list =
downloader.updateEventsForConferencesSuspending(conf) downloader.updateEventsForConferencesSuspending(conference)
Log.d(TAG, "updated ${conf.acronym}, got ${list.size} events") Log.d(TAG, "updated ${conference.acronym}, got ${list.size} events")
} }
} }
} }