Merge pull request #1505 from clinton-hall/dev

Merge develop into master
This commit is contained in:
Labrys of Knossos 2019-01-05 21:39:38 -05:00 committed by GitHub
commit 14300d12fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 45 additions and 8 deletions

View file

@ -1,5 +1,5 @@
[bumpversion]
current_version = 12.0.2
current_version = 12.0.3
commit = True
tag = False

View file

@ -1,4 +1,4 @@
nzbToMedia v12.0.2
nzbToMedia v12.0.3
==================
Provides an [efficient](https://github.com/clinton-hall/nzbToMedia/wiki/Efficient-on-demand-post-processing) way to handle postprocessing for [CouchPotatoServer](https://couchpota.to/ "CouchPotatoServer") and [SickBeard](http://sickbeard.com/ "SickBeard") (and its [forks](https://github.com/clinton-hall/nzbToMedia/wiki/Failed-Download-Handling-%28FDH%29#sick-beard-and-its-forks))

View file

@ -5,6 +5,20 @@ from __future__ import print_function
import os
import subprocess
import sys
import shutil
FOLDER_STRUCTURE = {
'libs': [
'common',
'custom',
'py2',
'win',
],
'core': [
'auto_process',
'extractor',
],
}
class WorkingDirectory(object):
@ -106,7 +120,22 @@ def clean_folders(*paths):
return result
def clean(*paths):
def force_clean_folder(path, required):
root, dirs, files = next(os.walk(path))
required = sorted(required)
if required:
print('Skipping required subfolders', required)
remove = sorted(set(dirs).difference(required))
missing = sorted(set(required).difference(dirs))
for path in remove:
pathname = os.path.join(root, path)
print('Removing', pathname)
shutil.rmtree(pathname)
if missing:
raise Exception('Required subfolders missing:', missing)
def clean(paths):
"""Clean up bytecode and obsolete folders."""
with WorkingDirectory(module_path()) as cwd:
if cwd.working_directory != cwd.original_directory:
@ -121,7 +150,7 @@ def clean(*paths):
print(result or 'No bytecode to clean')
if paths and os.path.exists('.git'):
print('\n-- Cleaning folders: {} --'.format(paths))
print('\n-- Cleaning folders: {} --'.format(list(paths)))
try:
result = clean_folders(*paths)
except SystemExit as error:
@ -129,7 +158,15 @@ def clean(*paths):
else:
print(result or 'No folders to clean\n')
else:
print('Directory is not a git repository')
print('\nDirectory is not a git repository')
try:
items = paths.items()
except AttributeError:
print('Failed to clean, no subfolder structure given')
else:
for folder, subfolders in items:
print('\nForce cleaning folder:', folder)
force_clean_folder(folder, subfolders)
if cwd.working_directory != cwd.original_directory:
print('Returning to directory: ', cwd.original_directory)
@ -138,4 +175,4 @@ def clean(*paths):
if __name__ == '__main__':
clean('libs', 'core')
clean(FOLDER_STRUCTURE)

View file

@ -52,7 +52,7 @@ from core.utils import (
resume_torrent, remove_dir, remove_read_only, sanitize_name, update_download_info_status,
)
__version__ = '12.0.2'
__version__ = '12.0.3'
# Client Agents
NZB_CLIENTS = ['sabnzbd', 'nzbget', 'manual']

View file

@ -18,7 +18,7 @@ def read(*names, **kwargs):
setup(
name='nzbToMedia',
version='12.0.2',
version='12.0.3',
license='GPLv3',
description='Efficient on demand post processing',
long_description="""