File tree Expand file tree Collapse file tree
app/src/main/java/org/schabi/newpipe/local/subscription/workers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,20 +37,19 @@ class SubscriptionImportWorker(
3737
3838 override suspend fun doWork (): Result {
3939 val mode = inputData.getInt(KEY_MODE , CHANNEL_URL_MODE )
40- val extractor = NewPipe .getService(inputData.getInt(KEY_SERVICE_ID , NO_SERVICE_ID ))
41- .subscriptionExtractor
42- val value = inputData.getString(KEY_VALUE ) ? : " "
40+ val serviceId = inputData.getInt(KEY_SERVICE_ID , NO_SERVICE_ID )
41+ val value = inputData.getString(KEY_VALUE )!!
4342
4443 val subscriptions = withContext(Dispatchers .IO ) {
4544 if (mode == CHANNEL_URL_MODE ) {
46- extractor
45+ NewPipe .getService(serviceId).subscriptionExtractor
4746 .fromChannelUrl(value)
4847 .map { SubscriptionItem (it.serviceId, it.url, it.name) }
4948 } else {
5049 applicationContext.contentResolver.openInputStream(value.toUri())?.use {
5150 if (mode == INPUT_STREAM_MODE ) {
5251 val contentType = MimeTypeMap .getFileExtensionFromUrl(value).ifEmpty { DEFAULT_MIME }
53- extractor
52+ NewPipe .getService(serviceId).subscriptionExtractor
5453 .fromInputStream(it, contentType)
5554 .map { SubscriptionItem (it.serviceId, it.url, it.name) }
5655 } else {
You can’t perform that action at this time.
0 commit comments