added max concurrent downloads selector
This commit is contained in:
parent
d06ca3b13e
commit
3eb53f690e
@ -18,6 +18,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col items-center p-3 bg-[#11111189] rounded-xl select-none">
|
||||
<div class="text-sm mb-2">Max Concurrent Downloads</div>
|
||||
<input v-model="selectedMaxDownloads" type="number" class="bg-[#5c5b5b] w-full focus:outline-none px-3 py-2 rounded-xl text-sm text-center cursor-pointer" />
|
||||
</div>
|
||||
<div class="flex flex-col items-center p-3 bg-[#11111189] rounded-xl select-none">
|
||||
<div class="text-sm mb-2"> Default Dubs </div>
|
||||
<div class="w-full bg-[#636363] rounded-xl grid grid-cols-10 gap-1 p-1 z-10">
|
||||
@ -115,6 +119,7 @@ const locales = ref<Array<{ locale: string; name: string }>>([
|
||||
const selectedVideoQuality = ref<number>()
|
||||
const selectedAudioQuality = ref<number>()
|
||||
const selectedVideoFormat = ref<number>()
|
||||
const selectedMaxDownloads = ref<number>()
|
||||
|
||||
const toggleDub = (lang: { locale: string; name: string }) => {
|
||||
const index = dubLocales.value.findIndex((i) => i.locale === lang.locale)
|
||||
@ -218,6 +223,18 @@ const selectOutputFormat = () => {
|
||||
}
|
||||
}
|
||||
|
||||
watch(selectedMaxDownloads, () => {
|
||||
if (selectedMaxDownloads.value !== undefined && selectedMaxDownloads.value !== null) {
|
||||
selectMaxDownloads()
|
||||
}
|
||||
})
|
||||
|
||||
const selectMaxDownloads = () => {
|
||||
if (process.client) {
|
||||
;(window as any).myAPI.setDefaultMaxDownloads(selectedMaxDownloads.value)
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
;(window as any).myAPI.getArray('defdubarray').then((result: any) => {
|
||||
dubLocales.value = JSON.parse(result)
|
||||
@ -234,6 +251,9 @@ onMounted(() => {
|
||||
;(window as any).myAPI.getDefaultOutputFormat().then((result: any) => {
|
||||
selectedVideoFormat.value = result
|
||||
})
|
||||
;(window as any).myAPI.getDefaultMaxDownloads().then((result: any) => {
|
||||
selectedMaxDownloads.value = result
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
|
@ -269,14 +269,21 @@ export async function getDownloading(id: number) {
|
||||
|
||||
// Define IsDownloading Count
|
||||
var isDownloading: number = 0
|
||||
var maxDownloading: number = 3
|
||||
|
||||
// Check Playlist every 2 seconds for new items
|
||||
async function checkPlaylists() {
|
||||
try {
|
||||
const eps = await Playlist.findAll({ where: { status: 'waiting' } })
|
||||
|
||||
const maxd = await settings.get('DefaultMaxDownloads') as number
|
||||
|
||||
if (maxd !== undefined && maxd !== null) {
|
||||
maxDownloading = maxd
|
||||
}
|
||||
|
||||
for (const e of eps) {
|
||||
if (isDownloading < 3 && e.dataValues.status === 'waiting') {
|
||||
if (isDownloading < maxDownloading && e.dataValues.status === 'waiting') {
|
||||
updatePlaylistByID(e.dataValues.id, 'preparing')
|
||||
isDownloading++
|
||||
server.logger.log({
|
||||
@ -536,7 +543,12 @@ export async function downloadCrunchyrollPlaylist(
|
||||
|
||||
var downloadDir: string = downloadPath
|
||||
|
||||
var isSeasonFolderActive = (await settings.get('seasonFolderActive')) as string
|
||||
var isSeasonFolderActive = (await settings.get('seasonFolderActive')) as boolean
|
||||
|
||||
if (isSeasonFolderActive === undefined || isSeasonFolderActive === null) {
|
||||
await settings.set('seasonFolderActive', true)
|
||||
isSeasonFolderActive = true
|
||||
}
|
||||
|
||||
if (isSeasonFolderActive) {
|
||||
var seasonFolderNaming = (await settings.get('SeasonTemp')) as string
|
||||
|
@ -406,6 +406,24 @@ ipcMain.handle('dialog:getDefaultOutputFormatTemplate', async (events) => {
|
||||
return seTP
|
||||
})
|
||||
|
||||
ipcMain.handle('dialog:setDefaultMaxDownloadsTemplate', async (events, max: number) => {
|
||||
await settings.set('DefaultMaxDownloads', max)
|
||||
|
||||
return max
|
||||
})
|
||||
|
||||
ipcMain.handle('dialog:getDefaultMaxDownloadsTemplate', async (events) => {
|
||||
const seTP = await settings.get('DefaultMaxDownloads')
|
||||
|
||||
if (!seTP) {
|
||||
await settings.set('DefaultMaxDownloads', 3)
|
||||
|
||||
return 3
|
||||
}
|
||||
|
||||
return seTP
|
||||
})
|
||||
|
||||
const openWindows = new Map()
|
||||
|
||||
// Open New Window
|
||||
|
@ -32,5 +32,7 @@ contextBridge.exposeInMainWorld('myAPI', {
|
||||
setDefaultOutputFormat: (format: string) => ipcRenderer.invoke('dialog:setDefaultOutputFormatTemplate', format),
|
||||
getDefaultOutputFormat: () => ipcRenderer.invoke('dialog:getDefaultOutputFormatTemplate'),
|
||||
setDefaultCrunchyrollLanguage: (lang: string) => ipcRenderer.invoke('dialog:setDefaultCrunchyrollLanguageTemplate', lang),
|
||||
getDefaultCrunchyrollLanguage: () => ipcRenderer.invoke('dialog:getDefaultCrunchyrollLanguageTemplate')
|
||||
getDefaultCrunchyrollLanguage: () => ipcRenderer.invoke('dialog:getDefaultCrunchyrollLanguageTemplate'),
|
||||
setDefaultMaxDownloads: (max: number) => ipcRenderer.invoke('dialog:setDefaultMaxDownloadsTemplate', max),
|
||||
getDefaultMaxDownloads: () => ipcRenderer.invoke('dialog:getDefaultMaxDownloadsTemplate')
|
||||
})
|
||||
|
Reference in New Issue
Block a user