Deployed e4531751
with MkDocs version: 1.4.0
parent
0dd4701a4c
commit
3ed90133e5
@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
### NZBGET POST-PROCESSING SCRIPT ###
|
||||
|
||||
# Replace underscore with dot.
|
||||
#
|
||||
# Author: miker
|
||||
#
|
||||
#
|
||||
# Copy script to NZBGet's script folder.
|
||||
# Run sudo chmod +x replace_for.py
|
||||
#
|
||||
#
|
||||
# NOTE: This script requires Python to be installed on your system.
|
||||
|
||||
### NZBGET POST-PROCESSING SCRIPT ###
|
||||
##############################################################################
|
||||
|
||||
from __future__ import print_function
|
||||
import os, re, sys
|
||||
|
||||
# Exit codes used by NZBGet
|
||||
POSTPROCESS_SUCCESS=93
|
||||
POSTPROCESS_ERROR=94
|
||||
POSTPROCESS_SKIP=95
|
||||
|
||||
|
||||
directory = os.environ['NZBPP_DIRECTORY']
|
||||
print('Directory used is: ',directory)
|
||||
|
||||
for path, currentDirectory, files in os.walk(directory):
|
||||
for file in files:
|
||||
if file.find("_") !=-1:
|
||||
dst = file.replace('_', '.')
|
||||
os.rename (os.path.join(path,file),os.path.join(path,dst) )
|
||||
print('Result: ',file," renamed to ",dst)
|
||||
|
||||
sys.exit(POSTPROCESS_SUCCESS)
|
After Width: | Height: | Size: 102 KiB |
@ -0,0 +1,42 @@
|
||||
#!/usr/bin/python3 -OO
|
||||
|
||||
##################################################################
|
||||
### SABnzbd - Replace underscores with dots ##
|
||||
##################################################################
|
||||
## ##
|
||||
## NOTE: This script requires Python 3 ##
|
||||
## ##
|
||||
## Author: miker ##
|
||||
## ##
|
||||
## Install: ##
|
||||
## 1. Copy script to sabnzbd's script folder ##
|
||||
## 2. run: sudo chmod +x replace_for.py ##
|
||||
## 3. in SABnzbd go to Config > Categories ##
|
||||
## 4. Assign replace_for.py to the required category ##
|
||||
##################################################################
|
||||
|
||||
import sys
|
||||
import os
|
||||
import os.path
|
||||
|
||||
try:
|
||||
(scriptname, directory, orgnzbname, jobname, reportnumber, category, group, postprocstatus, url) = sys.argv
|
||||
except:
|
||||
print("No commandline parameters found")
|
||||
sys.exit(1) # exit with 1 causes SABnzbd to ignore the output of this script
|
||||
|
||||
files = os.listdir(directory)
|
||||
|
||||
for src in files:
|
||||
if src.find("_") !=-1:
|
||||
dst = src.replace('_', '.')
|
||||
os.rename (os.path.join(directory,src),os.path.join(directory,dst) )
|
||||
print(src, "renamed to ",dst)
|
||||
|
||||
print()
|
||||
print()
|
||||
print()
|
||||
print()
|
||||
# 0 means OK
|
||||
sys.exit(0)
|
||||
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Loading…
Reference in new issue