Small fixes

This commit is contained in:
tzugen 2021-08-28 11:29:39 +02:00
parent 594e94eea7
commit d08a38ea1c
No known key found for this signature in database
GPG Key ID: 61E9C34BC10EC930
2 changed files with 8 additions and 5 deletions

View File

@ -20,6 +20,10 @@ import timber.log.Timber
/** /**
* This class is responsible for maintaining the playlist and downloading * This class is responsible for maintaining the playlist and downloading
* its items from the network to the filesystem. * its items from the network to the filesystem.
*
* TODO: Implement LiveData
* TODO: Move away from managing the queue with scheduled checks, instead use callbacks when
* Downloads are finished
*/ */
class Downloader( class Downloader(
private val shufflePlayBuffer: ShufflePlayBuffer, private val shufflePlayBuffer: ShufflePlayBuffer,

View File

@ -204,7 +204,6 @@ class DownloadFile(
return String.format("DownloadFile (%s)", song) return String.format("DownloadFile (%s)", song)
} }
@Suppress("TooGenericExceptionCaught")
private inner class DownloadTask : CancellableTask() { private inner class DownloadTask : CancellableTask() {
override fun execute() { override fun execute() {
var inputStream: InputStream? = null var inputStream: InputStream? = null
@ -292,7 +291,7 @@ class DownloadFile(
Util.renameFile(partialFile, completeFile) Util.renameFile(partialFile, completeFile)
} }
} }
} catch (e: Exception) { } catch (all: Exception) {
Util.close(outputStream) Util.close(outputStream)
Util.delete(completeFile) Util.delete(completeFile)
Util.delete(saveFile) Util.delete(saveFile)
@ -301,7 +300,7 @@ class DownloadFile(
if (retryCount > 0) { if (retryCount > 0) {
--retryCount --retryCount
} }
Timber.w(e, "Failed to download '%s'.", song) Timber.w(all, "Failed to download '%s'.", song)
} }
} finally { } finally {
Util.close(inputStream) Util.close(inputStream)
@ -339,8 +338,8 @@ class DownloadFile(
// Download the largest size that we can display in the UI // Download the largest size that we can display in the UI
imageLoaderProvider.getImageLoader().cacheCoverArt(song) imageLoaderProvider.getImageLoader().cacheCoverArt(song)
} }
} catch (e: Exception) { } catch (all: Exception) {
Timber.e(e, "Failed to get cover art.") Timber.e(all, "Failed to get cover art.")
} }
} }