(REQ) UNPACK files in specified directory

Come up with a useful post-processing script? Share it here!
Post Reply
User avatar
JohnnyV
Newbie
Newbie
Posts: 22
Joined: December 28th, 2008, 1:04 am
Location: Chicago
Contact:

(REQ) UNPACK files in specified directory

Post by JohnnyV »

I need a script that will unpack my downloaded files in an alternative "area"; then place the final file in the appropriate folder according to the the "category" settings.
example: Right now if I get a movie it downloads to d:\Temp_downloads. When it's complete, it goes to d:\Videos and creates a folder "UNPACK_MY_MOVIE_NAME", runs the unpacking and then deletes/renames that folder only leaving the movie file.

Is there some way to script this to keep the unpacking in the d:\Temp_downloads then move the completed movie file & folder to d:\Videos???


The issue for me is I have a Movie database service running and monitoring my Video Folder. When SAB creates this "unpack" folder in d:\Videos, the monitor grabs the movie data with the "UNPACK" in the name causing it to not find the correct data.

:o


EDIT: OR..... Is SAB unpacking from the TEMP to the UNPACK Folder then when complete renaming it??? If so, a script to stop that in the movies section.
Last edited by JohnnyV on December 28th, 2008, 1:20 am, edited 1 time in total.
User avatar
rascalli
Moderator
Moderator
Posts: 656
Joined: January 18th, 2008, 12:30 am
Location: Bossche bollen land

Re: (REQ) UNPACK files in specified directory

Post by rascalli »

To what did you set your complete folder in sabnzbd+ ?    d:\video  ???

----
Have a look here : http://forums.sabnzbd.org/index.php?topic=61.0

In this script it moves the files after unrar (and joining)

Just make the complete folder not in the video folder and you will get a clean folder
User avatar
JohnnyV
Newbie
Newbie
Posts: 22
Joined: December 28th, 2008, 1:04 am
Location: Chicago
Contact:

Re: (REQ) UNPACK files in specified directory

Post by JohnnyV »

I did "F:" but the categories setting is set to "d:\Videos" so that over rides it.
I will take a look at this script you linked. Hope this will work!
Thanks
User avatar
JohnnyV
Newbie
Newbie
Posts: 22
Joined: December 28th, 2008, 1:04 am
Location: Chicago
Contact:

Re: (REQ) UNPACK files in specified directory

Post by JohnnyV »

This script is wonderful, but for nix only? And most of my files are not AVI they are also MKV, ISO (rips), and some others. This may not work correctly for me.

I am open to any suggestions. I will keep digging around.

My temp solution for now is to set up an additional "just in" folder, and manually move the completed movie files to "d:\Videos", but that takes away from the goal of complete automation!!!
Last edited by JohnnyV on December 28th, 2008, 11:39 am, edited 1 time in total.
User avatar
rascalli
Moderator
Moderator
Posts: 656
Joined: January 18th, 2008, 12:30 am
Location: Bossche bollen land

Re: (REQ) UNPACK files in specified directory

Post by rascalli »

you can ofcourse always change the avi to also ios and so on.

and not sure if it works on windows , never tried it.
but maybe you can use some things out of it to write your own script
doubledrat
Release Testers
Release Testers
Posts: 180
Joined: February 20th, 2008, 3:16 pm

Re: (REQ) UNPACK files in specified directory

Post by doubledrat »

this may be the sort of thing you want.  set your unpack directory to be somewhere other than the final resting place that you really want, then create this as a postprocessing script

Code: Select all

set dirname=%1
set dirname=%dirname:"=%
set name=%3
set name=%name:"=%
set dltype=%5

move "%dirname%" D:\videos
of course what you want to do with tv may be different to movies, in which case you need something like

Code: Select all

set dirname=%1
set dirname=%dirname:"=%
set name=%3
set name=%name:"=%
set dltype=%5

if %dltype%==movies move "%dirname%" D:\videos
if %dltype%==tv move "%dirname%" "e:\my shows"
etc

hope that helps
User avatar
JohnnyV
Newbie
Newbie
Posts: 22
Joined: December 28th, 2008, 1:04 am
Location: Chicago
Contact:

Re: (REQ) UNPACK files in specified directory

Post by JohnnyV »

Thank you so much. That was what I came up with too (the idea anyway). I will also be lookign through the fist suggestion also.
Thanks for the help!
User avatar
JohnnyV
Newbie
Newbie
Posts: 22
Joined: December 28th, 2008, 1:04 am
Location: Chicago
Contact:

Re: (REQ) UNPACK files in specified directory

Post by JohnnyV »

Ok I couldn't get that to work correctly in Win2k3 server envoirment. was a complete pain.

So I found a nice solution in case others experiece this issue.

I used the win 2k3 biult in "robocopy" command in cmd.exe with special triggers. It checks for new folders in '_temp' assures that the name/File/Folder does not begin with a '_' (underscore) so when SAB is unpacking a file it will be skipped. ie "_UNPACK_MY MOVIE...". It will also verify the transfer, and resume on any errors.

I added this .bat file to the windows scedualer to run every hour. for 2 days working perfectly.

Just add this code to a text file and save as .bat extention. Add to your scedualer.

Code: Select all

@ECHO OFF
sleep 5
robocopy \\localhost\_temp\ \\localhost\Videos /E /XD _* /MOVE
cls
\\localhost\_temp\  == Is the folder it will check for new unpacked movies.
\\localhost\Videos == Is the final destination



Here is a complete list of robocopy commands you can adjust to your liking:

Code: Select all

 
Usage :: ROBOCOPY source destination [file [file]...] [options]

             source :: Source Directory (drive:\path or \\server\share\path).
        destination :: Destination Dir  (drive:\path or \\server\share\path).
               file :: File(s) to copy  (names/wildcards: default is "*.*").

