|
Auto Compiler Encoder Uploader Publisher QA MD5 RSSMon Chicklet Other iTunes |
EncoderBookmarklet Download
#!/usr/bin/perl
# massyn.net - MP3 encoding script
# podcast automation project
# ============================================ #
# Release 0.2 - Added padded zeros for the episode
# 0.3 - Added a -f check for SOURCE
# 0.4 - Converted to Perl (cross platform idea)
# ============================================ #
# Give the episode number leading zeros.
# - Why? When creating the MP3, we want the sorting within Podpress to work accurately.
$EPISODE = sprintf("%03d", $ARGV[0]);
# set the full path to lame here
# - Why? When we're working on cross platform, we want to specify where LAME actually is.
$LAME = "lame";
$SOURCE = "";
$TARGETDIR = "";
$TARGET = "$TARGETDIR/-${EPISODE}.mp3";
$YEAR = "";
$ALBUM = "";
# tip from podcast 411 - if you have a voice mail number, include it
# on the album title.
$TRACK = "$ALBUM # $EPISODE";
$ARTIST = "";
$BITS = "";
$CHANNEL = "";
$KHZ = "";
$IMAGE = "";
if(! -d $TARGETDIR)
{
print "============================================================\n";
print "ERROR : $TARGETDIR does not exist!\n";
print "============================================================\n";
exit(1);
}
if(!$ARGV[0])
{
print "============================================================\n";
print "Warning - you need to supply an episode number\n";
print "============================================================\n";
exit(1);
}
if(! -f $SOURCE)
{
print "============================================================\n";
print "ERROR : $SOURCE does not exist!\n";
print "============================================================\n";
exit(1);
}
if( -f $TARGET)
{
if($ARGV[1] ne "-f")
{
print "============================================================\n";
print "Warning - this target file already exists...\n";
print "To overwrite, use -f\n";
print " $0 $ARGV[0] -f\n";
print "============================================================\n";
exit(1);
}
}
print "============================================================\n";
print "massyn.net encoder\n";
print "============================================================\n";
print "Input : Episode $EPISODE\n";
print "Input file : $SOURCE\n";
print "Output file : $TARGET\n";
print "============================================================\n";
system("$LAME -b $BITS -m $CHANNEL --tt \"$TRACK\" --ta \"$ARTIST\" --tl \"$ALBUM\" --ty \"$YEAR\" --tn $EPISODE $SOURCE $TARGET --resample $KHZ --add-id3v2");
$ERR = $?;
if( -f $IMAGE)
{
# if you have eyeD3, let's add the image
system("eyeD3 --add-image $IMAGE:OTHER $TARGET");
}
print "============================================================\n";
if($ERR != 1)
{
print "Success with LAME !\n";
}
else
{
print "There was a problem with LAME...\n";
}
print "============================================================\n";
print "Result : $TARGET\n";
exit($ERR);
|