Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to add custom newznab or torznab catIds through UI. #9857

Merged
merged 7 commits into from
Sep 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

#### Improvements
- Adds the options to manage/searches page to clean automatic added scene exceptions from cache. ([9859](https://github.com/pymedusa/Medusa/pull/9859))
- Add ability to add custom newznab/torznab category id's through UI. ([9857](https://github.com/pymedusa/Medusa/pull/9857))

#### Fixes
- Fix prowlarr provider id's being obfuscated in logs because of a bad log level. ([9857](https://github.com/pymedusa/Medusa/pull/9857))

-----

Expand Down
16 changes: 6 additions & 10 deletions medusa/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1092,9 +1092,6 @@ def initialize(self, console_logging=True):
app.TORZNAB_PROVIDERS = check_setting_list(app.CFG, 'Torznab', 'torznab_providers')
app.torznab_providers_list = TorznabProvider.get_providers_list(app.TORZNAB_PROVIDERS)

app.PROWLARR_PROVIDERS = check_setting_list(app.CFG, 'Prowlarr', 'providers')
# TODO implement ProwlarrProvider.get_providers_list(app.PROWLARR_PROVIDERS)

all_providers = providers.sorted_provider_list()

# dynamically load provider settings
Expand Down Expand Up @@ -1140,21 +1137,21 @@ def initialize(self, console_logging=True):
load_provider_setting(app.CFG, provider, 'string', 'title_tag', '')

if isinstance(provider, TorznabProvider):
load_provider_setting(app.CFG, provider, 'string', 'url', '', censor_log='low')
load_provider_setting(app.CFG, provider, 'string', 'url', '', censor_log='normal')
load_provider_setting(app.CFG, provider, 'list', 'cat_ids', '', split_value=',')
load_provider_setting(app.CFG, provider, 'list', 'cap_tv_search', '', split_value=',')
load_provider_setting(app.CFG, provider, 'string', 'manager', '', censor_log='low')
load_provider_setting(app.CFG, provider, 'string', 'id_manager', '', censor_log='low')
load_provider_setting(app.CFG, provider, 'string', 'manager', '')
load_provider_setting(app.CFG, provider, 'string', 'id_manager', '')

if isinstance(provider, NewznabProvider):
# non configurable
if not provider.default:
load_provider_setting(app.CFG, provider, 'string', 'url', '', censor_log='low')
load_provider_setting(app.CFG, provider, 'string', 'url', '', censor_log='normal')
load_provider_setting(app.CFG, provider, 'bool', 'needs_auth', 1)
# configurable
load_provider_setting(app.CFG, provider, 'list', 'cat_ids', '', split_value=',')
load_provider_setting(app.CFG, provider, 'string', 'manager', '', censor_log='low')
load_provider_setting(app.CFG, provider, 'string', 'id_manager', '', censor_log='low')
load_provider_setting(app.CFG, provider, 'string', 'manager', '')
load_provider_setting(app.CFG, provider, 'string', 'id_manager', '')

if not os.path.isfile(app.CONFIG_FILE):
logger.debug(u'Unable to find {config!r}, all settings will be default!', config=app.CONFIG_FILE)
Expand Down Expand Up @@ -2047,7 +2044,6 @@ def save_config():
new_config['Torznab']['torznab_providers'] = app.TORZNAB_PROVIDERS

new_config['Prowlarr'] = {}
new_config['Prowlarr']['providers'] = app.PROWLARR_PROVIDERS
new_config['Prowlarr']['url'] = app.PROWLARR_URL
new_config['Prowlarr']['apikey'] = app.PROWLARR_APIKEY

Expand Down
1 change: 0 additions & 1 deletion medusa/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,6 @@ def __init__(self):
# Prowlarr section.
self.PROWLARR_URL = ''
self.PROWLARR_APIKEY = ''
self.PROWLARR_PROVIDERS = []

self.TORRENTRSS_PROVIDERS = []

Expand Down
12 changes: 10 additions & 2 deletions themes-default/slim/src/components/config-providers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,7 @@ export default {
return provider.providers;
},
set(providers) {
const { save } = this;
this.provider.providers = providers;
save();
}
},
enabledProviders() {
Expand Down Expand Up @@ -255,7 +253,17 @@ export default {
);
} finally {
this.saving = false;
this.reOrderProviders();
}
},
/**
* Re-order providers. Make sure enabled providers are on top.
*/
reOrderProviders() {
this.providerPriorities = [
...this.providerPriorities.filter(provider => provider.config.enabled),
...this.providerPriorities.filter(provider => !provider.config.enabled)
];
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,16 @@
:options="availableCategories"
label="id"
track-by="id"
:taggable="true"
tag-placeholder="Add this as new cat id" placeholder="Search or add a cat id"
@tag="addTag"
@input="currentProvider.config.catIds = $event.map(cat => cat.id)"
>
<template slot="option" slot-scope="props">
<span><strong>{{props.option.id}}</strong> ({{props.option.name}})</span>
<span v-if="props.option.isTag"><strong>{{props.option.label}}</strong></span>
<span v-else><strong>{{props.option.id}}</strong> ({{props.option.name}})</span>
</template>

</multiselect>
</config-template>

Expand Down Expand Up @@ -165,6 +170,17 @@ export default {
'Error'
);
}
},
/**
* Add custom cat id's.
* @param {string} newTag category id.
*/
addTag(newTag) {
if (!Number(newTag) || Number(newTag) < 1) {
return;
}
const tag = { id: newTag, name: newTag };
this.availableCategories.push(tag);
}
},
computed: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@
:options="availableCategories"
label="id"
track-by="id"
:taggable="true"
tag-placeholder="Add this as new cat id" placeholder="Search or add a cat id"
@tag="addTag"
@input="currentProvider.config.catIds = $event.map(cat => cat.id)"
>
<template slot="option" slot-scope="props">
<span><strong>{{props.option.id}}</strong> ({{props.option.name}})</span>
<span v-if="props.option.isTag"><strong>{{props.option.label}}</strong></span>
<span v-else><strong>{{props.option.id}}</strong> ({{props.option.name}})</span>
</template>
</multiselect>
</config-template>
Expand Down Expand Up @@ -164,6 +168,17 @@ export default {
'Error'
);
}
},
/**
* Add custom cat id's.
* @param {string} newTag category id.
*/
addTag(newTag) {
if (!Number(newTag) || Number(newTag) < 1) {
return;
}
const tag = { id: newTag, name: newTag };
this.availableCategories.push(tag);
}
},
computed: {
Expand Down
10 changes: 5 additions & 5 deletions themes/dark/assets/js/medusa-runtime.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions themes/light/assets/js/medusa-runtime.js

Large diffs are not rendered by default.