mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-19 21:03:14 -07:00
Re-added back NZBGet options to our stub files.
Added a status check for processed files in HeadPhones. Fixed a bug in HeadPhones with passing params via requests. Fixed SickBeard and CouchPotato conditionals for deleting failed files.
This commit is contained in:
parent
77e07be6c8
commit
a2eb80f619
12 changed files with 757 additions and 78 deletions
|
@ -23,7 +23,7 @@
|
||||||
method = renamer
|
method = renamer
|
||||||
delete_failed = 0
|
delete_failed = 0
|
||||||
wait_for = 2
|
wait_for = 2
|
||||||
#### Set the remote path for CouchPotatoServer if its running on a different server then your download client
|
#### # Set to path where completed downloads go on the remote CouchPotatoServer
|
||||||
remote_path =
|
remote_path =
|
||||||
watch_dir =
|
watch_dir =
|
||||||
|
|
||||||
|
@ -40,7 +40,6 @@
|
||||||
web_root =
|
web_root =
|
||||||
ssl = 0
|
ssl = 0
|
||||||
delay = 0
|
delay = 0
|
||||||
TimePerGiB = 60
|
|
||||||
watch_dir =
|
watch_dir =
|
||||||
fork = auto
|
fork = auto
|
||||||
delete_failed = 0
|
delete_failed = 0
|
||||||
|
@ -62,7 +61,6 @@
|
||||||
web_root =
|
web_root =
|
||||||
ssl = 0
|
ssl = 0
|
||||||
delay = 0
|
delay = 0
|
||||||
TimePerGiB = 60
|
|
||||||
watch_dir =
|
watch_dir =
|
||||||
delete_failed = 0
|
delete_failed = 0
|
||||||
nzbExtractionBy = Downloader
|
nzbExtractionBy = Downloader
|
||||||
|
@ -80,7 +78,6 @@
|
||||||
ssl = 0
|
ssl = 0
|
||||||
web_root =
|
web_root =
|
||||||
delay = 65
|
delay = 65
|
||||||
TimePerGiB = 60
|
|
||||||
watch_dir =
|
watch_dir =
|
||||||
|
|
||||||
[Mylar]
|
[Mylar]
|
||||||
|
|
|
@ -1,5 +1,131 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
#
|
#
|
||||||
|
##############################################################################
|
||||||
|
### NZBGET POST-PROCESSING SCRIPT ###
|
||||||
|
|
||||||
|
# Post-Process to CouchPotato, SickBeard, NzbDrone, Mylar, Gamez, HeadPhones.
|
||||||
|
#
|
||||||
|
# This script sends the download to your automated media management servers.
|
||||||
|
#
|
||||||
|
# NOTE: This script requires Python to be installed on your system.
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
### OPTIONS ###
|
||||||
|
|
||||||
|
## General
|
||||||
|
#
|
||||||
|
# Set to 1 if you want nzbToMedia to automatically check for and update to the latest version
|
||||||
|
#auto_update=0
|
||||||
|
|
||||||
|
## CouchPotato
|
||||||
|
|
||||||
|
# CouchPotato script category.
|
||||||
|
#
|
||||||
|
# category that gets called for post-processing with CouchPotatoServer.
|
||||||
|
#cpsCategory=movie
|
||||||
|
|
||||||
|
# CouchPotato api key.
|
||||||
|
#cpsapikey=
|
||||||
|
|
||||||
|
# CouchPotato host.
|
||||||
|
#cpshost=localhost
|
||||||
|
|
||||||
|
# CouchPotato port.
|
||||||
|
#cpsport=5050
|
||||||
|
|
||||||
|
# CouchPotato uses ssl (0, 1).
|
||||||
|
#
|
||||||
|
# Set to 1 if using ssl, else set to 0.
|
||||||
|
#cpsssl=0
|
||||||
|
|
||||||
|
# CouchPotato URL_Base
|
||||||
|
#
|
||||||
|
# set this if using a reverse proxy.
|
||||||
|
#cpsweb_root=
|
||||||
|
|
||||||
|
# CouchPotato watch directory.
|
||||||
|
#
|
||||||
|
# set this if CouchPotato and nzbGet are on different systems.
|
||||||
|
#cpswatch_dir=
|
||||||
|
|
||||||
|
# CouchPotato Postprocess Delay.
|
||||||
|
#
|
||||||
|
# must be at least 60 seconds.
|
||||||
|
#cpsdelay=65
|
||||||
|
|
||||||
|
# CouchPotato Postprocess Method (renamer, manage).
|
||||||
|
#
|
||||||
|
# use "renamer" for CPS renamer (default) or "manage" to call a manage update.
|
||||||
|
#cpsmethod=renamer
|
||||||
|
|
||||||
|
# CouchPotato Delete Failed Downloads (0, 1).
|
||||||
|
#
|
||||||
|
# set to 1 to delete failed, or 0 to leave files in place.
|
||||||
|
#cpsdelete_failed=0
|
||||||
|
|
||||||
|
# CouchPotato wait_for
|
||||||
|
#
|
||||||
|
# Set the number of minutes to wait after calling the renamer, to check the movie has changed status.
|
||||||
|
#cpswait_for=2
|
||||||
|
|
||||||
|
# CouchPotatoServer and NZBGet are a different system (0, 1).
|
||||||
|
#
|
||||||
|
# Set to path where completed downloads go on the remote CouchPotatoServer.
|
||||||
|
#cpsremote_path =
|
||||||
|
|
||||||
|
## Extensions
|
||||||
|
|
||||||
|
# Media Extensions
|
||||||
|
#
|
||||||
|
# This is a list of media extensions that are used to verify that the download does contain valid media.
|
||||||
|
#mediaExtensions=.mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg,.vob,.iso
|
||||||
|
|
||||||
|
## Transcoder
|
||||||
|
|
||||||
|
# Transcode (0, 1).
|
||||||
|
#
|
||||||
|
# set to 1 to transcode, otherwise set to 0.
|
||||||
|
#transcode=0
|
||||||
|
|
||||||
|
# create a duplicate, or replace the original (0, 1).
|
||||||
|
#
|
||||||
|
# set to 1 to cretae a new file or 0 to replace the original
|
||||||
|
#duplicate=1
|
||||||
|
|
||||||
|
# ignore extensions
|
||||||
|
#
|
||||||
|
# list of extensions that won't be transcoded.
|
||||||
|
#ignoreExtensions=.avi,.mkv
|
||||||
|
|
||||||
|
# ffmpeg output settings.
|
||||||
|
#outputVideoExtension=.mp4
|
||||||
|
#outputVideoCodec=libx264
|
||||||
|
#outputVideoPreset=medium
|
||||||
|
#outputVideoFramerate=24
|
||||||
|
#outputVideoBitrate=800k
|
||||||
|
#outputAudioCodec=libmp3lame
|
||||||
|
#outputAudioBitrate=128k
|
||||||
|
#outputSubtitleCodec=
|
||||||
|
|
||||||
|
## WakeOnLan
|
||||||
|
|
||||||
|
# use WOL (0, 1).
|
||||||
|
#
|
||||||
|
# set to 1 to send WOL broadcast to the mac and test the server (e.g. xbmc) on the host and port specified.
|
||||||
|
#wolwake=0
|
||||||
|
|
||||||
|
# WOL MAC
|
||||||
|
#
|
||||||
|
# enter the mac address of the system to be woken.
|
||||||
|
#wolmac=00:01:2e:2D:64:e1
|
||||||
|
|
||||||
|
# Set the Host and Port of a server to verify system has woken.
|
||||||
|
#wolhost=192.168.1.37
|
||||||
|
#wolport=80
|
||||||
|
|
||||||
|
### NZBGET POST-PROCESSING SCRIPT ###
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
# Stub file to call nzbToMedia
|
# Stub file to call nzbToMedia
|
||||||
import nzbToMedia
|
import nzbToMedia
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,102 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
#
|
#
|
||||||
|
##############################################################################
|
||||||
|
### NZBGET POST-PROCESSING SCRIPT ###
|
||||||
|
|
||||||
|
# Post-Process to CouchPotato, SickBeard, NzbDrone, Mylar, Gamez, HeadPhones.
|
||||||
|
#
|
||||||
|
# This script sends the download to your automated media management servers.
|
||||||
|
#
|
||||||
|
# NOTE: This script requires Python to be installed on your system.
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
### OPTIONS ###
|
||||||
|
|
||||||
|
## General
|
||||||
|
#
|
||||||
|
# Set to 1 if you want nzbToMedia to automatically check for and update to the latest version
|
||||||
|
#auto_update=0
|
||||||
|
|
||||||
|
## Gamez
|
||||||
|
|
||||||
|
# Gamez script category.
|
||||||
|
#
|
||||||
|
# category that gets called for post-processing with Gamez.
|
||||||
|
#gzCategory=games
|
||||||
|
|
||||||
|
# Gamez api key.
|
||||||
|
#gzapikey=
|
||||||
|
|
||||||
|
# Gamez host.
|
||||||
|
#gzhost=localhost
|
||||||
|
|
||||||
|
# Gamez port.
|
||||||
|
#gzport=8085
|
||||||
|
|
||||||
|
# Gamez uses ssl (0, 1).
|
||||||
|
#
|
||||||
|
# Set to 1 if using ssl, else set to 0.
|
||||||
|
#gzssl=0
|
||||||
|
|
||||||
|
# Gamez web_root
|
||||||
|
#
|
||||||
|
# set this if using a reverse proxy.
|
||||||
|
#gzweb_root=
|
||||||
|
|
||||||
|
## Extensions
|
||||||
|
|
||||||
|
# Media Extensions
|
||||||
|
#
|
||||||
|
# This is a list of media extensions that are used to verify that the download does contain valid media.
|
||||||
|
#mediaExtensions=.mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg,.vob,.iso
|
||||||
|
|
||||||
|
## Transcoder
|
||||||
|
|
||||||
|
# Transcode (0, 1).
|
||||||
|
#
|
||||||
|
# set to 1 to transcode, otherwise set to 0.
|
||||||
|
#transcode=0
|
||||||
|
|
||||||
|
# create a duplicate, or replace the original (0, 1).
|
||||||
|
#
|
||||||
|
# set to 1 to cretae a new file or 0 to replace the original
|
||||||
|
#duplicate=1
|
||||||
|
|
||||||
|
# ignore extensions
|
||||||
|
#
|
||||||
|
# list of extensions that won't be transcoded.
|
||||||
|
#ignoreExtensions=.avi,.mkv
|
||||||
|
|
||||||
|
# ffmpeg output settings.
|
||||||
|
#outputVideoExtension=.mp4
|
||||||
|
#outputVideoCodec=libx264
|
||||||
|
#outputVideoPreset=medium
|
||||||
|
#outputVideoFramerate=24
|
||||||
|
#outputVideoBitrate=800k
|
||||||
|
#outputAudioCodec=libmp3lame
|
||||||
|
#outputAudioBitrate=128k
|
||||||
|
#outputSubtitleCodec=
|
||||||
|
|
||||||
|
## WakeOnLan
|
||||||
|
|
||||||
|
# use WOL (0, 1).
|
||||||
|
#
|
||||||
|
# set to 1 to send WOL broadcast to the mac and test the server (e.g. xbmc) on the host and port specified.
|
||||||
|
#wolwake=0
|
||||||
|
|
||||||
|
# WOL MAC
|
||||||
|
#
|
||||||
|
# enter the mac address of the system to be woken.
|
||||||
|
#wolmac=00:01:2e:2D:64:e1
|
||||||
|
|
||||||
|
# Set the Host and Port of a server to verify system has woken.
|
||||||
|
#wolhost=192.168.1.37
|
||||||
|
#wolport=80
|
||||||
|
|
||||||
|
### NZBGET POST-PROCESSING SCRIPT ###
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
# Stub file to call nzbToMedia
|
# Stub file to call nzbToMedia
|
||||||
import nzbToMedia
|
import nzbToMedia
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,105 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
#
|
#
|
||||||
|
##############################################################################
|
||||||
|
### NZBGET POST-PROCESSING SCRIPT ###
|
||||||
|
|
||||||
|
# Post-Process to HeadPhones.
|
||||||
|
#
|
||||||
|
# This script sends the download to your automated media management servers.
|
||||||
|
#
|
||||||
|
# NOTE: This script requires Python to be installed on your system.
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
### OPTIONS
|
||||||
|
|
||||||
|
## General
|
||||||
|
#
|
||||||
|
# Set to 1 if you want nzbToMedia to automatically check for and update to the latest version
|
||||||
|
#auto_update=0
|
||||||
|
|
||||||
|
## HeadPhones
|
||||||
|
|
||||||
|
# HeadPhones script category.
|
||||||
|
#
|
||||||
|
# category that gets called for post-processing with HeadHones.
|
||||||
|
#hpCategory=music
|
||||||
|
|
||||||
|
# HeadPhones api key.
|
||||||
|
#hpapikey=
|
||||||
|
|
||||||
|
# HeadPhones host.
|
||||||
|
#hphost=localhost
|
||||||
|
|
||||||
|
# HeadPhones port.
|
||||||
|
#hpport=8181
|
||||||
|
|
||||||
|
# HeadPhones uses ssl (0, 1).
|
||||||
|
#
|
||||||
|
# Set to 1 if using ssl, else set to 0.
|
||||||
|
#hpssl=0
|
||||||
|
|
||||||
|
# HeadPhones web_root
|
||||||
|
#
|
||||||
|
# set this if using a reverse proxy.
|
||||||
|
#hpweb_root=
|
||||||
|
|
||||||
|
# HeadPhones Postprocess Delay.
|
||||||
|
#
|
||||||
|
# set as required to ensure correct processing.
|
||||||
|
#hpdelay=65
|
||||||
|
|
||||||
|
## Extensions
|
||||||
|
|
||||||
|
# Media Extensions
|
||||||
|
#
|
||||||
|
# This is a list of media extensions that are used to verify that the download does contain valid media.
|
||||||
|
#mediaExtensions=.mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg,.vob,.iso
|
||||||
|
|
||||||
|
## Transcoder
|
||||||
|
|
||||||
|
# Transcode (0, 1).
|
||||||
|
#
|
||||||
|
# set to 1 to transcode, otherwise set to 0.
|
||||||
|
#transcode=0
|
||||||
|
|
||||||
|
# create a duplicate, or replace the original (0, 1).
|
||||||
|
#
|
||||||
|
# set to 1 to cretae a new file or 0 to replace the original
|
||||||
|
#duplicate=1
|
||||||
|
|
||||||
|
# ignore extensions
|
||||||
|
#
|
||||||
|
# list of extensions that won't be transcoded.
|
||||||
|
#ignoreExtensions=.avi,.mkv
|
||||||
|
|
||||||
|
# ffmpeg output settings.
|
||||||
|
#outputVideoExtension=.mp4
|
||||||
|
#outputVideoCodec=libx264
|
||||||
|
#outputVideoPreset=medium
|
||||||
|
#outputVideoFramerate=24
|
||||||
|
#outputVideoBitrate=800k
|
||||||
|
#outputAudioCodec=libmp3lame
|
||||||
|
#outputAudioBitrate=128k
|
||||||
|
#outputSubtitleCodec=
|
||||||
|
|
||||||
|
## WakeOnLan
|
||||||
|
|
||||||
|
# use WOL (0, 1).
|
||||||
|
#
|
||||||
|
# set to 1 to send WOL broadcast to the mac and test the server (e.g. xbmc) on the host and port specified.
|
||||||
|
#wolwake=0
|
||||||
|
|
||||||
|
# WOL MAC
|
||||||
|
#
|
||||||
|
# enter the mac address of the system to be woken.
|
||||||
|
#wolmac=00:01:2e:2D:64:e1
|
||||||
|
|
||||||
|
# Set the Host and Port of a server to verify system has woken.
|
||||||
|
#wolhost=192.168.1.37
|
||||||
|
#wolport=80
|
||||||
|
|
||||||
|
### NZBGET POST-PROCESSING SCRIPT ###
|
||||||
|
##############################################################################
|
||||||
# Stub file to call nzbToMedia
|
# Stub file to call nzbToMedia
|
||||||
import nzbToMedia
|
import nzbToMedia
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,11 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
### OPTIONS ###
|
### OPTIONS ###
|
||||||
|
|
||||||
|
## General
|
||||||
|
#
|
||||||
|
# Set to 1 if you want nzbToMedia to automatically check for and update to the latest version
|
||||||
|
#auto_update=0
|
||||||
|
|
||||||
## CouchPotato
|
## CouchPotato
|
||||||
|
|
||||||
# CouchPotato script category.
|
# CouchPotato script category.
|
||||||
|
@ -53,11 +58,6 @@
|
||||||
# set to 1 to delete failed, or 0 to leave files in place.
|
# set to 1 to delete failed, or 0 to leave files in place.
|
||||||
#cpsdelete_failed=0
|
#cpsdelete_failed=0
|
||||||
|
|
||||||
# CouchPotato process Time Per GiB
|
|
||||||
#
|
|
||||||
# Set the number of seconds to wait, for each GiB of data, before timing out. If transfering files across drives or network, increase this value as needed.
|
|
||||||
#cpsTimePerGiB=60
|
|
||||||
|
|
||||||
# CouchPotato wait_for
|
# CouchPotato wait_for
|
||||||
#
|
#
|
||||||
# Set the number of minutes to wait after calling the renamer, to check the movie has changed status.
|
# Set the number of minutes to wait after calling the renamer, to check the movie has changed status.
|
||||||
|
@ -102,11 +102,6 @@
|
||||||
# Set the number of seconds to wait before calling post-process in SickBeard.
|
# Set the number of seconds to wait before calling post-process in SickBeard.
|
||||||
#sbdelay=0
|
#sbdelay=0
|
||||||
|
|
||||||
# SickBeard process Time Per GiB
|
|
||||||
#
|
|
||||||
# Set the number of seconds to wait, for each GiB of data, before timing out. If transfering files across drives or network, increase this value as needed.
|
|
||||||
#sbTimePerGiB=60
|
|
||||||
|
|
||||||
# SickBeard watch directory.
|
# SickBeard watch directory.
|
||||||
#
|
#
|
||||||
# set this if SickBeard and nzbGet are on different systems.
|
# set this if SickBeard and nzbGet are on different systems.
|
||||||
|
@ -135,26 +130,23 @@
|
||||||
#ndCategory=tv
|
#ndCategory=tv
|
||||||
|
|
||||||
# NzbDrone host.
|
# NzbDrone host.
|
||||||
#ndHost=localhost
|
#ndhost=localhost
|
||||||
|
|
||||||
# NzbDrone port.
|
# NzbDrone port.
|
||||||
#ndPort=8989
|
#ndport=8989
|
||||||
|
|
||||||
# NzbDrone API key.
|
# NzbDrone API key.
|
||||||
#ndAPIKey=
|
#ndapikey=
|
||||||
|
|
||||||
# NzbDrone uses SSL (0, 1).
|
# NzbDrone uses SSL (0, 1).
|
||||||
#
|
#
|
||||||
# Set to 1 if using SSL, else set to 0.
|
# Set to 1 if using SSL, else set to 0.
|
||||||
#ndSSL=0
|
#ndssl=0
|
||||||
|
|
||||||
# NzbDrone web root.
|
# NzbDrone web root.
|
||||||
#
|
#
|
||||||
# set this if using a reverse proxy.
|
# set this if using a reverse proxy.
|
||||||
#ndWebRoot=
|
#ndweb_root=
|
||||||
|
|
||||||
# Prefer NzbDrone if categories clash (0, 1).
|
|
||||||
#ndPrefer=0
|
|
||||||
|
|
||||||
## HeadPhones
|
## HeadPhones
|
||||||
|
|
||||||
|
@ -187,11 +179,6 @@
|
||||||
# set as required to ensure correct processing.
|
# set as required to ensure correct processing.
|
||||||
#hpdelay=65
|
#hpdelay=65
|
||||||
|
|
||||||
# HeadPhones process Time Per GiB
|
|
||||||
#
|
|
||||||
# Set the number of seconds to wait, for each GiB of data, before timing out. If transfering files across drives or network, increase this value as needed.
|
|
||||||
#hpTimePerGiB=60
|
|
||||||
|
|
||||||
## Mylar
|
## Mylar
|
||||||
|
|
||||||
# Mylar script category.
|
# Mylar script category.
|
||||||
|
|
100
nzbToMylar.py
100
nzbToMylar.py
|
@ -1,5 +1,105 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
#
|
#
|
||||||
|
##############################################################################
|
||||||
|
### NZBGET POST-PROCESSING SCRIPT ###
|
||||||
|
|
||||||
|
# Post-Process to Mylar.
|
||||||
|
#
|
||||||
|
# This script sends the download to your automated media management servers.
|
||||||
|
#
|
||||||
|
# NOTE: This script requires Python to be installed on your system.
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
### OPTIONS
|
||||||
|
|
||||||
|
## General
|
||||||
|
#
|
||||||
|
# Set to 1 if you want nzbToMedia to automatically check for and update to the latest version
|
||||||
|
#auto_update=0
|
||||||
|
|
||||||
|
## Mylar
|
||||||
|
|
||||||
|
# Mylar script category.
|
||||||
|
#
|
||||||
|
# category that gets called for post-processing with Mylar.
|
||||||
|
#myCategory=comics
|
||||||
|
|
||||||
|
# Mylar host.
|
||||||
|
#myhost=localhost
|
||||||
|
|
||||||
|
# Mylar port.
|
||||||
|
#myport=8090
|
||||||
|
|
||||||
|
# Mylar username.
|
||||||
|
#myusername=
|
||||||
|
|
||||||
|
# Mylar password.
|
||||||
|
#mypassword=
|
||||||
|
|
||||||
|
# Mylar uses ssl (0, 1).
|
||||||
|
#
|
||||||
|
# Set to 1 if using ssl, else set to 0.
|
||||||
|
#myssl=0
|
||||||
|
|
||||||
|
# Mylar web_root
|
||||||
|
#
|
||||||
|
# set this if using a reverse proxy.
|
||||||
|
#myweb_root=
|
||||||
|
|
||||||
|
## Extensions
|
||||||
|
|
||||||
|
# Media Extensions
|
||||||
|
#
|
||||||
|
# This is a list of media extensions that are used to verify that the download does contain valid media.
|
||||||
|
#mediaExtensions=.mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg,.vob,.iso
|
||||||
|
|
||||||
|
## Transcoder
|
||||||
|
|
||||||
|
# Transcode (0, 1).
|
||||||
|
#
|
||||||
|
# set to 1 to transcode, otherwise set to 0.
|
||||||
|
#transcode=0
|
||||||
|
|
||||||
|
# create a duplicate, or replace the original (0, 1).
|
||||||
|
#
|
||||||
|
# set to 1 to cretae a new file or 0 to replace the original
|
||||||
|
#duplicate=1
|
||||||
|
|
||||||
|
# ignore extensions
|
||||||
|
#
|
||||||
|
# list of extensions that won't be transcoded.
|
||||||
|
#ignoreExtensions=.avi,.mkv
|
||||||
|
|
||||||
|
# ffmpeg output settings.
|
||||||
|
#outputVideoExtension=.mp4
|
||||||
|
#outputVideoCodec=libx264
|
||||||
|
#outputVideoPreset=medium
|
||||||
|
#outputVideoFramerate=24
|
||||||
|
#outputVideoBitrate=800k
|
||||||
|
#outputAudioCodec=libmp3lame
|
||||||
|
#outputAudioBitrate=128k
|
||||||
|
#outputSubtitleCodec=
|
||||||
|
|
||||||
|
## WakeOnLan
|
||||||
|
|
||||||
|
# use WOL (0, 1).
|
||||||
|
#
|
||||||
|
# set to 1 to send WOL broadcast to the mac and test the server (e.g. xbmc) on the host and port specified.
|
||||||
|
#wolwake=0
|
||||||
|
|
||||||
|
# WOL MAC
|
||||||
|
#
|
||||||
|
# enter the mac address of the system to be woken.
|
||||||
|
#wolmac=00:01:2e:2D:64:e1
|
||||||
|
|
||||||
|
# Set the Host and Port of a server to verify system has woken.
|
||||||
|
#wolhost=192.168.1.37
|
||||||
|
#wolport=80
|
||||||
|
|
||||||
|
### NZBGET POST-PROCESSING SCRIPT ###
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
# Stub file to call nzbToMedia
|
# Stub file to call nzbToMedia
|
||||||
import nzbToMedia
|
import nzbToMedia
|
||||||
|
|
||||||
|
|
109
nzbToNzbDrone.py
109
nzbToNzbDrone.py
|
@ -1,5 +1,114 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
#
|
#
|
||||||
|
##############################################################################
|
||||||
|
### NZBGET POST-PROCESSING SCRIPT ###
|
||||||
|
|
||||||
|
# Post-Process to NzbDrone.
|
||||||
|
#
|
||||||
|
# This script sends the download to your automated media management servers.
|
||||||
|
#
|
||||||
|
# NOTE: This script requires Python to be installed on your system.
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
### OPTIONS ###
|
||||||
|
|
||||||
|
## General
|
||||||
|
#
|
||||||
|
# Set to 1 if you want nzbToMedia to automatically check for and update to the latest version
|
||||||
|
#auto_update=0
|
||||||
|
|
||||||
|
## NzbDrone
|
||||||
|
|
||||||
|
# NzbDrone script category.
|
||||||
|
#
|
||||||
|
# category that gets called for post-processing with NzbDrone.
|
||||||
|
#ndCategory=tv
|
||||||
|
|
||||||
|
# NzbDrone host.
|
||||||
|
#ndhost=localhost
|
||||||
|
|
||||||
|
# NzbDrone port.
|
||||||
|
#ndport=8081
|
||||||
|
|
||||||
|
# NzbDrone username.
|
||||||
|
#ndusername=
|
||||||
|
|
||||||
|
# NzbDrone password.
|
||||||
|
#ndpassword=
|
||||||
|
|
||||||
|
# NzbDrone uses ssl (0, 1).
|
||||||
|
#
|
||||||
|
# Set to 1 if using ssl, else set to 0.
|
||||||
|
#ndssl=0
|
||||||
|
|
||||||
|
# NzbDrone web_root
|
||||||
|
#
|
||||||
|
# set this if using a reverse proxy.
|
||||||
|
#ndweb_root=
|
||||||
|
|
||||||
|
# NzbDrone delay
|
||||||
|
#
|
||||||
|
# Set the number of seconds to wait before calling post-process in NzbDrone.
|
||||||
|
#nddelay=0
|
||||||
|
|
||||||
|
# NzbDrone watch directory.
|
||||||
|
#
|
||||||
|
# set this if NzbDrone and nzbGet are on different systems.
|
||||||
|
#ndwatch_dir=
|
||||||
|
|
||||||
|
## Extensions
|
||||||
|
|
||||||
|
# Media Extensions
|
||||||
|
#
|
||||||
|
# This is a list of media extensions that are used to verify that the download does contain valid media.
|
||||||
|
#mediaExtensions=.mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg,.vob,.iso
|
||||||
|
|
||||||
|
## Transcoder
|
||||||
|
|
||||||
|
# Transcode (0, 1).
|
||||||
|
#
|
||||||
|
# set to 1 to transcode, otherwise set to 0.
|
||||||
|
#transcode=0
|
||||||
|
|
||||||
|
# create a duplicate, or replace the original (0, 1).
|
||||||
|
#
|
||||||
|
# set to 1 to cretae a new file or 0 to replace the original
|
||||||
|
#duplicate=1
|
||||||
|
|
||||||
|
# ignore extensions
|
||||||
|
#
|
||||||
|
# list of extensions that won't be transcoded.
|
||||||
|
#ignoreExtensions=.avi,.mkv
|
||||||
|
|
||||||
|
# ffmpeg output settings.
|
||||||
|
#outputVideoExtension=.mp4
|
||||||
|
#outputVideoCodec=libx264
|
||||||
|
#outputVideoPreset=medium
|
||||||
|
#outputVideoFramerate=24
|
||||||
|
#outputVideoBitrate=800k
|
||||||
|
#outputAudioCodec=libmp3lame
|
||||||
|
#outputAudioBitrate=128k
|
||||||
|
#outputSubtitleCodec=
|
||||||
|
|
||||||
|
## WakeOnLan
|
||||||
|
|
||||||
|
# use WOL (0, 1).
|
||||||
|
#
|
||||||
|
# set to 1 to send WOL broadcast to the mac and test the server (e.g. xbmc) on the host and port specified.
|
||||||
|
#wolwake=0
|
||||||
|
|
||||||
|
# WOL MAC
|
||||||
|
#
|
||||||
|
# enter the mac address of the system to be woken.
|
||||||
|
#wolmac=00:01:2e:2D:64:e1
|
||||||
|
|
||||||
|
# Set the Host and Port of a server to verify system has woken.
|
||||||
|
#wolhost=192.168.1.37
|
||||||
|
#wolport=80
|
||||||
|
|
||||||
|
### NZBGET POST-PROCESSING SCRIPT ###
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
# Stub file to call nzbToMedia
|
# Stub file to call nzbToMedia
|
||||||
import nzbToMedia
|
import nzbToMedia
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,134 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
#
|
#
|
||||||
|
##############################################################################
|
||||||
|
### NZBGET POST-PROCESSING SCRIPT ###
|
||||||
|
|
||||||
|
# Post-Process to SickBeard.
|
||||||
|
#
|
||||||
|
# This script sends the download to your automated media management servers.
|
||||||
|
#
|
||||||
|
# NOTE: This script requires Python to be installed on your system.
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
### OPTIONS ###
|
||||||
|
|
||||||
|
## General
|
||||||
|
#
|
||||||
|
# Set to 1 if you want nzbToMedia to automatically check for and update to the latest version
|
||||||
|
#auto_update=0
|
||||||
|
|
||||||
|
# Media Extensions
|
||||||
|
#
|
||||||
|
# This is a list of media extensions that are used to verify that the download does contain valid media.
|
||||||
|
#mediaExtensions=.mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg,.vob,.iso
|
||||||
|
|
||||||
|
## SickBeard
|
||||||
|
|
||||||
|
# SickBeard script category.
|
||||||
|
#
|
||||||
|
# category that gets called for post-processing with SickBeard.
|
||||||
|
#sbCategory=tv
|
||||||
|
|
||||||
|
# SickBeard host.
|
||||||
|
#sbhost=localhost
|
||||||
|
|
||||||
|
# SickBeard port.
|
||||||
|
#sbport=8081
|
||||||
|
|
||||||
|
# SickBeard username.
|
||||||
|
#sbusername=
|
||||||
|
|
||||||
|
# SickBeard password.
|
||||||
|
#sbpassword=
|
||||||
|
|
||||||
|
# SickBeard uses ssl (0, 1).
|
||||||
|
#
|
||||||
|
# Set to 1 if using ssl, else set to 0.
|
||||||
|
#sbssl=0
|
||||||
|
|
||||||
|
# SickBeard web_root
|
||||||
|
#
|
||||||
|
# set this if using a reverse proxy.
|
||||||
|
#sbweb_root=
|
||||||
|
|
||||||
|
# SickBeard delay
|
||||||
|
#
|
||||||
|
# Set the number of seconds to wait before calling post-process in SickBeard.
|
||||||
|
#sbdelay=0
|
||||||
|
|
||||||
|
# SickBeard watch directory.
|
||||||
|
#
|
||||||
|
# set this if SickBeard and nzbGet are on different systems.
|
||||||
|
#sbwatch_dir=
|
||||||
|
|
||||||
|
# SickBeard fork.
|
||||||
|
#
|
||||||
|
# set to default or auto to auto-detect the custom fork type.
|
||||||
|
#sbfork=auto
|
||||||
|
|
||||||
|
# SickBeard Delete Failed Downloads (0, 1)
|
||||||
|
#
|
||||||
|
# set to 1 to delete failed, or 0 to leave files in place.
|
||||||
|
#sbdelete_failed=0
|
||||||
|
|
||||||
|
# SickBeard process method.
|
||||||
|
#
|
||||||
|
# set this to move, copy, hardlin, symlink as appropriate if you want to over-ride SB defaults. Leave blank to use SB default.
|
||||||
|
#sbprocess_method=
|
||||||
|
|
||||||
|
## Extensions
|
||||||
|
|
||||||
|
# Media Extensions
|
||||||
|
#
|
||||||
|
# This is a list of media extensions that are used to verify that the download does contain valid media.
|
||||||
|
#mediaExtensions=.mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg,.vob,.iso
|
||||||
|
|
||||||
|
## Transcoder
|
||||||
|
|
||||||
|
# Transcode (0, 1).
|
||||||
|
#
|
||||||
|
# set to 1 to transcode, otherwise set to 0.
|
||||||
|
#transcode=0
|
||||||
|
|
||||||
|
# create a duplicate, or replace the original (0, 1).
|
||||||
|
#
|
||||||
|
# set to 1 to cretae a new file or 0 to replace the original
|
||||||
|
#duplicate=1
|
||||||
|
|
||||||
|
# ignore extensions
|
||||||
|
#
|
||||||
|
# list of extensions that won't be transcoded.
|
||||||
|
#ignoreExtensions=.avi,.mkv
|
||||||
|
|
||||||
|
# ffmpeg output settings.
|
||||||
|
#outputVideoExtension=.mp4
|
||||||
|
#outputVideoCodec=libx264
|
||||||
|
#outputVideoPreset=medium
|
||||||
|
#outputVideoFramerate=24
|
||||||
|
#outputVideoBitrate=800k
|
||||||
|
#outputAudioCodec=libmp3lame
|
||||||
|
#outputAudioBitrate=128k
|
||||||
|
#outputSubtitleCodec=
|
||||||
|
|
||||||
|
## WakeOnLan
|
||||||
|
|
||||||
|
# use WOL (0, 1).
|
||||||
|
#
|
||||||
|
# set to 1 to send WOL broadcast to the mac and test the server (e.g. xbmc) on the host and port specified.
|
||||||
|
#wolwake=0
|
||||||
|
|
||||||
|
# WOL MAC
|
||||||
|
#
|
||||||
|
# enter the mac address of the system to be woken.
|
||||||
|
#wolmac=00:01:2e:2D:64:e1
|
||||||
|
|
||||||
|
# Set the Host and Port of a server to verify system has woken.
|
||||||
|
#wolhost=192.168.1.37
|
||||||
|
#wolport=80
|
||||||
|
|
||||||
|
### NZBGET POST-PROCESSING SCRIPT ###
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
# Stub file to call nzbToMedia
|
# Stub file to call nzbToMedia
|
||||||
import nzbToMedia
|
import nzbToMedia
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import nzbtomedia
|
||||||
from lib import requests
|
from lib import requests
|
||||||
from nzbtomedia.Transcoder import Transcoder
|
from nzbtomedia.Transcoder import Transcoder
|
||||||
from nzbtomedia.nzbToMediaSceneExceptions import process_all_exceptions
|
from nzbtomedia.nzbToMediaSceneExceptions import process_all_exceptions
|
||||||
from nzbtomedia.nzbToMediaUtil import convert_to_ascii
|
from nzbtomedia.nzbToMediaUtil import convert_to_ascii, delete
|
||||||
from nzbtomedia import logger
|
from nzbtomedia import logger
|
||||||
|
|
||||||
class autoProcessMovie:
|
class autoProcessMovie:
|
||||||
|
@ -168,15 +168,10 @@ class autoProcessMovie:
|
||||||
else:
|
else:
|
||||||
protocol = "http://"
|
protocol = "http://"
|
||||||
|
|
||||||
# don't delay when we are calling this script manually.
|
|
||||||
if clientAgent == "manual":
|
|
||||||
delay = 0
|
|
||||||
|
|
||||||
baseURL = protocol + host + ":" + port + web_root + "/api/" + apikey
|
baseURL = protocol + host + ":" + port + web_root + "/api/" + apikey
|
||||||
|
|
||||||
media_id, download_id, release_id, release_status = self.find_media_id(baseURL, download_id, dirName, nzbName) # get the CPS database movie id for this movie.
|
media_id, download_id, release_id, release_status = self.find_media_id(baseURL, download_id, dirName, nzbName) # get the CPS database movie id for this movie.
|
||||||
|
|
||||||
|
|
||||||
# failed to get a download id
|
# failed to get a download id
|
||||||
if release_status != "snatched":
|
if release_status != "snatched":
|
||||||
logger.postprocess("%s has is marked with a status of [%s] by CouchPotatoServer, skipping ...", nzbName, release_status.upper())
|
logger.postprocess("%s has is marked with a status of [%s] by CouchPotatoServer, skipping ...", nzbName, release_status.upper())
|
||||||
|
@ -217,7 +212,7 @@ class autoProcessMovie:
|
||||||
logger.debug("Opening URL: %s", url)
|
logger.debug("Opening URL: %s", url)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
r = requests.get(url, data=params)
|
r = requests.get(url, params=params)
|
||||||
except requests.ConnectionError:
|
except requests.ConnectionError:
|
||||||
logger.error("Unable to open URL")
|
logger.error("Unable to open URL")
|
||||||
return 1 # failure
|
return 1 # failure
|
||||||
|
@ -254,12 +249,9 @@ class autoProcessMovie:
|
||||||
if line: logger.postprocess("%s", line)
|
if line: logger.postprocess("%s", line)
|
||||||
|
|
||||||
logger.postprocess("%s FAILED!, Trying the next best release on CouchPotatoServer", nzbName)
|
logger.postprocess("%s FAILED!, Trying the next best release on CouchPotatoServer", nzbName)
|
||||||
if delete_failed and not dirName in [sys.argv[0],'/','']:
|
if delete_failed and not os.path.dirname(dirName) == dirName:
|
||||||
logger.postprocess("Deleting failed files and folder %s", dirName)
|
logger.postprocess("Deleting failed files and folder %s", dirName)
|
||||||
try:
|
delete(dirName)
|
||||||
shutil.rmtree(dirName)
|
|
||||||
except:
|
|
||||||
logger.error("Unable to delete folder %s", dirName)
|
|
||||||
return 0 # success
|
return 0 # success
|
||||||
|
|
||||||
if not release_id:
|
if not release_id:
|
||||||
|
@ -269,15 +261,20 @@ class autoProcessMovie:
|
||||||
return 0 # success
|
return 0 # success
|
||||||
|
|
||||||
# we will now check to see if CPS has finished renaming before returning to TorrentToMedia and unpausing.
|
# we will now check to see if CPS has finished renaming before returning to TorrentToMedia and unpausing.
|
||||||
|
timeout = time.time() + 60 * int(wait_for)
|
||||||
while (True): # only wait 2 (default) minutes, then return.
|
while (True): # only wait 2 (default) minutes, then return.
|
||||||
|
if time.time() > timeout:
|
||||||
|
break
|
||||||
|
|
||||||
current_status = self.get_status(baseURL, release_id)
|
current_status = self.get_status(baseURL, release_id)
|
||||||
if current_status is None:
|
if current_status is None:
|
||||||
logger.error("Could not find a current status for %s", nzbName)
|
logger.error("Could not find a current status for %s on CouchPotatoServer", nzbName)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
if current_status != release_status: # Something has changed. CPS must have processed this movie.
|
if current_status != release_status: # Something has changed. CPS must have processed this movie.
|
||||||
logger.postprocess("SUCCESS: This release is now marked as status [%s] in CouchPotatoServer", current_status.upper())
|
logger.postprocess("SUCCESS: This release is now marked as status [%s] in CouchPotatoServer", current_status.upper())
|
||||||
return 0 # success
|
return 0 # success
|
||||||
else: # The status hasn't changed. we have waited 2 minutes which is more than enough. uTorrent can resule seeding now.
|
|
||||||
logger.warning("The movie does not appear to have changed status after %s minutes. Please check CouchPotato Logs", wait_for)
|
# The status hasn't changed. we have waited 2 minutes which is more than enough. uTorrent can resule seeding now.
|
||||||
return 1 # failure
|
logger.warning("The movie does not appear to have changed status after %s minutes. Please check CouchPotato Logs", wait_for)
|
||||||
|
return 1 # failure
|
|
@ -1,3 +1,4 @@
|
||||||
|
import os
|
||||||
import time
|
import time
|
||||||
import datetime
|
import datetime
|
||||||
import urllib
|
import urllib
|
||||||
|
@ -7,6 +8,35 @@ from nzbtomedia.nzbToMediaUtil import convert_to_ascii
|
||||||
from nzbtomedia import logger
|
from nzbtomedia import logger
|
||||||
|
|
||||||
class autoProcessMusic:
|
class autoProcessMusic:
|
||||||
|
def get_status(self, baseURL, apikey, dirName):
|
||||||
|
release_status = None
|
||||||
|
|
||||||
|
logger.debug("Attempting to get current status for release:%s", os.path.basename(dirName))
|
||||||
|
|
||||||
|
url = baseURL
|
||||||
|
|
||||||
|
params = {}
|
||||||
|
params['apikey'] = apikey
|
||||||
|
params['cmd'] = "getHistory"
|
||||||
|
|
||||||
|
logger.debug("Opening URL: %s", url)
|
||||||
|
|
||||||
|
try:
|
||||||
|
r = requests.get(url, params=params)
|
||||||
|
except requests.ConnectionError:
|
||||||
|
logger.error("Unable to open URL")
|
||||||
|
return None, None
|
||||||
|
|
||||||
|
try:
|
||||||
|
result = r.json()
|
||||||
|
for album in result:
|
||||||
|
if os.path.basename(dirName) == album['FolderName']:
|
||||||
|
release_status = album["Status"]
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return release_status
|
||||||
|
|
||||||
def process(self, dirName, nzbName=None, status=0, clientAgent="manual", inputCategory=None):
|
def process(self, dirName, nzbName=None, status=0, clientAgent="manual", inputCategory=None):
|
||||||
if dirName is None:
|
if dirName is None:
|
||||||
logger.error("No directory was given!")
|
logger.error("No directory was given!")
|
||||||
|
@ -43,13 +73,10 @@ class autoProcessMusic:
|
||||||
protocol = "https://"
|
protocol = "https://"
|
||||||
else:
|
else:
|
||||||
protocol = "http://"
|
protocol = "http://"
|
||||||
# don't delay when we are calling this script manually.
|
|
||||||
if clientAgent == "manual":
|
|
||||||
delay = 0
|
|
||||||
|
|
||||||
nzbName, dirName = convert_to_ascii(nzbName, dirName)
|
nzbName, dirName = convert_to_ascii(nzbName, dirName)
|
||||||
|
|
||||||
baseURL = protocol + host + ":" + port + web_root + "/api?"
|
baseURL = protocol + host + ":" + port + web_root + "/api"
|
||||||
|
|
||||||
if status == 0:
|
if status == 0:
|
||||||
|
|
||||||
|
@ -60,14 +87,15 @@ class autoProcessMusic:
|
||||||
|
|
||||||
url = baseURL
|
url = baseURL
|
||||||
|
|
||||||
logger.postprocess("Waiting for %s seconds to allow HeadPhones to process newly extracted files", str(delay))
|
release_status = self.get_status(url, apikey, dirName)
|
||||||
|
if release_status != "Unprocessed":
|
||||||
time.sleep(delay)
|
logger.error("%s is marked with a status of %s on HeadPhones, skipping ...", nzbName, release_status)
|
||||||
|
return 1
|
||||||
|
|
||||||
logger.debug("Opening URL: %s", url)
|
logger.debug("Opening URL: %s", url)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
r = requests.get(url, data=params)
|
r = requests.get(url, params=params)
|
||||||
except requests.ConnectionError:
|
except requests.ConnectionError:
|
||||||
logger.error("Unable to open URL")
|
logger.error("Unable to open URL")
|
||||||
return 1 # failure
|
return 1 # failure
|
||||||
|
@ -83,16 +111,21 @@ class autoProcessMusic:
|
||||||
logger.postprocess("The download failed. Nothing to process")
|
logger.postprocess("The download failed. Nothing to process")
|
||||||
return 0 # Success (as far as this script is concerned)
|
return 0 # Success (as far as this script is concerned)
|
||||||
|
|
||||||
if clientAgent == "manual":
|
|
||||||
return 0 # success
|
|
||||||
|
|
||||||
# we will now wait 1 minutes for this album to be processed before returning to TorrentToMedia and unpausing.
|
# we will now wait 1 minutes for this album to be processed before returning to TorrentToMedia and unpausing.
|
||||||
## Hopefully we can use a "getHistory" check in here to confirm processing complete...
|
timeout = time.time() + 60 * 2
|
||||||
start = datetime.datetime.now() # set time for timeout
|
while (True): # only wait 2 (default) minutes, then return.
|
||||||
while (datetime.datetime.now() - start) < datetime.timedelta(minutes=1): # only wait 2 minutes, then return to TorrentToMedia
|
if time.time() > timeout:
|
||||||
time.sleep(20) # Just stop this looping infinitely and hogging resources for 2 minutes ;)
|
break
|
||||||
else: # The status hasn't changed. we have waited 2 minutes which is more than enough. uTorrent can resume seeding now.
|
|
||||||
logger.postprocess("This album should have completed processing. Please check HeadPhones Logs")
|
current_status = self.get_status(url, apikey, dirName)
|
||||||
# logger.warning("The album does not appear to have changed status after 2 minutes. Please check HeadPhones Logs")
|
if current_status is None:
|
||||||
# return 1 # failure
|
logger.error("Could not find a current status for %s on HeadPhones", nzbName)
|
||||||
return 0 # success for now.
|
return 1
|
||||||
|
|
||||||
|
if current_status != release_status: # Something has changed. CPS must have processed this movie.
|
||||||
|
logger.postprocess("SUCCESS: This release is now marked as status [%s] in HeadPhones",current_status.upper())
|
||||||
|
return 0 # success
|
||||||
|
|
||||||
|
# The status hasn't changed. we have waited 2 minutes which is more than enough. uTorrent can resule seeding now.
|
||||||
|
logger.warning("The music album does not appear to have changed status after %s minutes. Please check HeadPhones Logs",2)
|
||||||
|
return 1 # failure
|
||||||
|
|
|
@ -3,12 +3,13 @@ import json
|
||||||
import os
|
import os
|
||||||
import urllib
|
import urllib
|
||||||
import time
|
import time
|
||||||
|
import sys
|
||||||
import nzbtomedia
|
import nzbtomedia
|
||||||
from lib import requests
|
from lib import requests
|
||||||
from nzbtomedia.Transcoder import Transcoder
|
from nzbtomedia.Transcoder import Transcoder
|
||||||
from nzbtomedia.nzbToMediaAutoFork import autoFork
|
from nzbtomedia.nzbToMediaAutoFork import autoFork
|
||||||
from nzbtomedia.nzbToMediaSceneExceptions import process_all_exceptions
|
from nzbtomedia.nzbToMediaSceneExceptions import process_all_exceptions
|
||||||
from nzbtomedia.nzbToMediaUtil import convert_to_ascii, is_sample, flatten, delete
|
from nzbtomedia.nzbToMediaUtil import convert_to_ascii, is_sample, flatten, delete, is_subdir
|
||||||
from nzbtomedia import logger
|
from nzbtomedia import logger
|
||||||
|
|
||||||
class autoProcessTV:
|
class autoProcessTV:
|
||||||
|
@ -58,10 +59,6 @@ class autoProcessTV:
|
||||||
delete_failed = int(nzbtomedia.CFG[section][inputCategory]["delete_failed"])
|
delete_failed = int(nzbtomedia.CFG[section][inputCategory]["delete_failed"])
|
||||||
except:
|
except:
|
||||||
delete_failed = 0
|
delete_failed = 0
|
||||||
try:
|
|
||||||
delay = float(nzbtomedia.CFG[section][inputCategory]["delay"])
|
|
||||||
except:
|
|
||||||
delay = 0
|
|
||||||
try:
|
try:
|
||||||
SampleIDs = (nzbtomedia.CFG["Extensions"]["SampleIDs"])
|
SampleIDs = (nzbtomedia.CFG["Extensions"]["SampleIDs"])
|
||||||
except:
|
except:
|
||||||
|
@ -165,25 +162,20 @@ class autoProcessTV:
|
||||||
|
|
||||||
url = None
|
url = None
|
||||||
if section == "SickBeard":
|
if section == "SickBeard":
|
||||||
url = protocol + host + ":" + port + web_root + "/home/postprocess/processEpisode?" + urllib.urlencode(fork_params)
|
url = protocol + host + ":" + port + web_root + "/home/postprocess/processEpisode"
|
||||||
elif section == "NzbDrone":
|
elif section == "NzbDrone":
|
||||||
url = protocol + host + ":" + port + web_root + "/api/command"
|
url = protocol + host + ":" + port + web_root + "/api/command"
|
||||||
|
|
||||||
if clientAgent == "manual":delay = 0
|
|
||||||
logger.postprocess("Waiting for %s seconds to allow %s to process newly extracted files", str(delay), section)
|
|
||||||
|
|
||||||
time.sleep(delay)
|
|
||||||
|
|
||||||
logger.debug("Opening URL: %s", url)
|
logger.debug("Opening URL: %s", url)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
r = None
|
r = None
|
||||||
if section == "SickBeard":
|
if section == "SickBeard":
|
||||||
r = requests.get(url, auth=(username, password), stream=True)
|
r = requests.get(url, auth=(username, password), params=fork_params, stream=True)
|
||||||
elif section == "NzbDrone":
|
elif section == "NzbDrone":
|
||||||
data = json.dumps({"name": "DownloadedEpisodesScan", "path": dirName})
|
params = {"name": "DownloadedEpisodesScan", "path": dirName}
|
||||||
headers = {"X-Api-Key": apikey}
|
headers = {"X-Api-Key": apikey}
|
||||||
r = requests.get(url, data=data, headers=headers, stream=True)
|
r = requests.get(url, params=params, headers=headers, stream=True)
|
||||||
except requests.ConnectionError:
|
except requests.ConnectionError:
|
||||||
logger.error("Unable to open URL")
|
logger.error("Unable to open URL")
|
||||||
return 1 # failure
|
return 1 # failure
|
||||||
|
@ -191,6 +183,7 @@ class autoProcessTV:
|
||||||
for line in r.iter_lines():
|
for line in r.iter_lines():
|
||||||
if line: logger.postprocess("%s", line)
|
if line: logger.postprocess("%s", line)
|
||||||
|
|
||||||
if status != 0 and delete_failed and not dirName in ['sys.argv[0]','/','']:
|
if status != 0 and delete_failed and not os.path.dirname(dirName) == dirName:
|
||||||
|
logger.postprocess("Deleting failed files and folder %s", dirName)
|
||||||
delete(dirName)
|
delete(dirName)
|
||||||
return 0 # Success
|
return 0 # Success
|
||||||
|
|
|
@ -443,3 +443,14 @@ def cleanup_directories(inputCategory, processCategories, result, directory):
|
||||||
logger.info("Directory %s still contains %s media and/or meta files. This directory will not be removed.", directory, num_files_new)
|
logger.info("Directory %s still contains %s media and/or meta files. This directory will not be removed.", directory, num_files_new)
|
||||||
for item in file_list:
|
for item in file_list:
|
||||||
logger.debug("media/meta file found: %s", item)
|
logger.debug("media/meta file found: %s", item)
|
||||||
|
|
||||||
|
def is_subdir(path, directory):
|
||||||
|
path = os.path.realpath(path)
|
||||||
|
directory = os.path.realpath(directory)
|
||||||
|
|
||||||
|
relative = os.path.relpath(path, directory)
|
||||||
|
|
||||||
|
if relative.startswith(os.pardir + os.sep):
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return True
|
Loading…
Add table
Add a link
Reference in a new issue