(MAC) Start to Finish Process for Writing User Script

Get help with all aspects of SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
hankydysplasia
Newbie
Newbie
Posts: 11
Joined: February 28th, 2009, 10:10 pm

(MAC) Start to Finish Process for Writing User Script

Post by hankydysplasia »

Version: 0.4.7 Final
OS: OSX Leopard 10.5.6
Install-type: Don't Remember

I'm not very good with coding or scripting.  Usually I can figure things out from forums, but I'm having some trouble with this.  I'll try to outline everything clearly so someone can easily help me.

What I want: a script that renames and moves downloaded files based on the extension then deletes the folder.  Specifically, I want *.avi files moved from the final destination folder up a directory into the folder I have specified as the "Completed Download Folder", renamed by the folder name, then deleted the original folder.

Here's what I know: you have to enable a scripts folder in Config/Folders.  I have specified this.

What I don't know: What program do I write the script with?  (I told you I really didn't know what I was doing.)  I've been using TextEdit, and I've tried renaming the extensions .txt, .sh, .py.txt, and .applescript.  Once I've created the script, do I just have to put it into the previously specified folder?  Nothing has worked.  I don't know if the problem is the script itself or the file or if I'm missing some configuration information in the program.

Here's the basic script I've used:
@echo off
copy %1/*.avi /Downloads/theinternets
I apologize if most of this has been answered.  I spent about 20 minutes in the forums with searches and didn't find anything directly related to my situation.

Thanks,
Tyler
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: (MAC) Start to Finish Process for Writing User Script

Post by shypike »

What you made is a mix between Windows and Unix speak, it won't work.
Look for info on Unix scripting.
What you want is probably this:

#!/bin/sh
cp "$1/*.avi" /Downloads/theinternets
rm -rf "$1"

You should have a look at the TV season support, maybe you do not need a script.
http://sabnzbd.wikidot.com/folder-sorting
hankydysplasia
Newbie
Newbie
Posts: 11
Joined: February 28th, 2009, 10:10 pm

Re: (MAC) Start to Finish Process for Writing User Script

Post by hankydysplasia »

Thank you very much for replying.

The TV renamer is unfortunately not what I need.  I'm going to be putting everything in the same directory so that Hazel (another script program) can process and move the files around.  My example question was just for avi's but I'm going to be doing it with lots of other types of files.  One dumb thing about Hazel is that it can't search in subdirectories without trouble.  This is why I want everything back in the same directory.

I still have a couple questions.  What program should I create the script with, and what extension should the script have?  Also, where is an index of some basic scripting commands for Unix that I could reference?

Tyler
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: (MAC) Start to Finish Process for Writing User Script

Post by shypike »

Use bash.
Just Google for "bash".

http://en.wikipedia.org/wiki/Bash
http://tldp.org/LDP/abs/html/

For OSX there may be better choices, like AppleScript,
but I'm not familiar with that.
Post Reply