Added TYTD Support
This commit is contained in:
parent
64679ca1ce
commit
7cda82b68a
|
@ -24,7 +24,8 @@ export default Vue.extend({
|
|||
askForDownloadPath: false,
|
||||
downloadBehaviorValues: [
|
||||
'download',
|
||||
'open'
|
||||
'open',
|
||||
'add'
|
||||
]
|
||||
}
|
||||
},
|
||||
|
@ -32,10 +33,17 @@ export default Vue.extend({
|
|||
downloadPath: function() {
|
||||
return this.$store.getters.getDownloadFolderPath
|
||||
},
|
||||
serverUrlPlaceholder: function() {
|
||||
return this.$t('Settings.Download Settings.Server Url')
|
||||
},
|
||||
serverUrl: function() {
|
||||
return this.$store.getters.getServerUrl
|
||||
},
|
||||
downloadBehaviorNames: function () {
|
||||
return [
|
||||
this.$t('Settings.Download Settings.Download in app'),
|
||||
this.$t('Settings.Download Settings.Open in web browser')
|
||||
this.$t('Settings.Download Settings.Open in web browser'),
|
||||
this.$t('Settings.Download Settings.Add To TYTD')
|
||||
]
|
||||
},
|
||||
downloadBehavior: function () {
|
||||
|
@ -63,7 +71,8 @@ export default Vue.extend({
|
|||
},
|
||||
...mapActions([
|
||||
'updateDownloadFolderPath',
|
||||
'updateDownloadBehavior'
|
||||
'updateDownloadBehavior',
|
||||
'updateServerUrl'
|
||||
])
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,20 @@
|
|||
@change="updateDownloadBehavior"
|
||||
/>
|
||||
</ft-flex-box>
|
||||
<ft-flex-box
|
||||
v-if="downloadBehavior === 'add'"
|
||||
class="settingsFlexStart500px"
|
||||
>
|
||||
<ft-input
|
||||
class="folderDisplay"
|
||||
:placeholder="serverUrlPlaceholder"
|
||||
:show-action-button="false"
|
||||
:show-label="false"
|
||||
:disabled="false"
|
||||
:value="serverUrl"
|
||||
@change="updateServerUrl"
|
||||
/>
|
||||
</ft-flex-box>
|
||||
<ft-flex-box
|
||||
v-if="downloadBehavior === 'download'"
|
||||
class="settingsFlexStart500px"
|
||||
|
|
|
@ -8,6 +8,7 @@ import FtShareButton from '../ft-share-button/ft-share-button.vue'
|
|||
import { MAIN_PROFILE_ID } from '../../../constants'
|
||||
import i18n from '../../i18n/index'
|
||||
import { openExternalLink, showToast } from '../../helpers/utils'
|
||||
import { Notification } from 'electron'
|
||||
|
||||
export default Vue.extend({
|
||||
name: 'WatchVideoInfo',
|
||||
|
@ -179,17 +180,41 @@ export default Vue.extend({
|
|||
},
|
||||
|
||||
downloadLinkOptions: function () {
|
||||
if (this.downloadBehavior === 'add') {
|
||||
return [
|
||||
{
|
||||
label: 'SD',
|
||||
value: new URL(`api/AddVideoRes/1/${this.id}`, this.getServerUrl).toString()
|
||||
},
|
||||
{
|
||||
label: 'HD',
|
||||
value: new URL(`api/AddVideoRes/0/${this.id}`, this.getServerUrl).toString()
|
||||
},
|
||||
{
|
||||
label: 'Audio Only',
|
||||
value: new URL(`api/AddVideoRes/2/${this.id}`, this.getServerUrl).toString()
|
||||
},
|
||||
{
|
||||
label: 'Video Only',
|
||||
value: new URL(`api/AddVideoRes/1/${this.id}`, this.getServerUrl).toString()
|
||||
}
|
||||
]
|
||||
} else {
|
||||
return this.downloadLinks.map((download) => {
|
||||
return {
|
||||
label: download.label,
|
||||
value: download.url
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
downloadBehavior: function () {
|
||||
return this.$store.getters.getDownloadBehavior
|
||||
},
|
||||
getServerUrl: function() {
|
||||
return this.$store.getters.getServerUrl
|
||||
},
|
||||
|
||||
formatTypeOptions: function () {
|
||||
return [
|
||||
|
@ -427,11 +452,12 @@ export default Vue.extend({
|
|||
const selectedDownloadLinkOption = this.downloadLinkOptions[index]
|
||||
const url = selectedDownloadLinkOption.value
|
||||
const linkName = selectedDownloadLinkOption.label
|
||||
const extension = this.grabExtensionFromUrl(linkName)
|
||||
|
||||
if (this.downloadBehavior === 'open') {
|
||||
openExternalLink(url)
|
||||
} else if (this.downloadBehavior === 'add') {
|
||||
fetch(url).then(e => e.text()).then(new Notification('Added to downloader'))
|
||||
} else {
|
||||
const extension = this.grabExtensionFromUrl(linkName)
|
||||
this.downloadMedia({
|
||||
url: url,
|
||||
title: this.title,
|
||||
|
|
|
@ -264,6 +264,7 @@ const state = {
|
|||
videoPlaybackRateMouseScroll: false,
|
||||
videoPlaybackRateInterval: 0.25,
|
||||
downloadFolderPath: '',
|
||||
serverUrl: 'http://127.0.0.1:3252/',
|
||||
downloadBehavior: 'download',
|
||||
enableScreenshot: false,
|
||||
screenshotFormat: 'png',
|
||||
|
|
|
@ -406,6 +406,7 @@ Settings:
|
|||
Download Behavior: Download Behavior
|
||||
Download in app: Download in app
|
||||
Open in web browser: Open in web browser
|
||||
Add To TYTD: Add To TYTD
|
||||
Experimental Settings:
|
||||
Experimental Settings: Experimental Settings
|
||||
Warning: These settings are experimental, they make cause crashes while enabled. Making backups is highly recommended. Use at your own risk!
|
||||
|
|
Loading…
Reference in New Issue