Added TYTD Support
This commit is contained in:
parent
64679ca1ce
commit
7cda82b68a
|
@ -24,7 +24,8 @@ export default Vue.extend({
|
||||||
askForDownloadPath: false,
|
askForDownloadPath: false,
|
||||||
downloadBehaviorValues: [
|
downloadBehaviorValues: [
|
||||||
'download',
|
'download',
|
||||||
'open'
|
'open',
|
||||||
|
'add'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -32,10 +33,17 @@ export default Vue.extend({
|
||||||
downloadPath: function() {
|
downloadPath: function() {
|
||||||
return this.$store.getters.getDownloadFolderPath
|
return this.$store.getters.getDownloadFolderPath
|
||||||
},
|
},
|
||||||
|
serverUrlPlaceholder: function() {
|
||||||
|
return this.$t('Settings.Download Settings.Server Url')
|
||||||
|
},
|
||||||
|
serverUrl: function() {
|
||||||
|
return this.$store.getters.getServerUrl
|
||||||
|
},
|
||||||
downloadBehaviorNames: function () {
|
downloadBehaviorNames: function () {
|
||||||
return [
|
return [
|
||||||
this.$t('Settings.Download Settings.Download in app'),
|
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 () {
|
downloadBehavior: function () {
|
||||||
|
@ -63,7 +71,8 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
...mapActions([
|
...mapActions([
|
||||||
'updateDownloadFolderPath',
|
'updateDownloadFolderPath',
|
||||||
'updateDownloadBehavior'
|
'updateDownloadBehavior',
|
||||||
|
'updateServerUrl'
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,20 @@
|
||||||
@change="updateDownloadBehavior"
|
@change="updateDownloadBehavior"
|
||||||
/>
|
/>
|
||||||
</ft-flex-box>
|
</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
|
<ft-flex-box
|
||||||
v-if="downloadBehavior === 'download'"
|
v-if="downloadBehavior === 'download'"
|
||||||
class="settingsFlexStart500px"
|
class="settingsFlexStart500px"
|
||||||
|
|
|
@ -8,6 +8,7 @@ import FtShareButton from '../ft-share-button/ft-share-button.vue'
|
||||||
import { MAIN_PROFILE_ID } from '../../../constants'
|
import { MAIN_PROFILE_ID } from '../../../constants'
|
||||||
import i18n from '../../i18n/index'
|
import i18n from '../../i18n/index'
|
||||||
import { openExternalLink, showToast } from '../../helpers/utils'
|
import { openExternalLink, showToast } from '../../helpers/utils'
|
||||||
|
import { Notification } from 'electron'
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
name: 'WatchVideoInfo',
|
name: 'WatchVideoInfo',
|
||||||
|
@ -179,17 +180,41 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
downloadLinkOptions: function () {
|
downloadLinkOptions: function () {
|
||||||
return this.downloadLinks.map((download) => {
|
if (this.downloadBehavior === 'add') {
|
||||||
return {
|
return [
|
||||||
label: download.label,
|
{
|
||||||
value: download.url
|
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 () {
|
downloadBehavior: function () {
|
||||||
return this.$store.getters.getDownloadBehavior
|
return this.$store.getters.getDownloadBehavior
|
||||||
},
|
},
|
||||||
|
getServerUrl: function() {
|
||||||
|
return this.$store.getters.getServerUrl
|
||||||
|
},
|
||||||
|
|
||||||
formatTypeOptions: function () {
|
formatTypeOptions: function () {
|
||||||
return [
|
return [
|
||||||
|
@ -427,11 +452,12 @@ export default Vue.extend({
|
||||||
const selectedDownloadLinkOption = this.downloadLinkOptions[index]
|
const selectedDownloadLinkOption = this.downloadLinkOptions[index]
|
||||||
const url = selectedDownloadLinkOption.value
|
const url = selectedDownloadLinkOption.value
|
||||||
const linkName = selectedDownloadLinkOption.label
|
const linkName = selectedDownloadLinkOption.label
|
||||||
const extension = this.grabExtensionFromUrl(linkName)
|
|
||||||
|
|
||||||
if (this.downloadBehavior === 'open') {
|
if (this.downloadBehavior === 'open') {
|
||||||
openExternalLink(url)
|
openExternalLink(url)
|
||||||
|
} else if (this.downloadBehavior === 'add') {
|
||||||
|
fetch(url).then(e => e.text()).then(new Notification('Added to downloader'))
|
||||||
} else {
|
} else {
|
||||||
|
const extension = this.grabExtensionFromUrl(linkName)
|
||||||
this.downloadMedia({
|
this.downloadMedia({
|
||||||
url: url,
|
url: url,
|
||||||
title: this.title,
|
title: this.title,
|
||||||
|
|
|
@ -264,6 +264,7 @@ const state = {
|
||||||
videoPlaybackRateMouseScroll: false,
|
videoPlaybackRateMouseScroll: false,
|
||||||
videoPlaybackRateInterval: 0.25,
|
videoPlaybackRateInterval: 0.25,
|
||||||
downloadFolderPath: '',
|
downloadFolderPath: '',
|
||||||
|
serverUrl: 'http://127.0.0.1:3252/',
|
||||||
downloadBehavior: 'download',
|
downloadBehavior: 'download',
|
||||||
enableScreenshot: false,
|
enableScreenshot: false,
|
||||||
screenshotFormat: 'png',
|
screenshotFormat: 'png',
|
||||||
|
|
|
@ -406,6 +406,7 @@ Settings:
|
||||||
Download Behavior: Download Behavior
|
Download Behavior: Download Behavior
|
||||||
Download in app: Download in app
|
Download in app: Download in app
|
||||||
Open in web browser: Open in web browser
|
Open in web browser: Open in web browser
|
||||||
|
Add To TYTD: Add To TYTD
|
||||||
Experimental Settings:
|
Experimental Settings:
|
||||||
Experimental Settings: 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!
|
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