Page 3 of 3

Re: OS X + HandBrakeCLI + Python = convert, iTunes and e-mail

Posted: September 10th, 2010, 7:42 pm
by macfloripa
One suggestion: a processing directory to improve performance with systems that have multiple disks. The output file is saved there, then moved to final directory upon successful completion.

Re: OS X + HandBrakeCLI + Python = convert, iTunes and e-mail

Posted: September 10th, 2010, 7:54 pm
by johnnytk36
macfloripa wrote: One suggestion: a processing directory to improve performance with systems that have multiple disks. The output file is saved there, then moved to final directory upon successful completion.
All of my files are downloaded to a general temp drive. Sabnzbd then moves the files to my 4TB raid 0 media center. That's where all the processing is done.

I do all of this with the sabnzbd catergory folder setting.

That's all I've needed.

Re: OS X + HandBrakeCLI + Python = convert, iTunes and e-mail

Posted: September 10th, 2010, 8:20 pm
by macfloripa
We have 2 types of processing going on here:

1) sabnzbd - download and unpack
and
2) handbrake

Based on the sabnzdb documentation it looks like user scripts are run after completed jobs are moved to the final directory. So a temp file would only help with downloading and unpacking.

To improve I/O performance I would like have handbrake use a temp directory for the output file (on a separate files system).

handbake -i filesystem_1/input_flle -o filesystem_2/outputfile

then move the outputfile to the sabnzbd final dir

Re: OS X + HandBrakeCLI + Python = convert, iTunes and e-mail

Posted: September 10th, 2010, 8:39 pm
by johnnytk36
ah, i see. I dont need that as my 4 drive raid zero is more than a beast to handle it all.

Its defiantly possible. I won't be doing it anytime soon.

This link will help you with the paths that are passed to the script.

http://wiki.sabnzbd.org/user-scripts

Re: OS X + HandBrakeCLI + Python = convert, iTunes and e-mail

Posted: January 21st, 2011, 6:20 am
by pracolas
Hi, I have a failure return under OSX:
  /usr/bin/python: can't find '__main__.py' in ''

ant idea?
thanks

Re: OS X + HandBrakeCLI + Python = convert, iTunes and e-mail

Posted: February 21st, 2011, 2:25 pm
by skyhawk326
I've been trying to get this to work for several hours and have made it through most of the errors on my own so far.  Now I'm down to a Errno 13 issue I can't seem to figure out.  here's the error I'm receiving:

Code: Select all