::
:: Copy options :
::
                 /S :: copy Subdirectories, but not empty ones.
                 /E :: copy subdirectories, including Empty ones.
             /LEV:n :: only copy the top n LEVels of the source directory tree.

                 /Z :: copy files in restartable mode.
                 /B :: copy files in Backup mode.
                /ZB :: use restartable mode; if access denied use Backup mode.
            /EFSRAW :: copy all encrypted files in EFS RAW mode.

  /COPY:copyflag[s] :: what to COPY for files (default is /COPY:DAT).
                       (copyflags : D=Data, A=Attributes, T=Timestamps).
                       (S=Security=NTFS ACLs, O=Owner info, U=aUditing info).

           /DCOPY:T :: COPY Directory Timestamps.

               /SEC :: copy files with SECurity (equivalent to /COPY:DATS).
           /COPYALL :: COPY ALL file info (equivalent to /COPY:DATSOU).
            /NOCOPY :: COPY NO file info (useful with /PURGE).

            /SECFIX :: FIX file SECurity on all files, even skipped files.
            /TIMFIX :: FIX file TIMes on all files, even skipped files.

             /PURGE :: delete dest files/dirs that no longer exist in source.
               /MIR :: MIRror a directory tree (equivalent to /E plus /PURGE).

               /MOV :: MOVe files (delete from source after copying).
              /MOVE :: MOVE files AND dirs (delete from source after copying).

     /A+:[RASHCNET] :: add the given Attributes to copied files.
     /A-:[RASHCNET] :: remove the given Attributes from copied files.

            /CREATE :: CREATE directory tree and zero-length files only.
               /FAT :: create destination files using 8.3 FAT file names only.
               /256 :: turn off very long path (> 256 characters) support.

             /MON:n :: MONitor source; run again when more than n changes seen.
             /MOT:m :: MOnitor source; run again in m minutes Time, if changed.

      /RH:hhmm-hhmm :: Run Hours - times when new copies may be started.
                /PF :: check run hours on a Per File (not per pass) basis.

             /IPG:n :: Inter-Packet Gap (ms), to free bandwidth on slow lines.

                 /SL:: copy symbolic links versus the target.
::
:: File Selection Options :
::
                 /A :: copy only files with the Archive attribute set.
                 /M :: copy only files with the Archive attribute and reset it.
    /IA:[RASHCNETO] :: Include only files with any of the given Attributes set.
    /XA:[RASHCNETO] :: eXclude files with any of the given Attributes set.

 /XF file [file]... :: eXclude Files matching given names/paths/wildcards.
 /XD dirs [dirs]... :: eXclude Directories matching given names/paths.

                /XC :: eXclude Changed files.
                /XN :: eXclude Newer files.
                /XO :: eXclude Older files.
                /XX :: eXclude eXtra files and directories.
                /XL :: eXclude Lonely files and directories.
                /IS :: Include Same files.
                /IT :: Include Tweaked files.

             /MAX:n :: MAXimum file size - exclude files bigger than n bytes.
             /MIN:n :: MINimum file size - exclude files smaller than n bytes.

          /MAXAGE:n :: MAXimum file AGE - exclude files older than n days/date.
          /MINAGE:n :: MINimum file AGE - exclude files newer than n days/date.
          /MAXLAD:n :: MAXimum Last Access Date - exclude files unused since n.
          /MINLAD:n :: MINimum Last Access Date - exclude files used since n.
                       (If n < 1900 then n = n days, else n = YYYYMMDD date).

                /XJ :: eXclude Junction points. (normally included by default).

               /FFT :: assume FAT File Times (2-second granularity).
               /DST :: compensate for one-hour DST time differences.

               /XJD :: eXclude Junction points for Directories.
               /XJF :: eXclude Junction points for Files.

::
:: Retry Options :
::
               /R:n :: number of Retries on failed copies: default 1 million.
               /W:n :: Wait time between retries: default is 30 seconds.

               /REG :: Save /R:n and /W:n in the Registry as default settings.

               /TBD :: wait for sharenames To Be Defined (retry error 67).

::
:: Logging Options :
::
                 /L :: List only - don't copy, timestamp or delete any files.
                 /X :: report all eXtra files, not just those selected.
                 /V :: produce Verbose output, showing skipped files.
                /TS :: include source file Time Stamps in the output.
                /FP :: include Full Pathname of files in the output.
             /BYTES :: Print sizes as bytes.

                /NS :: No Size - don't log file sizes.
                /NC :: No Class - don't log file classes.
               /NFL :: No File List - don't log file names.
               /NDL :: No Directory List - don't log directory names.

                /NP :: No Progress - don't display % copied.
               /ETA :: show Estimated Time of Arrival of copied files.

          /LOG:file :: output status to LOG file (overwrite existing log).
         /LOG+:file :: output status to LOG file (append to existing log).

       /UNILOG:file :: output status to LOG file as UNICODE (overwrite existing log).
      /UNILOG+:file :: output status to LOG file as UNICODE (append to existing log).

               /TEE :: output to console window, as well as the log file.

               /NJH :: No Job Header.
               /NJS :: No Job Summary.

           /UNICODE :: output status as UNICODE.

::
:: Job Options :
::
       /JOB:jobname :: take parameters from the named JOB file.
      /SAVE:jobname :: SAVE parameters to the named job file
              /QUIT :: QUIT after processing command line (to view parameters). 
              /NOSD :: NO Source Directory is specified.
              /NODD :: NO Destination Directory is specified.
                /IF :: Include the following Files.
:o

Thanks for the help!
Post Reply