mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-21 05:43:16 -07:00
Merge pull request #1505 from clinton-hall/dev
Merge develop into master
This commit is contained in:
commit
14300d12fd
5 changed files with 45 additions and 8 deletions
|
@ -1,5 +1,5 @@
|
||||||
[bumpversion]
|
[bumpversion]
|
||||||
current_version = 12.0.2
|
current_version = 12.0.3
|
||||||
commit = True
|
commit = True
|
||||||
tag = False
|
tag = False
|
||||||
|
|
||||||
|
|
|
@ -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))
|
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))
|
||||||
|
|
45
cleanup.py
45
cleanup.py
|
@ -5,6 +5,20 @@ from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
FOLDER_STRUCTURE = {
|
||||||
|
'libs': [
|
||||||
|
'common',
|
||||||
|
'custom',
|
||||||
|
'py2',
|
||||||
|
'win',
|
||||||
|
],
|
||||||
|
'core': [
|
||||||
|
'auto_process',
|
||||||
|
'extractor',
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class WorkingDirectory(object):
|
class WorkingDirectory(object):
|
||||||
|
@ -106,7 +120,22 @@ def clean_folders(*paths):
|
||||||
return result
|
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."""
|
"""Clean up bytecode and obsolete folders."""
|
||||||
with WorkingDirectory(module_path()) as cwd:
|
with WorkingDirectory(module_path()) as cwd:
|
||||||
if cwd.working_directory != cwd.original_directory:
|
if cwd.working_directory != cwd.original_directory:
|
||||||
|
@ -121,7 +150,7 @@ def clean(*paths):
|
||||||
print(result or 'No bytecode to clean')
|
print(result or 'No bytecode to clean')
|
||||||
|
|
||||||
if paths and os.path.exists('.git'):
|
if paths and os.path.exists('.git'):
|
||||||
print('\n-- Cleaning folders: {} --'.format(paths))
|
print('\n-- Cleaning folders: {} --'.format(list(paths)))
|
||||||
try:
|
try:
|
||||||
result = clean_folders(*paths)
|
result = clean_folders(*paths)
|
||||||
except SystemExit as error:
|
except SystemExit as error:
|
||||||
|
@ -129,7 +158,15 @@ def clean(*paths):
|
||||||
else:
|
else:
|
||||||
print(result or 'No folders to clean\n')
|
print(result or 'No folders to clean\n')
|
||||||
else:
|
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:
|
if cwd.working_directory != cwd.original_directory:
|
||||||
print('Returning to directory: ', cwd.original_directory)
|
print('Returning to directory: ', cwd.original_directory)
|
||||||
|
@ -138,4 +175,4 @@ def clean(*paths):
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
clean('libs', 'core')
|
clean(FOLDER_STRUCTURE)
|
||||||
|
|
|
@ -52,7 +52,7 @@ from core.utils import (
|
||||||
resume_torrent, remove_dir, remove_read_only, sanitize_name, update_download_info_status,
|
resume_torrent, remove_dir, remove_read_only, sanitize_name, update_download_info_status,
|
||||||
)
|
)
|
||||||
|
|
||||||
__version__ = '12.0.2'
|
__version__ = '12.0.3'
|
||||||
|
|
||||||
# Client Agents
|
# Client Agents
|
||||||
NZB_CLIENTS = ['sabnzbd', 'nzbget', 'manual']
|
NZB_CLIENTS = ['sabnzbd', 'nzbget', 'manual']
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -18,7 +18,7 @@ def read(*names, **kwargs):
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='nzbToMedia',
|
name='nzbToMedia',
|
||||||
version='12.0.2',
|
version='12.0.3',
|
||||||
license='GPLv3',
|
license='GPLv3',
|
||||||
description='Efficient on demand post processing',
|
description='Efficient on demand post processing',
|
||||||
long_description="""
|
long_description="""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue