[Tag Editor] Removed warnings

This commit is contained in:
Prathamesh More 2021-11-28 10:46:56 +05:30
parent dab5ddb838
commit aefd52c12e

View file

@ -49,9 +49,9 @@ class TagWriter {
) )
} }
suspend fun writeTagsToFiles(context: Context, info: AudioTagInfo) = suspend fun writeTagsToFiles(context: Context, info: AudioTagInfo) {
withContext(Dispatchers.IO) { withContext(Dispatchers.IO) {
try { kotlin.runCatching {
var artwork: Artwork? = null var artwork: Artwork? = null
var albumArtFile: File? = null var albumArtFile: File? = null
if (info.artworkInfo?.artwork != null) { if (info.artworkInfo?.artwork != null) {
@ -113,18 +113,18 @@ class TagWriter {
deleteAlbumArt(context, info.artworkInfo!!.albumId) deleteAlbumArt(context, info.artworkInfo!!.albumId)
} }
scan(context, info.filePaths) scan(context, info.filePaths)
} catch (e: Exception) { }.onFailure {
e.printStackTrace() it.printStackTrace()
scan(context, null) }
} }
} }
@RequiresApi(Build.VERSION_CODES.R) @RequiresApi(Build.VERSION_CODES.R)
suspend fun writeTagsToFilesR(context: Context, info: AudioTagInfo) = suspend fun writeTagsToFilesR(context: Context, info: AudioTagInfo): List<File> =
withContext(Dispatchers.IO) { withContext(Dispatchers.IO) {
val cacheFiles = mutableListOf<File>() val cacheFiles = mutableListOf<File>()
try { kotlin.runCatching {
var artwork: Artwork? = null var artwork: Artwork? = null
var albumArtFile: File? = null var albumArtFile: File? = null
if (info.artworkInfo?.artwork != null) { if (info.artworkInfo?.artwork != null) {
@ -193,11 +193,10 @@ class TagWriter {
} else if (deletedArtwork) { } else if (deletedArtwork) {
deleteAlbumArt(context, info.artworkInfo!!.albumId) deleteAlbumArt(context, info.artworkInfo!!.albumId)
} }
cacheFiles }.onFailure {
} catch (e: Exception) { it.printStackTrace()
e.printStackTrace()
listOf()
} }
cacheFiles
} }
} }
} }