[ 2011-02-21 @ 13:19:27 ]  Final Directory                : /Users/Brooks/NZB/complete/TV/Two.And.A.Half.Men.S01E15.WS.DVDRip.XviD-SAiNTS.3
[ 2011-02-21 @ 13:19:27 ]  NZB Filename                   : Two.And.A.Half.Men.S01E15.WS.DVDRip.XviD-SAiNTS.nzb
[ 2011-02-21 @ 13:19:27 ]  Job Name                       : Two.And.A.Half.Men.S01E15.WS.DVDRip.XviD-SAiNTS
[ 2011-02-21 @ 13:19:27 ]  NewzBin NZB ID                 : 
[ 2011-02-21 @ 13:19:27 ]  NewzBin Category               : tv
[ 2011-02-21 @ 13:19:27 ]  Usenet Category                : alt.binaries.multimedia
[ 2011-02-21 @ 13:19:27 ]  File Types                     : ['*.avi', '*.mkv']
[ 2011-02-21 @ 13:19:27 ]  TV Format                      : ^(?P<show>.*) - (?P<season_number>\d+)x(?P<episode_number>\d+) - (?P<episode_ID>.*)$
[ 2011-02-21 @ 13:19:27 ]  Output Directory               : /Users/Brooks/NZB/complete/TV/Two.And.A.Half.Men.S01E15.WS.DVDRip.XviD-SAiNTS.3
[ 2011-02-21 @ 13:19:27 ]  Output Prefix                  : 
[ 2011-02-21 @ 13:19:27 ]  Output Postfix                 : 
[ 2011-02-21 @ 13:19:27 ]  Output Extension               : mp4
[ 2011-02-21 @ 13:19:27 ]  Handbrake Path                 : /Users/Brooks/Terminal/HandBrake
[ 2011-02-21 @ 13:19:27 ]  Handbrake Preset               : AppleTV 2
[ 2011-02-21 @ 13:19:27 ]  Handbrake Verbose              : False
[ 2011-02-21 @ 13:19:27 ]  Processsing file type *.avi
[ 2011-02-21 @ 13:19:27 ]  	/Users/Brooks/NZB/complete/TV/Two.And.A.Half.Men.S01E15.WS.DVDRip.XviD-SAiNTS.3/Two.And.A.Half.Men.S01E15.WS.DVDRip.XviD-SAiNTS.avi
[ 2011-02-21 @ 13:19:27 ]  		encoding : /Users/Brooks/NZB/complete/TV/Two.And.A.Half.Men.S01E15.WS.DVDRip.XviD-SAiNTS.3/Two.And.A.Half.Men.S01E15.WS.DVDRip.XviD-SAiNTS_processing.mp4
Traceback (most recent call last):
  File "/Users/Brooks/terminal/sick-beard/autoprocesstv/nachos_to_handbrake.py", line 131, in <module>
    p = subprocess.Popen( [ HANDBRAKE_PATH, '-i', input_file, '-o', output_file_processing, '--preset=' + HANDBRAKE_PRESET ], stdout = ( None if HANDBRAKE_COMMAND_OUTPUT else subprocess.PIPE ), stderr = ( None if HANDBRAKE_COMMAND_OUTPUT else subprocess.STDOUT ) )
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 595, in __init__
    errread, errwrite)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 1106, in _execute_child
    raise child_exception
OSError: [Errno 13] Permission denied
I've set the permissions for subprocess.py and the nachos_to_handbrake.py files to chmod 777 and +X... completely stuck fellas, anyone please help me out?

--SKY

Re: OS X + HandBrakeCLI + Python = convert, iTunes and e-mai

Posted: July 30th, 2011, 1:59 pm
by imthenachoman
I have not really had time to work on this in the last year and I'm finally getting back into it. I made this site to store stuff, details and the file.

https://sites.google.com/site/imthenach ... ing-script

If y'all could post your comments/problems there I can try to get them fixed.

Re: OS X + HandBrakeCLI + Python = convert, iTunes and e-mai

Posted: July 30th, 2011, 2:14 pm
by imthenachoman
Are you still having problem skyhawk326?
skyhawk326 wrote:I've been trying to get this to work for several hours and have made it through most of the errors on my own so far.  Now I'm down to a Errno 13 issue I can't seem to figure out.  here's the error I'm receiving:

Code: Select all

