Skip to content

Commit

Permalink
Fix saving of the config - postprocess frequency. (#5482)
Browse files Browse the repository at this point in the history
* Fix saving of the config - postprocess frequency.

* Update changelog.

* Update CHANGELOG.md

Moved config/search to improvements.

* Bump pycodestyle

* Fix W605 invalid escape sequence

* Exclude W504 line break after binary operator for now

* Exclude W504 for real

* Remove blank line.
Don't know if this is the issue. Just trying some things.

* Remove useless DEFAULT_AUTOPOSTPROCESSOR_FREQUENCY

* Use pytest_tornado and pin tornado to latest version

* yarn install && yarn dev
  • Loading branch information
p0psicles authored Oct 25, 2018
1 parent 2c15c79 commit 707cce2
Show file tree
Hide file tree
Showing 18 changed files with 27 additions and 28 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Converted the "quality pill" into a Vue SFC ([#5103](https://github.com/pymedusa/Medusa/pull/5103))
- Vueified restart page, moved JS files to Vue, added `state-switch` component and misc changes ([#5159](https://github.com/pymedusa/Medusa/pull/5159))
- Added support for SABnzbd's Direct Unpack feature ([#5385](https://github.com/pymedusa/Medusa/pull/5385))
- Added config/search values to apiv2 ([#5079](https://github.com/pymedusa/Medusa/pull/5079))

#### Fixes
- Fixed many release name parsing issues as a result of updating `guessit` ([#4244](https://github.com/pymedusa/Medusa/pull/4244))
Expand All @@ -23,7 +24,7 @@
- Fixed imdbpie exception on connection error ([#5386](https://github.com/pymedusa/Medusa/pull/5386))
- Fixed metadata settings not being saved ([#5385](https://github.com/pymedusa/Medusa/pull/5385))
- Fixed Synology DS missing location and wrong icon ([#5443](https://github.com/pymedusa/Medusa/pull/5443))
- Added config/search values to apiv2 ([#5079](https://github.com/pymedusa/Medusa/pull/5079))
- Fixed saving "config - postprocessing frequency" value ([#5482](https://github.com/pymedusa/Medusa/pull/5482))

-----

Expand Down
3 changes: 1 addition & 2 deletions medusa/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,8 +625,7 @@ def initialize(self, console_logging=True):
app.CACHE_TRIMMING = bool(check_setting_int(app.CFG, 'General', 'cache_trimming', 0))
app.MAX_CACHE_AGE = check_setting_int(app.CFG, 'General', 'max_cache_age', 30)
app.AUTOPOSTPROCESSOR_FREQUENCY = max(app.MIN_AUTOPOSTPROCESSOR_FREQUENCY,
check_setting_int(app.CFG, 'General', 'autopostprocessor_frequency',
app.DEFAULT_AUTOPOSTPROCESSOR_FREQUENCY))
check_setting_int(app.CFG, 'General', 'autopostprocessor_frequency', 10))

app.TORRENT_CHECKER_FREQUENCY = max(app.MIN_TORRENT_CHECKER_FREQUENCY,
check_setting_int(app.CFG, 'General', 'torrent_checker_frequency',
Expand Down
3 changes: 1 addition & 2 deletions medusa/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,12 @@
SAB_FORCED = False
RANDOMIZE_PROVIDERS = False

AUTOPOSTPROCESSOR_FREQUENCY = None
AUTOPOSTPROCESSOR_FREQUENCY = 10
DAILYSEARCH_FREQUENCY = None
UPDATE_FREQUENCY = None
BACKLOG_FREQUENCY = None
SHOWUPDATE_HOUR = None

DEFAULT_AUTOPOSTPROCESSOR_FREQUENCY = 10
DEFAULT_TORRENT_CHECKER_FREQUENCY = 60
DEFAULT_DAILYSEARCH_FREQUENCY = 40
DEFAULT_BACKLOG_FREQUENCY = 21
Expand Down
2 changes: 1 addition & 1 deletion medusa/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def change_AUTOPOSTPROCESSOR_FREQUENCY(freq):
:param freq: New frequency
"""
app.AUTOPOSTPROCESSOR_FREQUENCY = try_int(freq, app.DEFAULT_AUTOPOSTPROCESSOR_FREQUENCY)
app.AUTOPOSTPROCESSOR_FREQUENCY = try_int(freq, 10)

if app.AUTOPOSTPROCESSOR_FREQUENCY < app.MIN_AUTOPOSTPROCESSOR_FREQUENCY:
app.AUTOPOSTPROCESSOR_FREQUENCY = app.MIN_AUTOPOSTPROCESSOR_FREQUENCY
Expand Down
4 changes: 2 additions & 2 deletions medusa/name_parser/rules/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ def source():
# More accurate sources
rebulk.regex('BD-?Rip', 'BD(?=-?Mux)', value='BDRip',
conflict_solver=lambda match, other: other if other.name == 'source' else '__default__')
rebulk.regex('BD(?!\d)', value='BDRip', validator=seps_surround,
rebulk.regex(r'BD(?!\d)', value='BDRip', validator=seps_surround,
conflict_solver=lambda match, other: other if other.name == 'source' else '__default__')
rebulk.regex('BR-?Rip', 'BR(?=-?Mux)', value='BRRip',
conflict_solver=lambda match, other: other if other.name == 'source' else '__default__')
rebulk.regex('DVD-?Rip', value='DVDRip',
conflict_solver=lambda match, other: other if other.name == 'source' else '__default__')

rebulk.regex('DVD\d', value='DVD')
rebulk.regex(r'DVD\d', value='DVD')

return rebulk

Expand Down
1 change: 0 additions & 1 deletion medusa/notifiers/emby.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def _notify_emby(self, message, host=None, emby_apikey=None):
{'url': url, 'error': ex(error)})
return False


##############################################################################
# Public functions
##############################################################################
Expand Down
8 changes: 4 additions & 4 deletions medusa/providers/torrent/html/bjshare.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,11 @@ def process_column_header(td):
group_index = -2 if 'group_torrent' in result_class else 0
try:
title = result.select('a[href^="torrents.php?id="]')[0].get_text()
title = re.sub('\s+', ' ', title).strip() # clean empty lines and multiple spaces
title = re.sub(r'\s+', ' ', title).strip() # clean empty lines and multiple spaces

if 'group' in result_class or 'torrent' in result_class:
# get international title if available
title = re.sub('.* \[(.*?)\](.*)', r'\1\2', title)
title = re.sub(r'.* \[(.*?)\](.*)', r'\1\2', title)

if 'group' in result_class:
group_title = title
Expand All @@ -197,7 +197,7 @@ def process_column_header(td):
for serie in self.absolute_numbering:
if serie in title:
# remove season from title when its in absolute format
title = re.sub('S\d{2}E(\d{2,4})', r'\1', title)
title = re.sub(r'S\d{2}E(\d{2,4})', r'\1', title)
break

download_url = urljoin(self.url, result.select('a[href^="torrents.php?action=download"]')[0]['href'])
Expand Down Expand Up @@ -231,7 +231,7 @@ def process_column_header(td):
size = convert_size(torrent_size) or -1

torrent_name = '{0} {1}'.format(title, torrent_details.strip()).strip()
torrent_name = re.sub('\s+', ' ', torrent_name)
torrent_name = re.sub(r'\s+', ' ', torrent_name)

items.append({
'title': torrent_name,
Expand Down
4 changes: 2 additions & 2 deletions medusa/providers/torrent/html/hebits.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ def parse(self, data, mode):

for row in torrent_rows:
try:
heb_eng_title = row.find('div', class_='bTitle').find(href=re.compile('details\.php')).find('b').get_text()
heb_eng_title = row.find('div', class_='bTitle').find(href=re.compile(r'details\.php')).find('b').get_text()
if '/' in heb_eng_title:
title = heb_eng_title.split('/')[1].strip()
elif '\\' in heb_eng_title:
title = heb_eng_title.split('\\')[1].strip()
else:
continue

download_id = row.find('div', class_='bTitle').find(href=re.compile('download\.php'))['href']
download_id = row.find('div', class_='bTitle').find(href=re.compile(r'download\.php'))['href']

if not all([title, download_id]):
continue
Expand Down
2 changes: 1 addition & 1 deletion medusa/providers/torrent/html/pretome.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def _norm_size(size_string):
"""Normalize the size from the parsed string."""
if not size_string:
return size_string
return re.sub(r'(?P<unit>[A-Z]+)', ' \g<unit>', size_string)
return re.sub(r'(?P<unit>[A-Z]+)', r' \g<unit>', size_string)


provider = PretomeProvider()
2 changes: 1 addition & 1 deletion medusa/providers/torrent/html/shanaproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
class ShanaProjectProvider(TorrentProvider):
"""ShanaProject Torrent provider."""

size_regex = re.compile('([\d.]+)(.*)')
size_regex = re.compile(r'([\d.]+)(.*)')

def __init__(self):
"""Initialize the class."""
Expand Down
6 changes: 3 additions & 3 deletions medusa/providers/torrent/json/animebytes.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,16 @@ def parse(self, data, mode):
title_info = row.get('EditionData').get('EditionTitle')
if title_info != '':
if title_info.startswith('Episodes'):
episode = re.match('Episodes 1-(\d+)', title_info).group(1)
episode = re.match(r'Episodes 1-(\d+)', title_info).group(1)
release_type = MULTI_EP
elif title_info.startswith('Episode'):
episode = re.match('^Episode.([0-9]+)', title_info).group(1)
release_type = SINGLE_EP
elif title_info.startswith('Season'):
if re.match('Season.[0-9]+-[0-9]+.\([0-9-]+\)', title_info):
if re.match(r'Season.[0-9]+-[0-9]+.\([0-9-]+\)', title_info):
# We can read the season AND the episodes, but we can only process multiep.
# So i've chosen to use it like 12-23 or 1-12.
match = re.match('Season.([0-9]+)-([0-9]+).\(([0-9-]+)\)', title_info)
match = re.match(r'Season.([0-9]+)-([0-9]+).\(([0-9-]+)\)', title_info)
episode = match.group(3).upper()
season = '{0}-{1}'.format(match.group(1), match.group(2))
release_type = MULTI_SEASON
Expand Down
2 changes: 1 addition & 1 deletion medusa/server/api/v2/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ def data_main():
section_data['postProcessing']['noDelete'] = bool(app.NO_DELETE)
section_data['postProcessing']['processMethod'] = app.PROCESS_METHOD
section_data['postProcessing']['reflinkAvailable'] = bool(pkgutil.find_loader('reflink'))
section_data['postProcessing']['autoPostprocessorFrequency'] = app.AUTOPOSTPROCESSOR_FREQUENCY
section_data['postProcessing']['autoPostprocessorFrequency'] = int(app.AUTOPOSTPROCESSOR_FREQUENCY)
section_data['postProcessing']['syncFiles'] = app.SYNC_FILES
section_data['postProcessing']['fileTimestampTimezone'] = app.FILE_TIMESTAMP_TIMEZONE
section_data['postProcessing']['allowedExtensions'] = app.ALLOWED_EXTENSIONS
Expand Down
2 changes: 1 addition & 1 deletion medusa/subtitle_providers/itasa.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def _get_season_subtitles(self, show_id, season, sub_source):
raise ConfigurationError('Not a zip file: %r' % content)

with ZipFile(io.BytesIO(content)) as zf:
episode_re = re.compile('s(\d{1,2})e(\d{1,2})')
episode_re = re.compile(r's(\d{1,2})e(\d{1,2})')
for name in zf.namelist():
match = episode_re.search(name)
if not match: # pragma: no cover
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ filterwarnings =
ignore::PendingDeprecationWarning
flake8-ignore =
D107
W504
medusa/__init__.py D104 F401
medusa/bs4_parser.py D100 D101 D102 D105
medusa/cache.py D401 E305
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ def run_tests(self):
description="Automatic Video Library Manager for TV Shows",
long_description=long_description,
packages=find_packages(),
install_requires=['tornado==5.1', 'six', 'profilehooks', 'contextlib2', ],
install_requires=['tornado==5.1.1', 'six', 'profilehooks', 'contextlib2', ],
cmdclass={'test': PyTest},
tests_require=[
'flake8>=3.5.0',
'flake8-docstrings>=1.3.0',
'flake8-import-order>=0.18',
'flake8-quotes>=1.0.0',
'pep8-naming>=0.7.0',
'pycodestyle==2.3.1',
'pycodestyle>=2.4.0',
'pytest>=3.8.0',
'pytest-cov>=2.6.0',
'pytest-flake8>=1.0.2',
'pytest-tornado5>=1.0.0',
'pytest-tornado>=0.5.0',
'PyYAML>=3.13,<4',
'vcrpy>=1.13.0',
'mock>=2.0.0',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<span>Auto Post-Processing Frequency</span>
</label>
<div class="col-sm-10 content">
<input type="number" min="10" step="1" name="autopostprocessor_frequency" id="autopostprocessor_frequency" v-model="postProcessing.autoPostprocessorFrequency" class="form-control input-sm input75" />
<input type="number" min="10" step="1" name="autopostprocessor_frequency" id="autopostprocessor_frequency" v-model.number="postProcessing.autoPostprocessorFrequency" class="form-control input-sm input75" />
<span>Time in minutes to check for new files to auto post-process (min 10)</span>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion themes/dark/assets/js/medusa-runtime.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion themes/light/assets/js/medusa-runtime.js

Large diffs are not rendered by default.

0 comments on commit 707cce2

Please sign in to comment.