Skip to content

Commit

Permalink
Added timeout to album art download
Browse files Browse the repository at this point in the history
  • Loading branch information
dturner committed Feb 9, 2021
1 parent f488c5f commit e1af19b
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import android.os.ParcelFileDescriptor
import com.bumptech.glide.Glide
import java.io.File
import java.io.FileNotFoundException
import java.util.concurrent.TimeUnit

class AlbumArtContentProvider : ContentProvider() {

Expand Down Expand Up @@ -57,7 +58,7 @@ class AlbumArtContentProvider : ContentProvider() {
.asFile()
.load(remoteUri)
.submit()
.get()
.get(DOWNLOAD_TIMEOUT_SECONDS, TimeUnit.SECONDS)

// Rename the file Glide created to match our own scheme.
cacheFile.renameTo(file)
Expand Down Expand Up @@ -89,3 +90,5 @@ class AlbumArtContentProvider : ContentProvider() {
override fun getType(uri: Uri): String? = null

}

const val DOWNLOAD_TIMEOUT_SECONDS = 30L

0 comments on commit e1af19b

Please sign in to comment.