[ 2011-02-21 @ 13:19:27 ]  Final Directory                : /Users/Brooks/NZB/complete/TV/Two.And.A.Half.Men.S01E15.WS.DVDRip.XviD-SAiNTS.3
[ 2011-02-21 @ 13:19:27 ]  NZB Filename                   : Two.And.A.Half.Men.S01E15.WS.DVDRip.XviD-SAiNTS.nzb
[ 2011-02-21 @ 13:19:27 ]  Job Name                       : Two.And.A.Half.Men.S01E15.WS.DVDRip.XviD-SAiNTS
[ 2011-02-21 @ 13:19:27 ]  NewzBin NZB ID                 : 
[ 2011-02-21 @ 13:19:27 ]  NewzBin Category               : tv
[ 2011-02-21 @ 13:19:27 ]  Usenet Category                : alt.binaries.multimedia
[ 2011-02-21 @ 13:19:27 ]  File Types                     : ['*.avi', '*.mkv']
[ 2011-02-21 @ 13:19:27 ]  TV Format                      : ^(?P<show>.*) - (?P<season_number>\d+)x(?P<episode_number>\d+) - (?P<episode_ID>.*)$
[ 2011-02-21 @ 13:19:27 ]  Output Directory               : /Users/Brooks/NZB/complete/TV/Two.And.A.Half.Men.S01E15.WS.DVDRip.XviD-SAiNTS.3
[ 2011-02-21 @ 13:19:27 ]  Output Prefix                  : 
[ 2011-02-21 @ 13:19:27 ]  Output Postfix                 : 
[ 2011-02-21 @ 13:19:27 ]  Output Extension               : mp4
[ 2011-02-21 @ 13:19:27 ]  Handbrake Path                 : /Users/Brooks/Terminal/HandBrake
[ 2011-02-21 @ 13:19:27 ]  Handbrake Preset               : AppleTV 2
[ 2011-02-21 @ 13:19:27 ]  Handbrake Verbose              : False
[ 2011-02-21 @ 13:19:27 ]  Processsing file type *.avi
[ 2011-02-21 @ 13:19:27 ]  	/Users/Brooks/NZB/complete/TV/Two.And.A.Half.Men.S01E15.WS.DVDRip.XviD-SAiNTS.3/Two.And.A.Half.Men.S01E15.WS.DVDRip.XviD-SAiNTS.avi
[ 2011-02-21 @ 13:19:27 ]  		encoding : /Users/Brooks/NZB/complete/TV/Two.And.A.Half.Men.S01E15.WS.DVDRip.XviD-SAiNTS.3/Two.And.A.Half.Men.S01E15.WS.DVDRip.XviD-SAiNTS_processing.mp4
Traceback (most recent call last):
  File "/Users/Brooks/terminal/sick-beard/autoprocesstv/nachos_to_handbrake.py", line 131, in <module>
    p = subprocess.Popen( [ HANDBRAKE_PATH, '-i', input_file, '-o', output_file_processing, '--preset=' + HANDBRAKE_PRESET ], stdout = ( None if HANDBRAKE_COMMAND_OUTPUT else subprocess.PIPE ), stderr = ( None if HANDBRAKE_COMMAND_OUTPUT else subprocess.STDOUT ) )
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 595, in __init__
    errread, errwrite)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 1106, in _execute_child
    raise child_exception
OSError: [Errno 13] Permission denied
I've set the permissions for subprocess.py and the nachos_to_handbrake.py files to chmod 777 and +X... completely stuck fellas, anyone please help me out?

--SKY

Re: OS X + HandBrakeCLI + Python = convert, iTunes and e-mai

Posted: January 2nd, 2012, 4:19 am
by iveoles
Hey, not sure if you're still developing this code. A lot of the osx Apple TV2 scripts seem to have died out. I'm having the same problem as the guy above

Code: Select all

 [ 2012-01-02 @ 09:09:03 ]  NZB ID                         : 
