stuff
This commit is contained in:
parent
2630954136
commit
f26f440df4
3 changed files with 9 additions and 8 deletions
|
|
@ -76,7 +76,7 @@ interface DownloadDao {
|
||||||
@Query("DELETE FROM downloads WHERE status='Processing' AND id=:id")
|
@Query("DELETE FROM downloads WHERE status='Processing' AND id=:id")
|
||||||
suspend fun deleteSingleProcessing(id: Long)
|
suspend fun deleteSingleProcessing(id: Long)
|
||||||
|
|
||||||
@Update(onConflict = OnConflictStrategy.REPLACE)
|
@Upsert
|
||||||
suspend fun update(item: DownloadItem)
|
suspend fun update(item: DownloadItem)
|
||||||
|
|
||||||
@Query("SELECT * FROM downloads ORDER BY id DESC LIMIT 1")
|
@Query("SELECT * FROM downloads ORDER BY id DESC LIMIT 1")
|
||||||
|
|
|
||||||
|
|
@ -76,14 +76,15 @@ class CommandTemplateViewModel(private val application: Application) : AndroidVi
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun importFromClipboard() : Int {
|
suspend fun importFromClipboard() : Int {
|
||||||
val allTemplates = repository.getAll()
|
|
||||||
val allShortcuts = repository.getAllShortCuts()
|
|
||||||
var count = 0
|
var count = 0
|
||||||
val clipboard = withContext(Dispatchers.Main){
|
|
||||||
application.getSystemService(CLIPBOARD_SERVICE) as ClipboardManager
|
|
||||||
}
|
|
||||||
val clip = clipboard.primaryClip!!.getItemAt(0).text.toString()
|
|
||||||
try{
|
try{
|
||||||
|
val allTemplates = repository.getAll()
|
||||||
|
val allShortcuts = repository.getAllShortCuts()
|
||||||
|
val clipboard = withContext(Dispatchers.Main){
|
||||||
|
application.getSystemService(CLIPBOARD_SERVICE) as ClipboardManager
|
||||||
|
}
|
||||||
|
val clip = clipboard.primaryClip!!.getItemAt(0).text.toString()
|
||||||
|
|
||||||
jsonFormat.decodeFromString<CommandTemplateExport>(clip).run {
|
jsonFormat.decodeFromString<CommandTemplateExport>(clip).run {
|
||||||
templates.filterNot {t ->
|
templates.filterNot {t ->
|
||||||
allTemplates.find { it.content == t.content} != null
|
allTemplates.find { it.content == t.content} != null
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,7 @@ class DownloadWorker(
|
||||||
request.addOption("--parse-metadata", "%(album,title)s:%(meta_album)s")
|
request.addOption("--parse-metadata", "%(album,title)s:%(meta_album)s")
|
||||||
}
|
}
|
||||||
|
|
||||||
request.addOption("--audio-quality", sharedPreferences.getInt("audio_quality", 5))
|
request.addOption("--audio-quality", sharedPreferences.getInt("audio_quality", 0))
|
||||||
|
|
||||||
if (downloadItem.audioPreferences.splitByChapters && downloadItem.downloadSections.isBlank()){
|
if (downloadItem.audioPreferences.splitByChapters && downloadItem.downloadSections.isBlank()){
|
||||||
request.addOption("--split-chapters")
|
request.addOption("--split-chapters")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue