Skip to content

Commit

Permalink
Feature/fix add shows with release groups (#5749)
Browse files Browse the repository at this point in the history
* Convert whitelist/blacklist to list, when a single release group is passed.

* Enable release groups when anime already checked.

* Add changelog.

* Fixed release groups ui bug.

* Fix clients.torrent.password not updated.

* Fix saving default values for subtitles, scene and season folders.

* Fix saving sabnzbd password and apiKey.
Fix saving nzbget password

* Fix saving plex server config.

* Fix brace.

* Fix plex server label.
  • Loading branch information
p0psicles authored and medariox committed Nov 20, 2018
1 parent 9df39ec commit 7b98964
Show file tree
Hide file tree
Showing 13 changed files with 92 additions and 74 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#### Fixes
- Fixed ImportError when using Download Station client ([#5748](https://github.com/pymedusa/Medusa/pull/5748))
- Fixed Torrent Search path option not being saved ([#5736](https://github.com/pymedusa/Medusa/pull/5736))
- Fixed adding anime release group when adding show ([#5749](https://github.com/pymedusa/Medusa/pull/5749))

-----

Expand Down
10 changes: 7 additions & 3 deletions medusa/server/api/v2/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ class ConfigHandler(BaseRequestHandler):
'notifiers.plex.server.updateLibrary': BooleanField(app, 'PLEX_UPDATE_LIBRARY'),
'notifiers.plex.server.host': ListField(app, 'PLEX_SERVER_HOST'),
'notifiers.plex.server.https': BooleanField(app, 'PLEX_SERVER_HTTPS'),
'notifiers.plex.server.username': StringField(app, 'PLEX_SERVER_HOST'),
'notifiers.plex.server.password': StringField(app, 'PLEX_SERVER_HOST'),
'notifiers.plex.server.token': StringField(app, 'PLEX_SERVER_HOST'),
'notifiers.plex.server.username': StringField(app, 'PLEX_SERVER_USERNAME'),
'notifiers.plex.server.password': StringField(app, 'PLEX_SERVER_PASSWORD'),
'notifiers.plex.server.token': StringField(app, 'PLEX_SERVER_TOKEN'),
'notifiers.plex.client.enabled': BooleanField(app, 'USE_PLEX_CLIENT'),
'notifiers.plex.client.username': StringField(app, 'PLEX_CLIENT_USERNAME'),
'notifiers.plex.client.host': ListField(app, 'PLEX_CLIENT_HOST'),
Expand Down Expand Up @@ -932,6 +932,7 @@ def data_clients():
section_data['torrents']['seedLocation'] = app.TORRENT_SEED_LOCATION
section_data['torrents']['seedTime'] = app.TORRENT_SEED_TIME
section_data['torrents']['username'] = app.TORRENT_USERNAME
section_data['torrents']['password'] = app.TORRENT_PASSWORD
section_data['torrents']['verifySSL'] = bool(app.TORRENT_VERIFY_CERT)

section_data['nzb'] = NonEmptyDict()
Expand All @@ -947,6 +948,7 @@ def data_clients():
section_data['nzb']['nzbget']['priority'] = int(app.NZBGET_PRIORITY)
section_data['nzb']['nzbget']['useHttps'] = bool(app.NZBGET_USE_HTTPS)
section_data['nzb']['nzbget']['username'] = app.NZBGET_USERNAME
section_data['nzb']['nzbget']['password'] = app.NZBGET_PASSWORD

section_data['nzb']['sabnzbd'] = NonEmptyDict()
section_data['nzb']['sabnzbd']['category'] = app.SAB_CATEGORY
Expand All @@ -956,5 +958,7 @@ def data_clients():
section_data['nzb']['sabnzbd']['forced'] = bool(app.SAB_FORCED)
section_data['nzb']['sabnzbd']['host'] = app.SAB_HOST
section_data['nzb']['sabnzbd']['username'] = app.SAB_USERNAME
section_data['nzb']['sabnzbd']['password'] = app.SAB_PASSWORD
section_data['nzb']['sabnzbd']['apiKey'] = app.SAB_APIKEY

return section_data
4 changes: 4 additions & 0 deletions medusa/server/web/home/add_shows.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,12 @@ def finishAddShow():
subtitles = config.checkbox_to_value(subtitles)

if whitelist:
if not isinstance(whitelist, list):
whitelist = [whitelist]
whitelist = short_group_names(whitelist)
if blacklist:
if not isinstance(blacklist, list):
blacklist = [blacklist]
blacklist = short_group_names(blacklist)

if not allowed_qualities:
Expand Down
18 changes: 12 additions & 6 deletions themes-default/slim/src/components/add-show-options.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</div>

<div v-if="subtitlesEnabled" id="use-subtitles">
<config-toggle-slider label="Subtitles" id="subtitles" :value="defaultConfig.subtitles" @input="selectedSubtitleEnabled = $event"
<config-toggle-slider label="Subtitles" id="subtitles" :value="selectedSubtitleEnabled" @input="selectedSubtitleEnabled = $event"
:explanations="['Download subtitles for this show?']">
</config-toggle-slider>
</div>
Expand Down Expand Up @@ -44,12 +44,12 @@
</div>
</div>

<config-toggle-slider label="Season Folders" id="season_folders" :value="defaultConfig.seasonFolders || namingForceFolders" :disabled="namingForceFolders"
<config-toggle-slider label="Season Folders" id="season_folders" :value="selectedSeasonFoldersEnabled" :disabled="namingForceFolders"
:explanations="['Group episodes by season folders?']" @input="selectedSeasonFoldersEnabled = $event">
</config-toggle-slider>

<config-toggle-slider v-if="enableAnimeOptions" label="Anime" id="anime"
:explanations="['Is this show an Anime?']" :value="defaultConfig.anime" @input="selectedAnimeEnabled = $event">
:explanations="['Is this show an Anime?']" :value="selectedAnimeEnabled" @input="selectedAnimeEnabled = $event">
</config-toggle-slider>

<div v-if="enableAnimeOptions && selectedAnimeEnabled" class="form-group">
Expand All @@ -65,7 +65,7 @@
</div>
</div>

<config-toggle-slider label="Scene Numbering" id="scene" :value="defaultConfig.scene"
<config-toggle-slider label="Scene Numbering" id="scene" :value="selectedSceneEnabled"
:explanations="['Is this show scene numbered?']" @input="selectedSceneEnabled = $event">
</config-toggle-slider>

Expand Down Expand Up @@ -138,7 +138,8 @@ export default {
vm.selectedStatusAfter,
vm.selectedSubtitleEnabled,
vm.selectedSeasonFoldersEnabled,
vm.selectedSceneEnabled
vm.selectedSceneEnabled,
vm.selectedAnimeEnabled
].join(), () => {
this.update();
});
Expand Down Expand Up @@ -264,7 +265,6 @@ export default {
enableAnimeOptions,
defaultConfig,
namingForceFolders,
selectedStatus,
selectedStatusAfter,
combinedQualities,
Expand Down Expand Up @@ -305,6 +305,7 @@ export default {
},
release: {
handler() {
this.$emit('refresh');
this.update();
},
deep: true,
Expand All @@ -327,8 +328,13 @@ export default {
this.update();
},
defaultConfig(newValue) {
const { namingForceFolders } = this;
this.selectedStatus = newValue.status;
this.selectedStatusAfter = newValue.statusAfter;
this.selectedSubtitleEnabled = newValue.subtitles;
this.selectedAnimeEnabled = newValue.anime;
this.selectedSeasonFoldersEnabled = newValue.seasonFolders || namingForceFolders;
this.selectedSceneEnabled = newValue.scene;
}
}
};
Expand Down
6 changes: 3 additions & 3 deletions themes-default/slim/src/store/modules/clients.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const state = {
seedLocation: null,
seedTime: null,
username: null,
password: null,
verifySSL: null,
testStatus: 'Click below to test'
},
Expand All @@ -31,7 +32,7 @@ const state = {
priority: null,
useHttps: null,
username: null,
testStatus: 'Click below to test'
password: null
},
sabnzbd: {
category: null,
Expand All @@ -42,8 +43,7 @@ const state = {
host: null,
username: null,
password: null,
apiKey: null,
testStatus: 'Click below to test'
apiKey: null
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion themes-default/slim/views/config_notifications.mako
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ window.app = new Vue({
<fieldset class="component-group-list">
<!-- All form components here for plex media server -->
<config-toggle-slider v-model="notifiers.plex.server.enabled" label="Enable" id="use_plex_server" :explanations="['Send KODI commands?']" @change="save()" ></config-toggle-slider>
<config-toggle-slider v-model="notifiers.plex.server.enabled" label="Enable" id="use_plex_server" :explanations="['Send Plex server notifications?']" @change="save()" ></config-toggle-slider>
<div v-show="notifiers.plex.server.enabled" id="content-use-plex-server"> <!-- show based on notifiers.plex.server.enabled -->
<config-textbox v-model="notifiers.plex.server.token" label="Plex Media Server Auth Token" id="plex_server_token" @change="save()" >
Expand Down
35 changes: 18 additions & 17 deletions themes-default/slim/views/config_search.mako
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,13 @@ window.app = new Vue({
},
nzbget: {
title: 'NZBget',
description: 'NZBget RPC host name and port number (not NZBgetweb!) (e.g. localhost:6789)'
description: 'NZBget RPC host name and port number (not NZBgetweb!) (e.g. localhost:6789)',
testStatus: 'Click below to test'
},
sabnzbd: {
title: 'SABnzbd',
description: 'URL to your SABnzbd server (e.g. http://localhost:8080/)'
description: 'URL to your SABnzbd server (e.g. http://localhost:8080/)',
testStatus: 'Click below to test'
}
},
},
Expand All @@ -139,8 +141,8 @@ window.app = new Vue({
seedLocation: null,
seedTime: null,
username: null,
verifySSL: null,
testStatus: 'Click below to test',
password: null,
verifySSL: null
},
nzb: {
enabled: null,
Expand All @@ -154,7 +156,7 @@ window.app = new Vue({
priority: null,
useHttps: null,
username: null,
testStatus: 'Click below to test',
password: null
},
sabnzbd: {
category: null,
Expand All @@ -165,8 +167,7 @@ window.app = new Vue({
host: null,
username: null,
password: null,
apiKey: null,
testStatus: 'Click below to test',
apiKey: null
}
}
},
Expand Down Expand Up @@ -298,7 +299,7 @@ window.app = new Vue({
const { torrents } = clients;
const { method, host, username, password } = torrents;
this.clients.torrents.testStatus = MEDUSA.config.loading;
this.clientsConfig.torrent[method].testStatus = MEDUSA.config.loading;
const params = {
torrent_method: method,
Expand All @@ -308,15 +309,15 @@ window.app = new Vue({
};
const resp = await apiRoute.get('home/testTorrent', { params });
this.clients.torrents.testStatus = resp.data;
this.clientsConfig.torrent[method].testStatus = resp.data;
},
async testNzbget() {
const { clients } = this;
const { nzb } = clients;
const { nzbget } = nzb;
const { nzbget, method } = nzb;
const { host, username, password, useHttps } = nzbget;
this.clients.nzb.nzbget.testStatus = MEDUSA.config.loading;
this.clientsConfig.nzb.nzbget.testStatus = MEDUSA.config.loading;
const params = {
host,
Expand All @@ -326,15 +327,15 @@ window.app = new Vue({
};
const resp = await apiRoute.get('home/testNZBget', { params });
this.clients.nzb.nzbget.testStatus = resp.data;
this.clientsConfig.nzb.nzbget.testStatus = resp.data;
},
async testSabnzbd() {
const { clients } = this;
const { nzb } = clients;
const { sabnzbd } = nzb;
const { host, username, password, apiKey } = sabnzbd;
this.clients.nzb.sabnzbd.testStatus = MEDUSA.config.loading;
this.clientsConfig.nzb.sabnzbd.testStatus = MEDUSA.config.loading;
const params = {
host,
Expand All @@ -344,7 +345,7 @@ window.app = new Vue({
};
const resp = await apiRoute.get('home/testSABnzbd', { params });
this.clients.nzb.sabnzbd.testStatus = resp.data;
this.clientsConfig.nzb.sabnzbd.testStatus = resp.data;
},
save() {
const { $store, clients, configLoaded, search } = this;
Expand Down Expand Up @@ -586,7 +587,7 @@ window.app = new Vue({
<config-textbox v-model="clients.nzb.sabnzbd.categoryAnimeBacklog" label="Use SABnzbd category for anime (backlog episodes)" id="sab_category_anime_backlog" :explanations="['add anime downloads of old episodes to this category (e.g. anime)']"></config-textbox>
<config-toggle-slider v-model="clients.nzb.sabnzbd.forced" label="Use forced priority" id="sab_forced" :explanations="['enable to change priority from HIGH to FORCED']" ></config-toggle-slider>
<div class="testNotification" v-show="clients.nzb.sabnzbd.testStatus" v-html="clients.nzb.sabnzbd.testStatus"></div>
<div class="testNotification" v-show="clients.nzb.sabnzbd.testStatus" v-html="clientsConfig.nzb.sabnzbd.testStatus"></div>
<input @click="testSabnzbd" type="button" value="Test SABnzbd" class="btn-medusa test-button"/>
<input type="submit" class="btn-medusa config_submitter" value="Save Changes" /><br>
</div>
Expand Down Expand Up @@ -615,7 +616,7 @@ window.app = new Vue({
<span>priority for daily snatches (no backlog)</span>
</config-template>
<div class="testNotification" v-show="clients.nzb.nzbget.testStatus" v-html="clients.nzb.nzbget.testStatus"></div>
<div class="testNotification" v-show="clientsConfig.nzb.nzbget.testStatus" v-html="clientsConfig.nzb.nzbget.testStatus"></div>
<input @click="testNzbget" type="button" value="Test NZBget" class="btn-medusa test-button"/>
<input type="submit" class="btn-medusa config_submitter" value="Save Changes" /><br>
</div><!-- /nzb.enabled //-->
Expand Down Expand Up @@ -737,7 +738,7 @@ window.app = new Vue({
<config-toggle-slider v-show="clients.torrents.method === 'transmission'" v-model="clients.torrents.highBandwidth" label="Allow high bandwidth" id="torrent_high_bandwidth" :explanations="['use high bandwidth allocation if priority is high']"></config-toggle-slider>
<div class="testNotification" v-show="clients.torrents.testStatus" v-html="clients.torrents.testStatus"></div>
<div class="testNotification" v-show="clientsConfig.torrent[clients.torrents.method].testStatus" v-html="clientsConfig.torrent[clients.torrents.method].testStatus"></div>
<input @click="testTorrentClient" type="button" value="Test Connection" class="btn-medusa test-button"/>
<input type="submit" class="btn-medusa config_submitter" value="Save Changes" /><br>
</div>
Expand Down
Loading

0 comments on commit 7b98964

Please sign in to comment.