[ 2012-01-02 @ 09:09:03 ]  Category                       : sickbeard
[ 2012-01-02 @ 09:09:03 ]  Final directory                : /Usenet Downloads/Sickbeard/Cheers - 1x01 - Give Me a Ring Sometime
[ 2012-01-02 @ 09:09:03 ]  Output directory               : /Usenet Downloads/Sickbeard/Cheers - 1x01 - Give Me a Ring Sometime
[ 2012-01-02 @ 09:09:03 ]  OS X Lion?                     : True
[ 2012-01-02 @ 09:09:03 ]  Date/Time Format               : [ %Y-%m-%d @ %H:%M:%S ]  
[ 2012-01-02 @ 09:09:03 ]  Separator                      :  : 
[ 2012-01-02 @ 09:09:03 ]  Print Config                   : True
[ 2012-01-02 @ 09:09:03 ]  File types                     : ['*.avi', '*.mkv']
[ 2012-01-02 @ 09:09:03 ]  Output File prefix             : 
[ 2012-01-02 @ 09:09:03 ]  Output File postfix            : 
[ 2012-01-02 @ 09:09:03 ]  Output File extension          : m4v
[ 2012-01-02 @ 09:09:03 ]  Delete original                : False
[ 2012-01-02 @ 09:09:03 ]  Handbrake path                 : /Users/iveoles/Documents/Scripts
[ 2012-01-02 @ 09:09:03 ]  Handbrake Pre-Preset Paramaters : False
[ 2012-01-02 @ 09:09:03 ]  Handbrake Post-Preset Paramaters : False
[ 2012-01-02 @ 09:09:03 ]  Handbrake preset               : AppleTV 2
[ 2012-01-02 @ 09:09:03 ]  Handbrake use all audio tracks : True
[ 2012-01-02 @ 09:09:03 ]  Print handbrake output         : False
[ 2012-01-02 @ 09:09:03 ]  Post processing                : False
[ 2012-01-02 @ 09:09:03 ]  Import to iTunes               : True
[ 2012-01-02 @ 09:09:03 ]  Delete after import to iTunes  : True
[ 2012-01-02 @ 09:09:03 ]  Append output                  : False
[ 2012-01-02 @ 09:09:03 ]  Processing file type : *.avi
Traceback (most recent call last):
  File "/Users/iveoles/Documents/Scripts/handbrake.py", line 239, in <module>
    handbrake_command.append( "--audio=" + get_audio_track_list( input_file ) )
  File "/Users/iveoles/Documents/Scripts/handbrake.py", line 89, in get_audio_track_list
    p = subprocess.Popen( handbrake_command, stdout = stdout, stderr = stderr )
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 672, in __init__
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1202, in _execute_child
OSError: [Errno 13] Permission denied

Re: OS X + HandBrakeCLI + Python = convert, iTunes and e-mai

Posted: January 4th, 2012, 11:46 pm
by imthenachoman
Humm. Got a hectic week this week but I'll look into it this weekend.

Does it work if you use the iPhone 4 preset?

HANDBRAKE_PRESET = "iPhone 4"
OUTPUT_EXTENSION = "mp4"

Re: OS X + HandBrakeCLI + Python = convert, iTunes and e-mai

Posted: April 25th, 2012, 5:53 pm
by imthenachoman
You guys still having problems? Contact me at the e-mail link at the bottom of this site: https://sites.google.com/site/imthenach ... ing-script.

Re: OS X + HandBrakeCLI + Python = convert, iTunes and e-mai

Posted: April 29th, 2012, 11:33 am
by agr85
I'm currently facing the same problem -- below are Sabnzbd log entries (replaced private directories by ***):

HANDBRAKE_COMMAND_OUTPUT = True
IMPORT_TO_ITUNES = False

Code: Select all

 
[ 2012-04-29 @ 17:14:28 ]  NZB ID                         : 
[ 2012-04-29 @ 17:14:28 ]  Category                       : movies
[ 2012-04-29 @ 17:14:28 ]  Final directory                : ***
[ 2012-04-29 @ 17:14:28 ]  Output directory               : ***
[ 2012-04-29 @ 17:14:28 ]  Processing file type : *.avi
[ 2012-04-29 @ 17:14:28 ]  Processing file type : *.mkv
Traceback (most recent call last):
  File "***/handbrake.py", line 239, in <module>
    handbrake_command.append( "--audio=" + get_audio_track_list( input_file ) )
  File "***/handbrake.py", line 89, in get_audio_track_list
    p = subprocess.Popen( handbrake_command, stdout = stdout, stderr = stderr )
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 672, in __init__
    errread, errwrite)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1202, in _execute_child
    raise child_exception
OSError: [Errno 13] Permission denied
HANDBRAKE_COMMAND_OUTPUT = False
IMPORT_TO_ITUNES = True

Code: Select all


           [ 2012-04-29 @ 17:12:30 ]  NZB ID                         : 
