pull/1112/head
deniscerri 5 months ago
parent a08a2e06a2
commit 637dd2cadf
No known key found for this signature in database
GPG Key ID: 95C43D517D830350

@ -658,11 +658,12 @@ class DownloadViewModel(private val application: Application) : AndroidViewModel
repository.deleteProcessing()
processingItems.emit(true)
try {
itemIDs.forEach {
itemIDs.forEachIndexed { index, it ->
val item = repository.getItemByID(it)
if (processingItemsJob?.isCancelled == true) throw CancellationException()
if (!deleteExisting) item.id = 0
item.status = DownloadRepository.Status.Processing.toString()
item.rowNumber = index + 1
repository.update(item)
}
processingItems.emit(false)
@ -680,10 +681,11 @@ class DownloadViewModel(private val application: Application) : AndroidViewModel
processingItems.emit(true)
try {
val toInsert = mutableListOf<DownloadItem>()
itemIDs.forEach {
itemIDs.forEachIndexed { index, it ->
val item = historyRepository.getItem(it)
val downloadItem = createDownloadItemFromHistory(item)
downloadItem.status = DownloadRepository.Status.Processing.toString()
downloadItem.rowNumber = index + 1
if (processingItemsJob?.isCancelled == true) {
throw CancellationException()
@ -717,13 +719,14 @@ class DownloadViewModel(private val application: Application) : AndroidViewModel
processingItems.emit(true)
try {
val toInsert = mutableListOf<DownloadItem>()
itemIDs.forEach { id ->
val item = resultRepository.getItemByID(id) ?: return@forEach
itemIDs.forEachIndexed { index, id ->
val item = resultRepository.getItemByID(id) ?: return@forEachIndexed
val preferredType = getDownloadType(url = item.url).toString()
val downloadItem = createDownloadItemFromResult(result = item, givenType = DownloadType.valueOf(
preferredType
))
downloadItem.status = DownloadRepository.Status.Processing.toString()
downloadItem.rowNumber = index + 1
if (processingItemsJob?.isCancelled == true) {
throw CancellationException()

@ -17,7 +17,6 @@ import android.widget.LinearLayout
import android.widget.TextView
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.content.res.AppCompatResources
import androidx.core.content.edit
import androidx.core.view.isVisible
import androidx.core.view.setPadding
import androidx.fragment.app.Fragment

@ -867,7 +867,7 @@ class YTDLPUtil(private val context: Context, private val commandTemplateDao: Co
downloadItem.rowNumber.apply {
if (this > 0) {
request.addOption("--autonumber-start", this.toString())
request.addOption("--parse-metadata", " ${downloadItem.rowNumber}: %(rownumber)s")
}
}

@ -919,6 +919,7 @@
<string-array name="filename_templates">
<item>%(uploader)s___(string): Full name of the video uploader)</item>
<item>%(title)s___(string): Video title)</item>
<item>%(rownumber)s___(numeric): Row number of item, when downloading multiple items at once)</item>
<item>%(id)s___(string): Video identifier)</item>
<item>%(playlist_index,playlist_autonumber&amp;{}. |)s%(title)s___(string): Title with playlist index in front if its available</item>
<item>%(fulltitle)s___(string): Video title ignoring live timestamp and generic title)</item>

Loading…
Cancel
Save