Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

Help with SABNZBD script


  • Please log in to reply

#1
Elmomcd

Elmomcd

    New Member

  • Member
  • Pip
  • 2 posts
Hi, i realise there is a forum for these scripts but it seems to be very little activity on there now a days. I'm a newbie/learner when it comes to writing bits of code.

I'm using Sickbeard/couchpotato/SABNZBD and i'm wanting a script that will:
  • Download item from Sickbeard/Couch Potato
  • Convert from .mkv to .mp4/.m4v
  • Metatag the show/film with name, poster etc
  • Move to iTunes Automatically Add folder
  • Notify me via Prowl its done

I'm watching everything on my ATV3 thats why i want it converting and metatagging. I have a script that does the converting and moving to the itunes folder but it don't tag it properly or send me a notification. I have a separate script that will notify me via prowl but dont know how to bed this into this script.

Current Apple TV convert script is

@ECHO OFF

:: ##################################
::
:: IMPORTANT USAGE NOTES
::
:: READ THIS NOTE OR THE SCRIPT WILL NOT WORK
::
:: You need to be sure that the "Automatically add to iTunes" location matches your computer, search for it
:: it is way down in the script on the 'move' line.
::
:: Also you need to either ensure that AtomicParsley and HandBrakeCLI are in those locations listed,
:: or modify the locations listed to match where they reside on your system.
::
:: SABnzbd needs to be set to not download Samples
:: To do this go into the SAB web interface, CONFIG | SWITCHES | and set IGNORE SAMPLES to "do not download".
::
::
:: This script is setup for how I have SORTING enabled in SAB, which is such that it outputs the TV Shows like this:
::
:: TV Show Name - SxxExx.ext
::
:: This is my sort string for TV Shows in SABnzbd: %sn/%sn - S%0sE%0e.%ext
::
:: If you want to delete the source files and directory when this job is complete
:: search for "Delete Source Directory" and take out the "::" in front of the "rmdir" line below it.
::
:: You can receive an email of the summary of the jobs that this script runs on by doing:
:: SAB Web interface, CONFIG | EMAIL | check the "always" box for Email Notificaion on Job Completion
:: and complete the "Email Account Settings" (search the SAB forums if you're not sure how to do this.)
::
:: ##################################


:: What's another word for Thesaurus?  -- Steven Wright

Echo.
Echo APPLETV SCRIPT DETAILS:
Echo.

set AtomicParsley="C:\Program Files (x86)\SABnzbd\AtomicParsley\AtomicParsley.exe"
set HandBrakeCLI="C:\Program Files (x86)\SABnzbd\HandBrake\HandBrakeCLI.exe"
setlocal enableextensions enabledelayedexpansion

set name=%3
set name=%name:"=%

Echo.
Echo SABnzbd+ Output Parameters Definitions:
Echo.
Echo 1: Directory:
Echo 1: %1
Echo 2: NZB:
Echo 2: %2
Echo 3: Job Name:
Echo 3: %3
Echo 4: Newzbin #:
Echo 4: %4
Echo 5: Category:
Echo 5: %5
Echo 6: Group:
Echo 6: %6
Echo 7: Status:
Echo 7: %7
Echo.

pushd %1

Echo.
Echo Determining the file type from known list...
Echo.
Echo   - Known list: MKV, AVI, M4V, MP4, WMV
Echo.

Echo The file(s) found:

dir /b

Echo.
if exist *.mkv set filetype=.mkv && GOTO Transcode
if exist *.avi set filetype=.avi && GOTO Transcode
if exist *.mp4 set filetype=.mp4 && GOTO Transcode
if exist *.m4V set filetype=.m4V && GOTO Transcode
if exist *.wmv set filetype=.wmv && GOTO Transcode
if exist *.img GOTO BAILIMAGE
if exist *.iso GOTO BAILIMAGE

Echo.
Echo.
Echo Sorry, no valid video file found
Echo.
Echo The directory searched for a file is:
Echo %1

GOTO :EOF


:tagTVshow

for /f "tokens=* delims= " %%a in ('dir/b *.m4v') do (
set path=%%~DPa
set filename=%%~NXa
for /f "tokens=1-2 delims=-" %%i in ("%%a") do (
set show=%%i
set show=!show:~0,-1!
set S=%%~Nj
set season=!S:~2,2!
set episode=!S:~5,2!
)
)

Echo Tagging and injecting into iTunes
Echo.
Echo  - File name = %filename%
Echo  - Show = %show%
Echo  - Season = %season%
Echo  - Episode = %episode%

%AtomicParsley% "%path%%filename%" --overWrite --title "%show%" --genre "TV Shows" --stik "TV Show" --TVShowName "%show%" --TVSeason %season% --TVEpisodeNum %episode%  >nul

Echo  - Tag and inject completed

Move "%path%%filename%" "G:\-=To Tag=-." >nul

Echo  - TV Show moved to destination
Echo.

Echo The TV Show is on your AppleTV ready for viewing.

:: Delete Source Directory
:: Take out the "::" in front of the line below to delete the source files
:: rmdir /s /q %1

GOTO :EOF


:Transcode
Echo.
Echo Transcoding the TV Show
Echo.

for /f "tokens=* delims=" %%i in ('dir/b/a-d *%filetype%') do (
      Echo.
      %HandBrakeCLI% --input "%%i" --output "%%~ni%.m4v" --preset="AppleTV" >nul
      ECHO.
)

Echo  - Transcoding complete.
Echo.


GOTO tagTVshow

:BAILIMAGE
Echo.
Echo A DVD Image file was found, it may contain multiple Episodes
Echo so you will need to do this manually in the HandBrake Application.
Echo.
Echo Look for multiple "Titles" in Handbrake - these are the episodes.
GOTO :EOF

:EOF

and a script that notifies me via prowl is

set API="cd2291e4ce41ad83278de68b71172cxxxxxxxxxx"

Set Item=%3
setlocal enableextensions
set var_=%Item%
set var_=%var_:=%
set var_=%var_:=%
set var_=%var_:=%
set var_=%var_:"=%
set var_=%var_:!=%
set var_=%var_:_= %
set var_=%var_:;= %
set var_=%var_::= %
set var_=%var_:'= %
set var_=%var_:,= %
endlocal & set ItemConvert=%var_%
Set ItemConvert= "%ItemConvert%"
set priority=2
set desc=%ItemConvert%

cscript C:\prowl.vbs %API% %priority% %desc%

Any help would be much appreciated, even if its just helping me understand how to edit/add to the current command files. I'm on Windows 7.
  • 0

Advertisements







Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP