Commits

neonacho  committed 9f3ae5b

Added support for multiple podcasts.

  • Participants
  • Parent commits 644dd26

Comments (0)

Files changed (2)

 nachocast.sh
 
+* Proper commandline argument parsing
+
+* Add ID3 tags to episode
+* Direct posting to schnitzelpress
+
 * Check remote FTP if a file with the given name already exists.
 * Optionally unify filenames.
 
+
 podcastbaker.py
 
 * Generate GUID per item.

File nachocast.sh

 }
 
 # Checks if an argument was supplied
-if [ ! -f "$1" ]
+if [ -z "$1" ]
 then
-	echo "$1: No such file or directory"
+  echo "$0 [-c config] [audio-file]"
+  exit 1
+fi
+
+if [ "$1" == "-c" ]
+then
+  config="$2-config"
+  audio_file="$3"
+else
+  config="config"
+  audio_file="$1"
+fi
+
+if [ ! -f "$audio_file" ]
+then
+	echo "$audio_file: No such file or directory"
 	exit 1
 fi
 
 # Handle the configuration file
 mkdir -p "$HOME/.nachocast"
 
-if [ ! -f "$HOME/.nachocast/config" ]
+if [ ! -f "$HOME/.nachocast/$config" ]
 then
 	echo "No configuration file found"
 	exit 1
 fi
-source "$HOME/.nachocast/config"
+source "$HOME/.nachocast/$config"
 
 # Handle cover art if eyeD3 is installed
 cover="$HOME/.nachocast/`echo $COVER_ART_URL|rev|cut -d/ -f-1|rev`"
 
 # Convert input to MP3 if necessary
 converted=0
-out="`echo $1|rev|cut -d. -f2-|rev`.mp3"
-file "$1"|grep "MPEG ADTS, layer III" >/dev/null
+out="`echo $audio_file|rev|cut -d. -f2-|rev`.mp3"
+file "$audio_file"|grep "MPEG ADTS, layer III" >/dev/null
 if [ $? -ne 0 ]
 then
 	check_installed ffmpeg
 	rm -f "$out"
 	echo "Converting input file to MP3..."
 	# Special case for Skype Call Recorder files
-	if [ "`ffmpeg -i "$1" 2>&1|grep -c 'Stream #'`" == "2" ]
+	if [ "`ffmpeg -i "$audio_file" 2>&1|grep -c 'Stream #'`" == "2" ]
 	then
 		check_installed sox
 		
 		# Extract both audio tracks
 		TRACK1="track1.tmp$$.wav"
 		TRACK2="track2.tmp$$.wav"
-		ffmpeg -i "$1" -ac 1 -map 0:0 "$TRACK1" >/dev/null 2>&1
-		ffmpeg -i "$1" -ac 1 -map 0:1 "$TRACK2" >/dev/null 2>&1
+		ffmpeg -i "$audio_file" -ac 1 -map 0:0 "$TRACK1" >/dev/null 2>&1
+		ffmpeg -i "$audio_file" -ac 1 -map 0:1 "$TRACK2" >/dev/null 2>&1
 
     # Adjust volume of track 2 (Samson G-Track hack)
     if [ "$GTRACK_HACK" == "true" ]
     if [ -n "$INTRO" -o -n "$OUTRO" ]
     then
       MUXED2="muxed2.tmp$$.wav"
-      sox -v 1.2 "$INTRO" "$MUXED" "$OUTRO" "$MUXED2"
+      if [ -z "$OUTRO" ]
+      then
+        sox -v 1.2 "$INTRO" "$MUXED" "$MUXED2"
+      else
+        sox -v 1.2 "$INTRO" "$MUXED" "$OUTRO" "$MUXED2"
+      fi
       rm -f "$MUXED"
       MUXED="$MUXED2"
     fi
 		ffmpeg_convert "$FILTERED" "$out"
 		rm -f "$FILTERED"
 	else
-		ffmpeg_convert "$1" "$out" 
+		ffmpeg_convert "$audio_file" "$out" 
 	fi
 	converted=1
 fi