Subversion Repositories programming

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

#!/bin/bash

### check both args, print help ###
if [ -z "$1" ] && [ -z "$2" ];
then echo "You need help...";
     echo
     echo "Usage: postcreate <FILE_TO_POST> <POST_TITLE>"
     exit
fi

### check each arg ###
if [ -z "$1" ]; then echo "Enter a filename..."; exit; fi;
if [ -z "$2" ]; then echo "Enter the post title..."; exit; fi;

MY_NOEXT_NAME="$(echo "$1" | sed 's/\.avi//' | sed 's/\.ogm//' | sed 's/\.mkv//' )"

### Split to rars ###
rar a -m0 -v15000000b "${MY_NOEXT_NAME}.rar" "$1"

### make par set at 10% ###
par2create -s375000 -r10 "${MY_NOEXT_NAME}.par2" "${MY_NOEXT_NAME}.part??.rar"

### set up newspost ###
echo "Sleeping 30 seconds... CHECK YOUR POST NOW"
sleep 30
newspost -s "$2" -e "${MY_NOEXT_NAME}.nfo" "${MY_NOEXT_NAME}.part??.rar"

### finish up ###
echo "Done posting $1"