Skip to content

Commit

Permalink
Feature/manifest (#6)
Browse files Browse the repository at this point in the history
- migration from a file header config definition to a manifest.json-based configuration
- works with NZBGet v23 and above
- no longer works with NZBGet v22 and below
  • Loading branch information
dnzbk authored Jan 17, 2024
1 parent 6771bf0 commit 07e5603
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 79 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ jobs:
release:
uses: nzbgetcom/nzbget-extensions/.github/workflows/extension-release.yml@main
with:
release-file-list: FailureLink.py
release-file-list: main.py manifest.json
release-file-name: failurelink
release-dir: FailureLink
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
> **Note:** this repo is a fork of the original github [project](https://github.com/nzbget/FailureLink)
> made by @hugbug.
> **Note:** This script is compatible with python 3.9.x and above.
## NZBGet Versions

> **Note:** If you need support for Python 2.x or older Python3.x versions please use [v1.21](https://github.com/nzbgetcom/Extension-FailureLink/releases/tag/v1.21) release.
> **Note:** [Here](https://github.com/nzbgetcom/nzbget/discussions/56) you can discuss problems with different versions of Python.
- pre-release v23+ [v3.0](https://github.com/nzbgetcom/Extension-FailureLink/releases/tag/v3.0)
- stable v22 [v2.0](https://github.com/nzbgetcom/Extension-FailureLink/releases/tag/v2.0)
- legacy v21 [v2.0](https://github.com/nzbgetcom/Extension-FailureLink/releases/tag/v2.0)

> **Note:** This script is compatible with python 3.8.x and above.
If you need support for Python 2.x or older Python3.x versions please use [v1.21](https://github.com/nzbgetcom/Extension-FailureLink/releases/tag/v1.21) release.

# FailureLink
FailureLink [script](https://nzbget.com/documentation/post-processing-scripts/) for [NZBGet](https://nzbget.com).
Expand Down
72 changes: 0 additions & 72 deletions FailureLink.py → main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,79 +19,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
### NZBGET POST-PROCESSING SCRIPT ###

# Check videos to determine if they are corrupt. Inform indexer site about failed
# or corrupt download and request a replacement nzb.
#
# If download fails, or video files are corrupt, the script sends info about the
# failure to indexer site, so a replacement NZB (same movie or TV episode) can be
# queued up if available. The indexer site must support DNZB-Header.
# "X-DNZB-FailureLink".
#
# Info about pp-script:
# Author: Andrey Prygunkov ([email protected]).
# Further modifications by Clinton Hall and dogzipp.
# Web-site: http://nzbget.sourceforge.net/forum/viewforum.php?f=8.
# Web-site: https://github.com/nzbgetcom/Extension-FailureLink/ (Python 3.9.x).
# License: GPLv2 (http://www.gnu.org/licenses/gpl.html).
# PP-Script Version: 1.21
#
#
# NOTE: Make sure you run this script first (before any other PP-scripts).
#
# NOTE: The integration works only for downloads queued via URL (including
# RSS). NZB-files queued from local disk don't have enough information
# to contact the indexer site.
#
# NOTE: This script requires Python 3.9.x to be installed on your system.

##############################################################################
### OPTIONS ###

## General

# Download another release (yes, no).
#
# If the NZB download of a Movie or TV Show fails, request an alternate
# NZB-file of the same release and add it to queue. If disabled the indexer
# site is still informed about the failure but no other nzb-file is queued.
#DownloadAnotherRelease=no

# Cleanup Directory (yes, no).
#
# Set this to yes in order to delete all corrupt and failed Files
#Delete=no

# Print more logging messages (yes, no).
#
# For debugging or if you need to report a bug.
#Verbose=no

# Check videos for corruption (yes, no).
#
# If disabled, ignore the settings below.
#CheckVid=no

# Absolute path for ffprobe.
#
# Enter the full path to ffprobe or avprobe here, or leave blank to search your system path.
#ffprobe=

# Absolute path for known good video.
#
# This is optional and is only needed to test if ffprobe is correctly compiled and working.
# Enter the full path to a valid video file.
#testVid=

# Media Extensions
#
# This is a list of video/media extensions that will be checked for corruption.
#mediaExtensions=.mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg,.vob,.ts

### NZBGET POST-PROCESSING SCRIPT ###
##############################################################################

import os
import sys
Expand Down
123 changes: 123 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"main": "main.py",
"name": "FailureLink",
"homepage": "https://github.com/nzbgetcom/Extension-FailureLink/",
"kind": "POST-PROCESSING",
"displayName": "Failure Link",
"version": "3.0.0",
"author": "Andrey Prygunkov",
"license": "GNU",
"about": "Checks videos to determine if they are corrupt. Inform indexer site about failed or corrupt download and request a replacement nzb.",
"queueEvents": "",
"description": [
"If download fails, or video files are corrupt, the script sends info about the",
"failure to indexer site, so a replacement NZB (same movie or TV episode) can be",
"queued up if available. The indexer site must support DNZB-Header.",
"\"X-DNZB-FailureLink\".",
"",
"Further modifications by Clinton Hall and dogzipp."
],
"requirements": [
"Make sure you run this script first (before any other PP-scripts).",
"The integration works only for downloads queued via URL (including RSS).",
"NZB-files queued from local disk don't have enough information to contact the indexer site.",
"",
"This script requires Python 3.8.x to be installed on your system."
],
"options": [
{
"name": "DownloadAnotherRelease",
"displayName": "DownloadAnotherRelease",
"value": "no",
"description": [
"Download another release.",
"",
"If the NZB download of a Movie or TV Show fails, request an alternate",
"NZB-file of the same release and add it to queue. If disabled the indexer",
"site is still informed about the failure but no other nzb-file is queued."
],
"select": [
"yes",
"no"
]
},
{
"name": "Delete",
"displayName": "Delete",
"value": "no",
"description": [
"Cleanup Directory.",
"",
"Set this to yes in order to delete all corrupt and failed Files."
],
"select": [
"yes",
"no"
]
},
{
"name": "Verbose",
"displayName": "Verbose",
"value": "no",
"description": [
"Print more logging messages.",
"",
"For debugging or if you need to report a bug."
],
"select": [
"yes",
"no"
]
},
{
"name": "CheckVid",
"displayName": "CheckVid",
"value": "no",
"description": [
"Check videos for corruption.",
"",
"If disabled, ignore the settings below."
],
"select": [
"yes",
"no"
]
},
{
"name": "ffprobe",
"displayName": "ffprobe",
"value": "",
"description": [
"Absolute path for ffprobe.",
"",
"Enter the full path to ffprobe or avprobe here, or leave blank to search your system path."
],
"select": []
},
{
"name": "testVid",
"displayName": "TestVid",
"value": "",
"description": [
"Absolute path for known good video.",
"",
"This is optional and is only needed to test if ffprobe is correctly compiled and working.",
"Enter the full path to a valid video file. "
],
"select": []
},
{
"name": "mediaExtensions",
"displayName": "MediaExtensions",
"value": ".mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg,.vob,.ts",
"description": [
"Media Extensions.",
"",
"This is a list of video/media extensions that will be checked for corruption."
],
"select": []
}
],
"commands": [],
"taskTime": ""
}
4 changes: 2 additions & 2 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with the program. If not, see <http://www.gnu.org/licenses/>.
# along with the program. If not, see <https://www.gnu.org/licenses/>.
#

import sys
Expand Down Expand Up @@ -99,7 +99,7 @@ def clean_up():

def run_script():
sys.stdout.flush()
proc = subprocess.Popen([get_python(), root_dir + '/FailureLink.py'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=os.environ.copy())
proc = subprocess.Popen([get_python(), root_dir + '/main.py'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=os.environ.copy())
out, err = proc.communicate()
ret_code = proc.returncode
return (out.decode(), int(ret_code), err.decode())
Expand Down

0 comments on commit 07e5603

Please sign in to comment.