[ 2012-04-29 @ 17:12:30 ]  Category                       : movies
[ 2012-04-29 @ 17:12:30 ]  Final directory                : ***
[ 2012-04-29 @ 17:12:30 ]  Output directory               : ***
[ 2012-04-29 @ 17:12:30 ]  Processing file type : *.avi
[ 2012-04-29 @ 17:12:30 ]  Processing file type : *.mkv
[ 2012-04-29 @ 17:12:31 ]  	error : checking iTunes : ERROR 1: 32:140: execution error: iTunes got an error: Can’t get every track of playlist "Library" whose description = "***". (-1728)
Traceback (most recent call last):
  File "***/handbrake.py", line 239, in <module>
    handbrake_command.append( "--audio=" + get_audio_track_list( input_file ) )
  File ***/handbrake.py", line 89, in get_audio_track_list
    p = subprocess.Popen( handbrake_command, stdout = stdout, stderr = stderr )
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 672, in __init__
    errread, errwrite)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1202, in _execute_child
    raise child_exception
OSError: [Errno 13] Permission denied
I've set file and directory permissions to 775 on the Python directory. The handbrake.py script has executable permissions.

Any ideas on this issue? Thnx in advance

Re: OS X + HandBrakeCLI + Python = convert, iTunes and e-mai

Posted: April 29th, 2012, 2:37 pm
by imthenachoman
agr85 wrote:I'm currently facing the same problem -- below are Sabnzbd log entries (replaced private directories by ***):
@agr85: For the import to itunes one, can you open AppleScript Editor, select "Event Log" in the bottom, select "Events" and "Replies", paste in the below code, replace FILENAME with what you removed from below (the three stars in the line that goes "error : checking iTunes : ERROR 1: 32:140: execution error: iTunes got an error: Can’t get every " and then click run and tell me what the "Event Log" window shows.

Code: Select all

tell application "iTunes"
	get (count of (tracks of playlist "Library" whose description is "FILENAME"))
end tell
It should look something like:

Code: Select all

tell application "iTunes"
	get (count of (tracks of playlist "Library" whose description is "Grey's Anatomy - 08x21 - Moment of Truth"))
end tell
As for the other one, shoot me an email at the bottom of this page: https://sites.google.com/site/imthenach ... ing-script. It looks either there is a problem accessing the source file, or there is a problem running handbrake. I'm going to need a copy of your entire config section.

Re: OS X + HandBrakeCLI + Python = convert, iTunes and e-mai

Posted: April 30th, 2012, 3:12 am
by agr85
@agr85: For the import to itunes one, can you open AppleScript Editor, select "Event Log" in the bottom, select "Events" and "Replies", paste in the below code, replace FILENAME with what you removed from below (the three stars in the line that goes "error : checking iTunes : ERROR 1: 32:140: execution error: iTunes got an error: Can’t get every " and then click run and tell me what the "Event Log" window shows.
This is what shows up in the Event Log: (result is partially in Dutch, meaning 'iTunes got an error, <filename> could not be retrieved')

Code: Select all

tell application "iTunes"
	count every track of playlist "Library" whose description = "rihanna_ft_drake-whats_my_name-x264-2010-fray"
		--> error number -1728
Resultaat:
error "iTunes kreeg een fout: every track of playlist \"Library\" whose description = \"rihanna_ft_drake-whats_my_name-x264-2010-fray\" kan niet worden opgevraagd. " number -1728 from every track of playlist "Library" whose description = "rihanna_ft_drake-whats_my_name-x264-2010-fray"
I sent you an e-mail for the other issue.

Re: OS X + HandBrakeCLI + Python = convert, iTunes and e-mai

Posted: May 14th, 2012, 4:23 pm
by regbear3
agr85 wrote:I'm currently facing the same problem -- below are Sabnzbd log entries (replaced private directories by ***):

HANDBRAKE_COMMAND_OUTPUT = True
IMPORT_TO_ITUNES = False

Code: Select all

 
[ 2012-04-29 @ 17:14:28 ]  NZB ID                         : 
[ 2012-04-29 @ 17:14:28 ]  Category                       : movies
[ 2012-04-29 @ 17:14:28 ]  Final directory                : ***
[ 2012-04-29 @ 17:14:28 ]  Output directory               : ***
[ 2012-04-29 @ 17:14:28 ]  Processing file type : *.avi
[ 2012-04-29 @ 17:14:28 ]  Processing file type : *.mkv
Traceback (most recent call last):
  File "***/handbrake.py", line 239, in <module>
    handbrake_command.append( "--audio=" + get_audio_track_list( input_file ) )
  File "***/handbrake.py", line 89, in get_audio_track_list
    p = subprocess.Popen( handbrake_command, stdout = stdout, stderr = stderr )
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 672, in __init__
    errread, errwrite)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1202, in _execute_child
    raise child_exception
OSError: [Errno 13] Permission denied
HANDBRAKE_COMMAND_OUTPUT = False
IMPORT_TO_ITUNES = True

Code: Select all


           [ 2012-04-29 @ 17:12:30 ]  NZB ID                         : 
[ 2012-04-29 @ 17:12:30 ]  Category                       : movies
[ 2012-04-29 @ 17:12:30 ]  Final directory                : ***
[ 2012-04-29 @ 17:12:30 ]  Output directory               : ***
[ 2012-04-29 @ 17:12:30 ]  Processing file type : *.avi
[ 2012-04-29 @ 17:12:30 ]  Processing file type : *.mkv
[ 2012-04-29 @ 17:12:31 ]  	error : checking iTunes : ERROR 1: 32:140: execution error: iTunes got an error: Can’t get every track of playlist "Library" whose description = "***". (-1728)
Traceback (most recent call last):
  File "***/handbrake.py", line 239, in <module>
    handbrake_command.append( "--audio=" + get_audio_track_list( input_file ) )
  File ***/handbrake.py", line 89, in get_audio_track_list
    p = subprocess.Popen( handbrake_command, stdout = stdout, stderr = stderr )
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 672, in __init__
    errread, errwrite)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1202, in _execute_child
    raise child_exception
