Page 1 of 1
User script parameter request - Full path of TV file
Posted: October 28th, 2008, 4:38 am
by dr0pknutz
After the TV sorting script has done its post processing is it possible to get a full path of the video file (AVI, MKV) sent as a parameter to the post processing scripts. I'm writing a script which creates a shortcut to the video file and places it inside a "Recent" folder. This then lets me quickly see the newest TV shows which have been downloaded and I can just open them from there.
Thanks.
Re: User script parameter request - Full path of TV file
Posted: October 28th, 2008, 1:28 pm
by Camelot
I have not checked, but my scripts seem to work fine, and I am pretty sure they would choke if they DIDN'T get a full path. Are you sure they are passed a relative path?
Re: User script parameter request - Full path of TV file
Posted: October 28th, 2008, 2:29 pm
by dr0pknutz
What I'm looking for is the name of the AVI file after the TV processing script has finished renaming it. These are the current parameters I can get:
Code: Select all
%1 = C:\Storage\Usenet\Complete\TV-XVID\Weeds
%2 = Weeds.S02E08.DVDRip.XviD-TOPAZ.nzb
%3 = Weeds.S02E08.DVDRip.XviD-TOPAZ
What I want is the name of the AVI. E.g: Weeds - 2x08.avi.
Thanks.
Re: User script parameter request - Full path of TV file
Posted: October 28th, 2008, 4:05 pm
by shypike
Yeah, I see what you mean.
Unfortunately we already have a ridiculous amount of parameters.
I'll discuss it with the team.
Re: User script parameter request - Full path of TV file
Posted: October 29th, 2008, 10:27 am
by Camelot
One of the advantages of passing just a folder, is that sabnzbd does not have to make any assumptions regarding which of the multiple files in the resulting directory is the one that you want passed as a parameter. Yes, if you are downloading a tv show, then it is usually the avi/mp4/m4v/mkv file you are really interested in. But is this really an assumption/choice we want some smarts in sabnzbd to decide for us?
What I do now, is my post processing scripts take $1 and search for any movie file extensions, and then performs the script on those. Unfortunately, if there is a sample file, that will get picked up as well, but I can live with that.
Only option I can see for sabnzbd to do this foolproof, would be to pass ALL the files in the resulting directory as parameters.
Re: User script parameter request - Full path of TV file
Posted: March 16th, 2009, 6:31 pm
by nurriz
This would be really helpful for doing conversion tasks on downloads. Even though you can concatenate the parameters passed to the user script, it falls apart as soon as you set up TV sorting to your liking. It would be nice for at least the final filename (after tv sorting) to be passed as a parameter. Having the clean version for the job name only helps if you don't rename with TV sorting.
Re: User script parameter request - Full path of TV file
Posted: March 31st, 2009, 8:12 am
by belfbri
I was going to request the same feature. I'd like to be able to have a script to do some conversion on the resulting renamed file. I dont need the full path, just the renamed file with or without the extension.
Re: User script parameter request - Full path of TV file
Posted: April 10th, 2009, 8:09 am
by Laat
This can be done in a postscript already though, for instance with this "post processing script" on a Linux machine.
Code: Select all
#!/bin/bash
find "$1" -cmin -1 -name *.avi | grep -iv sample
this finds all avi-files changed/created/moved less than 1 minute ago, except file names containing 'sample'
EDIT:
I didn't test this properly before answering, because this seem to only work with one episode pr folder. All files already in the destination folder get's the same changed time-stamp when a download is finished...
Re: User script parameter request - Full path of TV file
Posted: April 12th, 2009, 11:27 am
by Laat
On linux, the method perm_script() chmod's all files in the destination folder, marking all the files already in the destination folder as changed. This makes it impossible for me to distinguish newly downloaded episodes/files from other episodes in the same folder.
To solve this I changed the postproc.py to only chmod the files if it does not already have the correct right's.
Code: Select all
--- a/sabnzbd/postproc.py
+++ b/sabnzbd/postproc.py
@@ -316,7 +316,9 @@ def perm_script(wdir, umask):
logging.error('[%s] Cannot change permissions of %s', __NAME__, root)
for name in files:
try:
- os.chmod(join(root, name), umask_file)
+ stat = os.stat(join(root, name))
+ if ((stat.st_mode & 0777) != umask_file):
+ os.chmod(join(root, name), umask_file)
except:
logging.error('[%s] Cannot change permissions of %s', __NAME__, join(root, name))
The simple find in my previous post works, and something similar should work on windows.
Re: User script parameter request - Full path of TV file
Posted: April 17th, 2009, 6:29 am
by shypike
dr0pknutz wrote:
After the TV sorting script has done its post processing is it possible to get a full path of the video file (AVI, MKV) sent as a parameter to the post processing scripts. I'm writing a script which creates a shortcut to the video file and places it inside a "Recent" folder. This then lets me quickly see the newest TV shows which have been downloaded and I can just open them from there.
Thanks.
Request filed as
https://trac2.assembla.com/SABnzbd/ticket/262
Re: User script parameter request - Full path of TV file
Posted: May 16th, 2009, 7:54 am
by doubledrat
I don't understand why you can't just search using your own script, like this -
Code: Select all
set dirname=%1
set dirname=%dirname:"=%
set name=%3
set name=%name:"=%
REM convert to iphone format
for /R "%dirname%" %%f in (*.mkv) do call :iphoneit %%~sf
for /R "%dirname%" %%f in (*.wmv) do call :iphoneit %%~sf
for /R "%dirname%" %%f in (*.avi) do call :iphoneit %%~sf
for /R "%dirname%" %%f in (*.mov) do call :iphoneit %%~sf
for /R "%dirname%" %%f in (*.mpg) do call :iphoneit %%~sf