Skip to content

Commit 7daab93

Browse files
authored
Vueify config-postprocessing (#4259)
* Moved over files from search templates pr. * Renamed some of the postProcessing naming variabls in api/v2/config.py * Added full name-pattern support to postProcessing. * Add covert to namespace main.mako. * Update examples when switching multi ep style. * make the 'enabled' property for name-pattern default true. * Remove the saved-message component. As that's not used anymore. Prob merge conflict. * Moved convert method to inc_defs.mako * Moved all checkboxes for the post processing tab to the toggle-button component. Moved mako python to apiv2 / vue. Started bootstrapping the postprocessing page. * Migrated the rest of the post-processing tab. * Move config items to DataGenerator class. * Extend config items. * Sync light theme * Move convert method from main.mako to inc_defs.mako. * Update name-pattern. Need to overwrite from develop. * Further implement/vueify the first tab 'post processing'. * Enable post-processing toggle button. Will show/hide the rest of the options. * Use the file-browser components button for post processing dir * use toggle-buttons components for checkboxes. * use select-list components for for comma separated inputs * Gulp sync * Update package.json * cleanup the responsiveness of the name-pattern, episode naming tab. * Added max-input350 class, to use as a replacement in allot of inputs where we are currently using .input-350, setting a fixed width. * Update store.js for postProcessing. * Add postProcessing fields to config patching. * Fix mako convert method, after rebasing. * Update config_postProcessing.mako, use store values. * Add csv-enabled flag * Add watch instead of the created method. !! Experimenting!! * Add csv-enabled flag, to start with the csv list. * Fix updating select-list list-items. Had to use v-show instead of v-if. Tnx. Shark. * Added apiv2 route /api/v2/config/metadata * Fix a number of postProcessing apiv2 fields. Mostly: * remove duplicates. * Double assignments * Fix Type casting. * Fix store.js, add support for metadata section. * Remove watch on local fields. These where triggering the onChange $emit. Now the emit is only happening on the local @input event. * Fix updating and storing of the naming tab. * Naming buttons/sliders are now updated after mount. * PostProcessing data from server is now copied to a local object. Which is also used to mutate the store. Retrieve metadataProviders, for the third tab using the metadata section. Still WIP. * iteritems is not used anymore. * Patch metadata using the class MetadataStructureField. * Remove watches from name-pattern.mako Not used anymore. * Fixed metadata tab. * Removed newline. * Remove stray print. * Remove duplicate keys. * Move name-pattern.mako to VueLoader. * Sync themes for previous commits. * Remove unused mako python imports. * Add name-pattern.vue. * Sync changes after resolving merge conflicts, from up-merging develop. * Fix some more rebase conflicts. Synced maps. * Removed duplicate key logDir. Sync. * Fix name-pattern.vue component. * fix issue * Added initial (not-working) ava snapshot test. * Fixed duplicate key in config.py. * Replace double quotes. * Fix name-pattern.spec.js snapshot test. Mock checkNaming and testNaming. * sync themes * Use multiEpStrings from state instead of mako templating. * Update api description for postProcessing and config sections. * Replaced multiEpStrings mako with apiv2 values. * Updated default values for the config in store.js. * * Fix flake warnings. * Remove name-pattern.vue from the xo linting exclude list. * Fix xo vue linting for name-pattern.vue * Add default values for multiEp and multiEpStrings to store.js * Fix showing the preset examples instead of the preset patterns. * Updated CHANGELOG.md. * Fixed ava snaptest test for name-pattern.vue * Fixed indentation on some jsDocs. * Fixed travis import order. * Fix duplicate key in dredd test. * Remove old `.js.map` files * Remove unused `anidb-release-group-ui` import * editShow: Remove unused imports `select-list` is imported in `main.mako` * Fix xo linting. * Remove `convert(obj)` from `inc_defs.mako` * Revert change to `DataGenerator.sections` * Revert unrelated change the recommended shows * Revert unnecessary changes * Lint * Fix missing data dir * Trim "savePostProcessing", add "to do" * Correct JSDoc closing * NamePattern: Increase timeout * Fix absolute number types descriptions * * move .then to end of line. * use Promise.resolve * Sync themes. * Use computed for isMulti, as per review. * Wait for all the properties (data send from parent) before starting to make api calls. * Update the snapshots. * Remove unused method. * Fix lint warning. * Add component-group-desc-legacy to keep the min width of 200px. For pages that have not been made responsive yet. * Separated first tab of config_postProcessing into scheduled and general post processing settings. * Only show/hide scheduled pp settings with the "scheduled postprocessor" toggle. * used the same bs classes for all the tabs. * Reduced the min-height for component-group class to 100px * Made tab metadata responsive. * Fixed type (while / will). * Hide the name-pattern legend, when changing from custom pattern to preset. * Fix pytest to 3.6.4.
1 parent eb52192 commit 7daab93

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2294
-5233
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
## Unreleased
22

3+
#### Fixes
4+
5+
#### New Features
6+
7+
#### Improvements
8+
- Converted /config/postProcessing to a Vue component ([#4259](https://github.com/pymedusa/Medusa/pull/4259))
9+
310
-----
411

512
## 0.2.8 (2018-07-28)

medusa/server/api/v2/config.py

+1
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ def data_main():
278278
section_data['locale'] = '.'.join([text_type(loc or 'Unknown') for loc in app.LOCALE])
279279
section_data['localUser'] = app.OS_USER or 'Unknown'
280280
section_data['programDir'] = app.PROG_DIR
281+
section_data['dataDir'] = app.DATA_DIR
281282
section_data['configFile'] = app.CONFIG_FILE
282283
section_data['dbPath'] = db.DBConnection().path
283284
section_data['cacheDir'] = app.CACHE_DIR

medusa/server/web/config/post_processing.py

+9-54
Original file line numberDiff line numberDiff line change
@@ -39,24 +39,13 @@ def index(self):
3939
return t.render(submenu=self.ConfigMenu(),
4040
controller='config', action='postProcessing')
4141

42-
def savePostProcessing(self, kodi_data=None, kodi_12plus_data=None,
43-
mediabrowser_data=None, sony_ps3_data=None,
44-
wdtv_data=None, tivo_data=None, mede8er_data=None,
45-
keep_processed_dir=None, process_method=None,
46-
del_rar_contents=None, process_automatically=None,
47-
no_delete=None, rename_episodes=None, airdate_episodes=None,
48-
file_timestamp_timezone=None, unpack=None,
49-
move_associated_files=None, sync_files=None,
50-
postpone_if_sync_files=None, postpone_if_no_subs=None,
51-
allowed_extensions=None, tv_download_dir=None,
52-
create_missing_show_dirs=None, add_shows_wo_dir=None,
53-
extra_scripts=None, nfo_rename=None,
54-
naming_pattern=None, naming_multi_ep=None,
55-
naming_custom_abd=None, naming_anime=None,
56-
naming_abd_pattern=None, naming_strip_year=None,
57-
naming_custom_sports=None, naming_sports_pattern=None,
58-
naming_custom_anime=None, naming_anime_pattern=None,
59-
naming_anime_multi_ep=None, autopostprocessor_frequency=None):
42+
def savePostProcessing(self, process_automatically=None, unpack=None, allowed_extensions=None,
43+
tv_download_dir=None, naming_pattern=None, naming_multi_ep=None,
44+
naming_anime=None, naming_abd_pattern=None, naming_sports_pattern=None,
45+
naming_anime_pattern=None, naming_anime_multi_ep=None,
46+
autopostprocessor_frequency=None):
47+
48+
# @TODO: The following validations need to be incorporated into API v2 (PATCH /api/v2/config/main)
6049

6150
results = []
6251

@@ -75,47 +64,13 @@ def savePostProcessing(self, kodi_data=None, kodi_12plus_data=None,
7564
results.append('Unpacking Not Supported, disabling unpack setting')
7665
else:
7766
app.UNPACK = config.checkbox_to_value(unpack)
78-
app.NO_DELETE = config.checkbox_to_value(no_delete)
79-
app.KEEP_PROCESSED_DIR = config.checkbox_to_value(keep_processed_dir)
80-
app.CREATE_MISSING_SHOW_DIRS = config.checkbox_to_value(create_missing_show_dirs)
81-
app.ADD_SHOWS_WO_DIR = config.checkbox_to_value(add_shows_wo_dir)
82-
app.PROCESS_METHOD = process_method
83-
app.DELRARCONTENTS = config.checkbox_to_value(del_rar_contents)
84-
app.EXTRA_SCRIPTS = [_.strip() for _ in extra_scripts.split('|') if _.strip()]
85-
app.RENAME_EPISODES = config.checkbox_to_value(rename_episodes)
86-
app.AIRDATE_EPISODES = config.checkbox_to_value(airdate_episodes)
87-
app.FILE_TIMESTAMP_TIMEZONE = file_timestamp_timezone
88-
app.MOVE_ASSOCIATED_FILES = config.checkbox_to_value(move_associated_files)
89-
app.SYNC_FILES = [_.strip() for _ in sync_files.split(',') if _.strip()]
90-
app.POSTPONE_IF_SYNC_FILES = config.checkbox_to_value(postpone_if_sync_files)
91-
app.POSTPONE_IF_NO_SUBS = config.checkbox_to_value(postpone_if_no_subs)
67+
68+
# @TODO: postprocessor for `POSTPONE_IF_NO_SUBS` and `ALLOWED_EXTENSIONS` ?
9269
# If 'postpone if no subs' is enabled, we must have SRT in allowed extensions list
9370
if app.POSTPONE_IF_NO_SUBS:
9471
allowed_extensions += ',srt'
9572
# # Auto PP must be disabled because FINDSUBTITLE thread that calls manual PP (like nzbtomedia)
9673
# app.PROCESS_AUTOMATICALLY = 0
97-
app.ALLOWED_EXTENSIONS = {_.strip() for _ in allowed_extensions.split(',') if _.strip()}
98-
app.NAMING_CUSTOM_ABD = config.checkbox_to_value(naming_custom_abd)
99-
app.NAMING_CUSTOM_SPORTS = config.checkbox_to_value(naming_custom_sports)
100-
app.NAMING_CUSTOM_ANIME = config.checkbox_to_value(naming_custom_anime)
101-
app.NAMING_STRIP_YEAR = config.checkbox_to_value(naming_strip_year)
102-
app.NFO_RENAME = config.checkbox_to_value(nfo_rename)
103-
104-
app.METADATA_KODI = kodi_data.split('|')
105-
app.METADATA_KODI_12PLUS = kodi_12plus_data.split('|')
106-
app.METADATA_MEDIABROWSER = mediabrowser_data.split('|')
107-
app.METADATA_PS3 = sony_ps3_data.split('|')
108-
app.METADATA_WDTV = wdtv_data.split('|')
109-
app.METADATA_TIVO = tivo_data.split('|')
110-
app.METADATA_MEDE8ER = mede8er_data.split('|')
111-
112-
app.metadata_provider_dict['KODI'].set_config(app.METADATA_KODI)
113-
app.metadata_provider_dict['KODI 12+'].set_config(app.METADATA_KODI_12PLUS)
114-
app.metadata_provider_dict['MediaBrowser'].set_config(app.METADATA_MEDIABROWSER)
115-
app.metadata_provider_dict['Sony PS3'].set_config(app.METADATA_PS3)
116-
app.metadata_provider_dict['WDTV'].set_config(app.METADATA_WDTV)
117-
app.metadata_provider_dict['TIVO'].set_config(app.METADATA_TIVO)
118-
app.metadata_provider_dict['Mede8er'].set_config(app.METADATA_MEDE8ER)
11974

12075
if self.isNamingValid(naming_pattern, naming_multi_ep, anime_type=naming_anime) != 'invalid':
12176
app.NAMING_PATTERN = naming_pattern

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def run_tests(self):
4444
'flake8-quotes',
4545
'pep8-naming',
4646
'pycodestyle==2.3.1',
47-
'pytest',
47+
'pytest==3.6.4',
4848
'pytest-cov',
4949
'pytest-flake8',
5050
'pytest-tornado5',

tests/apiv2/test_config.py

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def config_main(monkeypatch, app_config):
6060
config_data['locale'] = app_locale
6161
config_data['localUser'] = os_user
6262
config_data['programDir'] = app.PROG_DIR
63+
config_data['dataDir'] = app.DATA_DIR
6364
config_data['configFile'] = app.CONFIG_FILE
6465
config_data['dbPath'] = db.DBConnection().path
6566
config_data['cacheDir'] = app.CACHE_DIR

themes-default/slim/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,15 @@
118118
"webRoot",
119119
"apiRoot",
120120
"apiKey",
121-
"Vuex"
121+
"Vuex",
122+
"dateFns"
122123
],
123124
"ignores": [
124125
"static/js/lib/**",
125126
"static/js/*.min.js",
126127
"static/js/vender.js",
127128
"build/**",
128-
"gulpfile.js",
129-
"static/js/templates/name-pattern.vue"
129+
"gulpfile.js"
130130
],
131131
"esnext": true
132132
},

themes-default/slim/static/css/dark.css

-1
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,6 @@ config*.mako
464464
.component-group {
465465
padding: 15px 15px 25px;
466466
border-bottom: 1px dotted rgb(85, 85, 85);
467-
min-height: 200px;
468467
}
469468

470469
.component-group-desc p {

themes-default/slim/static/css/style.css

+52-6
Original file line numberDiff line numberDiff line change
@@ -1972,20 +1972,24 @@ config*.mako
19721972
.component-group {
19731973
padding: 15px 15px 25px;
19741974
border-bottom: 1px dotted rgb(204, 204, 204);
1975-
min-height: 200px;
1975+
min-height: 100px;
19761976
}
19771977

19781978
.component-item {
19791979
border-bottom: 1px dotted rgb(102, 102, 102);
19801980
min-height: 200px;
19811981
}
19821982

1983-
.component-group-desc {
1983+
.component-group-desc-legacy {
19841984
margin-top: 5px;
19851985
float: left;
19861986
width: 250px;
19871987
}
19881988

1989+
.component-group-desc {
1990+
margin-top: 5px;
1991+
}
1992+
19891993
.component-group-desc h3 {
19901994
margin-top: 5px;
19911995
}
@@ -2035,10 +2039,6 @@ config*.mako
20352039
margin-right: 10px;
20362040
}
20372041

2038-
#config .metadataDiv {
2039-
display: none;
2040-
}
2041-
20422042
.component-group-save {
20432043
float: right;
20442044
padding-top: 10px;
@@ -2961,6 +2961,11 @@ fieldset[disabled] .navbar-default .btn-link:focus {
29612961
width: auto;
29622962
}
29632963

2964+
.form-control-inline-max {
2965+
display: inline;
2966+
width: 100%;
2967+
}
2968+
29642969
.input-sm-smallfont {
29652970
font-size: 11px;
29662971
}
@@ -3384,6 +3389,42 @@ input sizing (for config pages)
33843389
margin-top: -4px;
33853390
}
33863391

3392+
/* Added max-width, as setting width is really not optimal on smaller viewports */
3393+
.max-input75 {
3394+
max-width: 75px;
3395+
margin-top: -4px;
3396+
}
3397+
3398+
.max-input100 {
3399+
max-width: 100px;
3400+
margin-top: -4px;
3401+
}
3402+
3403+
.max-input150 {
3404+
max-width: 150px;
3405+
margin-top: -4px;
3406+
}
3407+
3408+
.max-input200 {
3409+
max-width: 200px;
3410+
margin-top: -4px;
3411+
}
3412+
3413+
.max-input250 {
3414+
max-width: 250px;
3415+
margin-top: -4px;
3416+
}
3417+
3418+
.max-input300 {
3419+
max-width: 300px;
3420+
margin-top: -4px;
3421+
}
3422+
3423+
.max-input350 {
3424+
max-width: 350px;
3425+
margin-top: -4px;
3426+
}
3427+
33873428
select.input-sm {
33883429
font-size: 0.9em;
33893430
}
@@ -4333,3 +4374,8 @@ CSS helper classes
43334374
display: block;
43344375
}
43354376
*/
4377+
4378+
/* These classes should be natively available in bootstrap 4 */
4379+
.d-block {
4380+
display: block;
4381+
}

themes-default/slim/static/js/store.js

+1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ const store = new Store({
9393
minor: null
9494
},
9595
programDir: null,
96+
dataDir: null,
9697
animeSplitHomeInTabs: null,
9798
torrents: {
9899
authType: null,

0 commit comments

Comments
 (0)