This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name" : "Arch Enemy", | |
"country_of_origin": "Sweden", | |
"location": "Halmstad, Halland", | |
"status": "Active", | |
"formed_in": 1995, | |
"logo_url": "https://www.metal-archives.com/images/1/0/10_logo.jpg?5127", | |
"image_url": "https://www.metal-archives.com/images/1/0/10_photo.jpeg?3322", | |
"years_active": "1995-present", | |
"genre": ["Melodic Death Metal"], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
suspend fun thumbnailExtract(videoFile: File): Bitmap { | |
return suspendCancellableCoroutine<Bitmap> { | |
try { | |
val retriever = MediaMetadataRetriever().apply { | |
setDataSource(videoFile.absolutePath) | |
} | |
val width = | |
retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
suspend fun <T> Context.getContent( | |
uri: Uri, | |
projection: Array<String>? = null, | |
selection: String? = null, | |
selectionArgs: Array<String>? = null, | |
sortOrder: String? = null, | |
builder: Cursor.() -> T | |
): List<T> = suspendCancellableCoroutine { cont -> | |
val cancellationSignal = CancellationSignal() | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DownloadWorker( | |
private val context: Context, | |
params: WorkerParameters | |
) : CoroutineWorker(context, params) { | |
private val urlString: String? = inputData.getString("urlFile") | |
private val fileName: String? = inputData.getString("fileName") | |
override suspend fun doWork(): Result { | |
urlString ?: return Result.failure() |