Small fixes
This commit is contained in:
parent
594e94eea7
commit
d08a38ea1c
|
@ -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,
|
||||||
|
|
|
@ -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.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue