-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'preview-features' of https://github.com/the1812/Bilibil…
…i-Evolved into preview-features
- Loading branch information
Showing
14 changed files
with
520 additions
and
73 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,7 @@ | |
"durl", | ||
"epid", | ||
"esbuild", | ||
"ffmetadata", | ||
"flac", | ||
"Fullscreen", | ||
"githubusercontent", | ||
|
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<template> | ||
<div class="download-video-config-section"> | ||
<div class="download-video-config-item"> | ||
<div>元数据:</div> | ||
<VDropdown v-model="type" :items="items"> | ||
<template #item="{ item }"> | ||
{{ item }} | ||
</template> | ||
</VDropdown> | ||
</div> | ||
</div> | ||
</template> | ||
<script lang="ts"> | ||
import { VDropdown } from '@/ui' | ||
import { getComponentSettings } from '@/core/settings' | ||
import { MetadataType } from './metadata' | ||
interface Options { | ||
metadataType: MetadataType | '无' | ||
} | ||
const options = getComponentSettings('downloadVideo').options as Options | ||
export default Vue.extend({ | ||
components: { | ||
VDropdown, | ||
}, | ||
data() { | ||
return { | ||
type: options.metadataType ?? '无', | ||
items: ['无', 'ffmetadata', 'ogm'], | ||
} | ||
}, | ||
computed: { | ||
enabled() { | ||
return this.type !== '无' | ||
}, | ||
}, | ||
watch: { | ||
type(value: MetadataType) { | ||
options.metadataType = value | ||
}, | ||
}, | ||
}) | ||
</script> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<template> | ||
<div class="multiple-widgets"> | ||
<DefaultWidget | ||
ref="button" | ||
:disabled="disabled" | ||
name="保存视频元数据" | ||
icon="mdi-download" | ||
@click="run('ffmetadata')" | ||
></DefaultWidget> | ||
<DefaultWidget | ||
:disabled="disabled" | ||
name="保存视频章节" | ||
icon="mdi-download" | ||
@click="run('ogm')" | ||
></DefaultWidget> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { DefaultWidget } from '@/ui' | ||
import { logError } from '@/core/utils/log' | ||
import { DownloadPackage } from '@/core/download' | ||
import { getFriendlyTitle } from '@/core/utils/title' | ||
import { MetadataType, generateByType } from './metadata' | ||
export default Vue.extend({ | ||
components: { | ||
DefaultWidget, | ||
}, | ||
data() { | ||
return { | ||
disabled: false, | ||
} | ||
}, | ||
methods: { | ||
async run(type: MetadataType) { | ||
try { | ||
this.disabled = true | ||
DownloadPackage.single(`${getFriendlyTitle(true)}.${type}.txt`, await generateByType(type)) | ||
} catch (error) { | ||
logError(error) | ||
} finally { | ||
this.disabled = false | ||
} | ||
}, | ||
}, | ||
}) | ||
</script> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { defineComponentMetadata } from '@/components/define' | ||
import { PackageEntry } from '@/core/download' | ||
import { hasVideo } from '@/core/spin-query' | ||
import { Toast } from '@/core/toast' | ||
import { videoUrls } from '@/core/utils/urls' | ||
import { DownloadVideoAssets } from '../download/types' | ||
import { generateByType, MetadataType } from './metadata' | ||
|
||
export const title = '保存视频元数据' | ||
export const name = 'saveVideoMetadata' | ||
|
||
const author = [ | ||
{ | ||
name: 'WakelessSloth56', | ||
link: 'https://github.com/WakelessSloth56', | ||
}, | ||
{ | ||
name: 'LainIO24', | ||
link: 'https://github.com/LainIO24', | ||
}, | ||
] | ||
|
||
export const component = defineComponentMetadata({ | ||
name, | ||
displayName: title, | ||
description: '保存视频元数据(标题、描述、UP、章节等)', | ||
author, | ||
tags: [componentsTags.video], | ||
entry: none, | ||
urlInclude: videoUrls, | ||
widget: { | ||
condition: hasVideo, | ||
component: () => import('./SaveMetadata.vue').then(m => m.default), | ||
}, | ||
plugin: { | ||
displayName: `下载视频 - ${title}支持`, | ||
author, | ||
setup: ({ addData }) => { | ||
addData('downloadVideo.assets', async (assets: DownloadVideoAssets[]) => { | ||
assets.push({ | ||
name, | ||
displayName: title, | ||
getAssets: async ( | ||
infos, | ||
instance: { | ||
type: MetadataType | ||
enabled: boolean | ||
}, | ||
) => { | ||
const { type, enabled } = instance | ||
if (enabled) { | ||
const toast = Toast.info('获取视频元数据中...', title) | ||
const result: PackageEntry[] = [] | ||
for (const info of infos) { | ||
result.push({ | ||
name: `${info.input.title}.${type}.txt`, | ||
data: await generateByType(type, info.input.aid, info.input.cid), | ||
options: {}, | ||
}) | ||
} | ||
toast.message = '完成!' | ||
toast.duration = 1000 | ||
return result | ||
} | ||
return [] | ||
}, | ||
component: () => import('./Plugin.vue').then(m => m.default), | ||
}) | ||
}) | ||
}, | ||
}, | ||
}) |
Oops, something went wrong.