OSError: [Errno 13] Permission denied
I've set file and directory permissions to 775 on the Python directory. The handbrake.py script has executable permissions.

Any ideas on this issue? Thnx in advance
I had this problem too... The issue is that when you edit the file with TextEdit, the file gets extended attributes added, one of which is com.apple.quarantine. You can tell if it has extended attributes with the ls command if it has the @ symbol:

Code: Select all

macpro-ec5f6d:autoProcessTV mekoniak$ ls -al
total 88
drwxr-xr-x  10 mekoniak  staff    340 May 14 15:51 .
drwxr-xr-x  25 mekoniak  staff    850 May 14 15:36 ..
-rw-r--r--@  1 mekoniak  staff     74 Sep 25  2010 autoProcessTV.cfg
-rw-rw-r--   1 mekoniak  staff     78 Apr 27 00:28 autoProcessTV.cfg.sample
-rw-rw-r--   1 mekoniak  staff   2964 Apr 27 00:28 autoProcessTV.py
-rw-r--r--   1 mekoniak  staff   2790 May  4 12:55 autoProcessTV.pyc
-rwxrwxr-x@  1 mekoniak  staff  14676 May 14 15:51 handbrake.py
-rwxrwxr-x   1 mekoniak  staff    979 Apr 27 00:28 hellaToSickBeard.py
-rwxrwxr-x   1 mekoniak  staff   1048 Apr 27 00:28 sabToSickBeard.py
-rwxrwxr-x   1 mekoniak  staff    142 May 14 15:39 test.py
macpro-ec5f6d:autoProcessTV mekoniak$ xattr handbrake.py 
com.apple.TextEncoding
com.apple.quarantine
You can fix it by removing the extended attributes with the following command:

Code: Select all

xattr -c handbrake.py
FYI, this attribute is what is set to give you that dialog after you open a file from the internet where you have to confirm that you want to run it. Since this is being called from within the SAB process, it can't present you with that dialog, and you get the OS error from Python...