Add individual quality select

This commit is contained in:
the1812 2020-03-17 10:20:31 +08:00
parent bd94d0993f
commit 8ed58e8c20
10 changed files with 43 additions and 18 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -70,8 +70,8 @@
"download-live-records.min.js": "7EF26D22D22EB75A6B27B78B3DB0E2ADE6004587C11B0C2893CF1CCB3B6FAB6F",
"download-subtitle.min.js": "4B99A00FEEA40C6D577AC8BD8DFFD34D91B75E150C7848B965D58B0096DF762C",
"download-video.min.css": "8B68CCDADACC3D84BC1AC661C3E46CD3EBEB657CC89F244B05D756B0ECF4069C",
"download-video.min.html": "5B665D22C2D863B4194BE6A07B79A576B86E8F4FF7465705C451C124ECCB12C0",
"download-video.min.js": "F0E58A09F9EA3E26312E73FB2E435BB3F87D86D1CC5E5502C009939825A56CEC",
"download-video.min.html": "D5542056B00352B37B9BAF05D823832B477FD10E8F6C179A02A4B1ADBB6F0761",
"download-video.min.js": "A4356AF7EF2EE2298377673D134656D9D989E268002128B0D2B8B2AB47BE44B7",
"download-video-package.min.js": "B10FF11DE7DFBACEC38F195B8E836511E527215B5E177CB1D223D14F30EB1435",
"dpi-img.vue.min.js": "11DF7577B754D8C01E8331E4FDAC9494E72523099845A0D6B0D897849CD841D6",
"expand-danmaku.min.js": "B21658C40085AEA8DC49652AE62EB8610BB2EBEAF7A9C9AF69EF3B11E08EEC8D",

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -45,7 +45,9 @@
</div>
<div class="option-item">
清晰度
<v-dropdown @change="formatChange(true)" :items="qualityModel.items" :value.sync="qualityModel.value">
<v-dropdown v-if="selectedTab.name !== 'manual'" @change="formatChange(true)" :items="qualityModel.items" :value.sync="qualityModel.value">
</v-dropdown>
<v-dropdown v-else :items="manualQualityModel.items" :value.sync="manualQualityModel.value">
</v-dropdown>
</div>
<div class="option-item">

View File

@ -161,6 +161,16 @@ class VideoFormat {
return await VideoFormat.filterFormats(VideoFormat.parseFormats(data))
}
}
const allFormats: VideoFormat[] = [
new VideoFormat(120, '4K', '超清 4K'),
new VideoFormat(116, '1080P60', '高清 1080P60'),
new VideoFormat(112, '1080P+', '高清 1080P+'),
new VideoFormat(80, '1080P', '高清 1080P'),
new VideoFormat(74, '720P60', '高清 720P60'),
new VideoFormat(64, '720P', '高清 720P'),
new VideoFormat(32, '480P', '清晰 480P'),
new VideoFormat(15, '320P', '流畅 320P'),
]
class VideoDownloader {
format: VideoFormat
fragments: VideoDownloaderFragment[]
@ -661,6 +671,10 @@ async function loadPanel() {
value: selectedFormat!.displayName,
items: formats.map(f => f.displayName)
},
manualQualityModel: {
value: allFormats[1].displayName,
items: allFormats.map(f => f.displayName),
},
danmakuModel: {
value: settings.downloadVideoDefaultDanmaku as DanmakuOption,
items: ['无', 'XML', 'ASS'] as DanmakuOption[]
@ -771,7 +785,12 @@ async function loadPanel() {
}
},
getFormat() {
const format = formats.find(f => f.displayName === this.qualityModel.value)
let format: VideoFormat | undefined
if (this.selectedTab.name === 'manual') {
format = allFormats.find(f => f.displayName === this.manualQualityModel.value)
} else {
format = formats.find(f => f.displayName === this.qualityModel.value)
}
if (!format) {
console.error(`No format found. model value = ${this.qualityModel.value}`)
return null
@ -943,6 +962,10 @@ async function loadPanel() {
}
},
async exportManualData(type: ExportType) {
if (this.manualInputItems.length === 0) {
Toast.info('请至少输入一个有效的视频链接!', '手动输入', 3000)
return
}
const { ManualInputBatch } = await import('./batch-download')
const batch = new ManualInputBatch({
api: await (new Video().getApiGenerator(this.dash)),
@ -950,7 +973,7 @@ async function loadPanel() {
})
batch.items = this.manualInputItems
if (this.danmakuModel.value !== '无') {
const danmakuToast = Toast.info('下载弹幕中...', '批量导出')
const danmakuToast = Toast.info('下载弹幕中...', '手动输入')
const pack = new DownloadVideoPackage()
try {
if (this.danmakuModel.value === 'XML') {
@ -975,7 +998,7 @@ async function loadPanel() {
danmakuToast.dismiss()
}
}
const toast = Toast.info('获取链接中...', '批量导出')
const toast = Toast.info('获取链接中...', '手动输入')
try {
switch (type) {
default: