Deployed e4531751 with MkDocs version: 1.4.0

gh-pages
2 years ago
parent 0dd4701a4c
commit 3ed90133e5

@ -1981,6 +1981,13 @@
HashRenamer
</a>
</li>
<li class="md-nav__item">
<a href="#replace_for" class="md-nav__link">
replace_for
</a>
</li>
<li class="md-nav__item">
@ -2289,6 +2296,66 @@ Released under GNU General Public License v2.0</p>
<span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="n">NZBGET_POSTPROCESS_SUCCESS</span><span class="p">)</span>
</code></pre></div>
</details>
<h2 id="replace_for">replace_for<a class="headerlink" href="#replace_for" title="Permanent link"></a></h2>
<details class="info">
<summary>Replaces underscores with dots</summary>
<ul>
<li>Title: <code>replace_for.py</code></li>
<li>Author: miker</li>
</ul>
<p>Replaces underscores with dots in downloaded filename to prevent download loops with poorly named releases on some indexers (often HONE releases).</p>
<p>Install Instructions:</p>
<ol>
<li>Copy script to NZBGet's script folder</li>
<li>run: <code>sudo chmod +x replace_for.py</code></li>
<li>in SABnzbd go to <code>Settings</code> =&gt; <code>Extension Scripts</code></li>
<li>Enable <code>replace_for.py</code> in the <code>Extensions</code> setting.</li>
</ol>
</details>
<details class="example">
<summary>Script</summary>
<div class="highlight"><pre><span></span><code><span class="ch">#!/usr/bin/env python3</span>
<span class="c1">#</span>
<span class="c1">##############################################################################</span>
<span class="c1">### NZBGET POST-PROCESSING SCRIPT ###</span>
<span class="c1"># Replace underscore with dot.</span>
<span class="c1">#</span>
<span class="c1"># Author: miker</span>
<span class="c1">#</span>
<span class="c1">#</span>
<span class="c1"># Copy script to NZBGet&#39;s script folder.</span>
<span class="c1"># Run sudo chmod +x replace_for.py</span>
<span class="c1">#</span>
<span class="c1">#</span>
<span class="c1"># NOTE: This script requires Python to be installed on your system.</span>
<span class="c1">### NZBGET POST-PROCESSING SCRIPT ###</span>
<span class="c1">##############################################################################</span>
<span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">print_function</span>
<span class="kn">import</span> <span class="nn">os</span><span class="o">,</span> <span class="nn">re</span><span class="o">,</span> <span class="nn">sys</span>
<span class="c1"># Exit codes used by NZBGet</span>
<span class="n">POSTPROCESS_SUCCESS</span><span class="o">=</span><span class="mi">93</span>
<span class="n">POSTPROCESS_ERROR</span><span class="o">=</span><span class="mi">94</span>
<span class="n">POSTPROCESS_SKIP</span><span class="o">=</span><span class="mi">95</span>
<span class="n">directory</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s1">&#39;NZBPP_DIRECTORY&#39;</span><span class="p">]</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Directory used is: &#39;</span><span class="p">,</span><span class="n">directory</span><span class="p">)</span>
<span class="k">for</span> <span class="n">path</span><span class="p">,</span> <span class="n">currentDirectory</span><span class="p">,</span> <span class="n">files</span> <span class="ow">in</span> <span class="n">os</span><span class="o">.</span><span class="n">walk</span><span class="p">(</span><span class="n">directory</span><span class="p">):</span>
<span class="k">for</span> <span class="n">file</span> <span class="ow">in</span> <span class="n">files</span><span class="p">:</span>
<span class="k">if</span> <span class="n">file</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="s2">&quot;_&quot;</span><span class="p">)</span> <span class="o">!=-</span><span class="mi">1</span><span class="p">:</span>
<span class="n">dst</span> <span class="o">=</span> <span class="n">file</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s1">&#39;_&#39;</span><span class="p">,</span> <span class="s1">&#39;.&#39;</span><span class="p">)</span>
<span class="n">os</span><span class="o">.</span><span class="n">rename</span> <span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">path</span><span class="p">,</span><span class="n">file</span><span class="p">),</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">path</span><span class="p">,</span><span class="n">dst</span><span class="p">)</span> <span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Result: &#39;</span><span class="p">,</span><span class="n">file</span><span class="p">,</span><span class="s2">&quot; renamed to &quot;</span><span class="p">,</span><span class="n">dst</span><span class="p">)</span>
<span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="n">POSTPROCESS_SUCCESS</span><span class="p">)</span>
</code></pre></div>
</details>
<h2 id="wtfnzb-renamer">WtFnZb-Renamer<a class="headerlink" href="#wtfnzb-renamer" title="Permanent link"></a></h2>
<details class="info">
<summary>Renames hashed media files to match the source NZB</summary>
@ -2468,7 +2535,7 @@ Released under GNU General Public License v2.0</p>
<small>
Last update:
<span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-datetime">May 31, 2021 19:50:32</span>
<span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-datetime">September 28, 2022 14:02:19</span>
</small>

@ -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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

@ -1974,6 +1974,13 @@
Clean
</a>
</li>
<li class="md-nav__item">
<a href="#replace_for" class="md-nav__link">
replace_for
</a>
</li>
</ul>
@ -2081,6 +2088,68 @@ Cleans the NZB name by removing the retagged stuff (-Obfuscated, -postbox, etc).
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;1&quot;</span><span class="p">)</span> <span class="c1"># Accept</span>
<span class="nb">print</span><span class="p">(</span><span class="n">fwp</span><span class="p">)</span>
<span class="nb">print</span><span class="p">()</span>
<span class="nb">print</span><span class="p">()</span>
<span class="nb">print</span><span class="p">()</span>
<span class="nb">print</span><span class="p">()</span>
<span class="nb">print</span><span class="p">()</span>
<span class="c1"># 0 means OK</span>
<span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
</code></pre></div>
</details>
<h2 id="replace_for">replace_for<a class="headerlink" href="#replace_for" title="Permanent link"></a></h2>
<details class="info">
<summary>Replaces underscores with dots</summary>
<ul>
<li>Title: <code>replace_for.py</code></li>
<li>Author: miker</li>
</ul>
<p>Replaces underscores with dots in downloaded filename to prevent download loops with poorly named releases on some indexers (often HONE releases).</p>
<p>Install Instructions:</p>
<ol>
<li>Copy script to sabnzbd's script folder</li>
<li>run: <code>sudo chmod +x replace_for.py</code></li>
<li>in SABnzbd go to <code>Settings</code> =&gt; <code>Categories</code></li>
<li>Change script for required categories and select: <code>replace_for.py</code></li>
</ol>
<p><div class="lightgallery"><a data-sub-html="Enable replace_for.py" href="/Downloaders/SABnzbd/images/sabnzbd-categories-replace_for.png"><img alt="Enable replace_for.py" src="/Downloaders/SABnzbd/images/sabnzbd-categories-replace_for.png" /></a></div></p>
</details>
<details class="example">
<summary>Script</summary>
<div class="highlight"><pre><span></span><code><span class="ch">#!/usr/bin/python3 -OO</span>
<span class="c1">##################################################################</span>
<span class="c1">### SABnzbd - Replace underscores with dots ##</span>
<span class="c1">##################################################################</span>
<span class="c1">## ##</span>
<span class="c1">## NOTE: This script requires Python 3 ##</span>
<span class="c1">## ##</span>
<span class="c1">## Author: miker ##</span>
<span class="c1">## ##</span>
<span class="c1">## Install: ##</span>
<span class="c1">## 1. Copy script to sabnzbd&#39;s script folder ##</span>
<span class="c1">## 2. run: sudo chmod +x replace_for.py ##</span>
<span class="c1">## 3. in SABnzbd go to Config &gt; Categories ##</span>
<span class="c1">## 4. Assign replace_for.py to the required category ##</span>
<span class="c1">##################################################################</span>
<span class="kn">import</span> <span class="nn">sys</span>
<span class="kn">import</span> <span class="nn">os</span>
<span class="kn">import</span> <span class="nn">os.path</span>
<span class="k">try</span><span class="p">:</span>
<span class="p">(</span><span class="n">scriptname</span><span class="p">,</span> <span class="n">directory</span><span class="p">,</span> <span class="n">orgnzbname</span><span class="p">,</span> <span class="n">jobname</span><span class="p">,</span> <span class="n">reportnumber</span><span class="p">,</span> <span class="n">category</span><span class="p">,</span> <span class="n">group</span><span class="p">,</span> <span class="n">postprocstatus</span><span class="p">,</span> <span class="n">url</span><span class="p">)</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span>
<span class="k">except</span><span class="p">:</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;No commandline parameters found&quot;</span><span class="p">)</span>
<span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="c1"># exit with 1 causes SABnzbd to ignore the output of this script</span>
<span class="n">files</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">listdir</span><span class="p">(</span><span class="n">directory</span><span class="p">)</span>
<span class="k">for</span> <span class="n">src</span> <span class="ow">in</span> <span class="n">files</span><span class="p">:</span>
<span class="k">if</span> <span class="n">src</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="s2">&quot;_&quot;</span><span class="p">)</span> <span class="o">!=-</span><span class="mi">1</span><span class="p">:</span>
<span class="n">dst</span> <span class="o">=</span> <span class="n">src</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s1">&#39;_&#39;</span><span class="p">,</span> <span class="s1">&#39;.&#39;</span><span class="p">)</span>
<span class="n">os</span><span class="o">.</span><span class="n">rename</span> <span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">directory</span><span class="p">,</span><span class="n">src</span><span class="p">),</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">directory</span><span class="p">,</span><span class="n">dst</span><span class="p">)</span> <span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">src</span><span class="p">,</span> <span class="s2">&quot;renamed to &quot;</span><span class="p">,</span><span class="n">dst</span><span class="p">)</span>
<span class="nb">print</span><span class="p">()</span>
<span class="nb">print</span><span class="p">()</span>
<span class="nb">print</span><span class="p">()</span>
@ -2095,7 +2164,7 @@ Cleans the NZB name by removing the retagged stuff (-Obfuscated, -postbox, etc).
<small>
Last update:
<span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-datetime">August 10, 2021 14:21:27</span>
<span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-datetime">September 28, 2022 14:02:19</span>
</small>

@ -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…
Cancel
Save