Allow import/restore playlist with missing sources

This commit is contained in:
Kelvin 2023-10-17 21:23:02 +02:00
parent 182c88fc9e
commit 73321ee362
3 changed files with 8 additions and 0 deletions

View file

@ -607,6 +607,7 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
return;
};
};
val name = when(type) {
"Playlist" -> recon.split("\n").filter { !it.startsWith(ManagedStore.RECONSTRUCTION_HEADER_OPERATOR) }.firstOrNull() ?: type;
else -> type

View file

@ -5,6 +5,7 @@ import android.net.Uri
import androidx.core.content.FileProvider
import com.futo.platformplayer.R
import com.futo.platformplayer.api.media.PlatformID
import com.futo.platformplayer.api.media.exceptions.NoPlatformClientException
import com.futo.platformplayer.api.media.models.channels.IPlatformChannel
import com.futo.platformplayer.api.media.models.contents.IPlatformContent
import com.futo.platformplayer.api.media.models.video.IPlatformVideo
@ -265,6 +266,11 @@ class StatePlaylists {
builder.messages.add("${name}:[${it}] is no longer available");
return@map null;
}
catch(ex: NoPlatformClientException) {
//TODO: Propagate this to dialog, and then back, allowing users to enable plugins...
builder.messages.add("No source enabled for [${it}]");
return@map null;
}
catch(ex: Throwable) {
throw ReconstructionException(name, "${name}:[${it}] ${ex.message}", ex);
}

View file

@ -118,6 +118,7 @@ class ManagedStore<T>{
val builder = ReconstructStore.Builder();
for (recon in items) {
onProgress?.invoke(0, total);
//Retry once
for (i in 0 .. 1) {
try {