Improvements on AddModal (#45)

* Add skip hash check option and autoTMM

* Allow to select category when adding a new torrent

Co-authored-by: muertocaloh <muertocaloh@protonmail.com>
Co-authored-by: Daan <dw.daanwijns@gmail.com>
This commit is contained in:
muertocaloh 2020-10-15 20:42:25 +02:00 committed by GitHub
parent 2cdbc5b2a4
commit 3d51d6fab6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 6 deletions

2
package-lock.json generated
View file

@ -1,6 +1,6 @@
{ {
"name": "vuetorrent", "name": "vuetorrent",
"version": "0.3.5", "version": "0.3.6",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View file

@ -1,6 +1,6 @@
{ {
"name": "vuetorrent", "name": "vuetorrent",
"version": "0.3.6", "version": "0.3.7",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",

View file

@ -56,12 +56,25 @@
</v-col> </v-col>
</v-row> </v-row>
<v-combobox
v-model="category"
:items="availableCategories"
clearable
label="Category"
prepend-icon="tag"
></v-combobox>
<v-text-field <v-text-field
v-model="directory" v-model="directory"
:placeholder="savepath" :placeholder="savepath"
label="Download Directory" label="Download Directory"
prepend-icon="folder" prepend-icon="folder"
></v-text-field> ></v-text-field>
<v-checkbox
v-model="skip_checking"
label="Skip hash check"
></v-checkbox>
</v-container> </v-container>
</v-form> </v-form>
</v-card-text> </v-card-text>
@ -93,7 +106,9 @@ export default {
data() { data() {
return { return {
files: [], files: [],
category: null,
directory: '', directory: '',
skip_checking: false,
inputRules: [ inputRules: [
v => v =>
v.indexOf('magnet') > -1 || v.indexOf('magnet') > -1 ||
@ -110,10 +125,15 @@ export default {
submit() { submit() {
if (this.files.length || this.url) { if (this.files.length || this.url) {
let torrents = [] let torrents = []
let params = { urls: null } let params = { urls: null, autoTMM: true }
if (this.files.length) torrents.push(...this.files) if (this.files.length) torrents.push(...this.files)
if (this.url) params.urls = this.url if (this.url) params.urls = this.url
if (this.directory) params.savepath = this.directory if (this.category) params.category = this.category
if (this.directory) {
params.savepath = this.directory
params.autoTMM = false
}
if (this.skip_checking) params.skip_checking = this.skip_checking
qbit.addTorrents(params, torrents) qbit.addTorrents(params, torrents)
@ -125,11 +145,13 @@ export default {
resetForm() { resetForm() {
this.url = null this.url = null
this.files = [] this.files = []
this.category = null
this.directory = null this.directory = null
this.skip_checking = null
} }
}, },
computed: { computed: {
...mapGetters(['getSettings']), ...mapGetters(['getSettings', 'getCategories']),
validFile() { validFile() {
return this.Files.length > 0 return this.Files.length > 0
}, },
@ -137,8 +159,21 @@ export default {
return this.$vuetify.breakpoint.xsOnly return this.$vuetify.breakpoint.xsOnly
}, },
savepath() { savepath() {
return this.getSettings().savePath let savePath = this.getSettings().save_path
if (this.category) {
savePath += this.category
let category_path = this.getCategories()[this.category].savePath
if (category_path) savePath = category_path
} }
return savePath
},
availableCategories() {
return Object.keys(this.getCategories())
}
},
created() {
this.$store.commit('FETCH_SETTINGS')
this.$store.commit('FETCH_CATEGORIES')
} }
} }
</script> </script>