How to use station_archive.module without stream ripping?

Events happening in the community are now at Drupal community events on www.drupal.org.
miragliuolo's picture

Hey there. Our radio station already has an archiving-to-mp3 method, so we don't need Station's streamripper. Can I dump our mp3s into a directory and have Archive import them automatically? Or something like that? Or am I just going to have to load audio through the Audio module myself?

Comments

yeah you just need to name

drewish's picture

yeah you just need to name it correctly. it expects the filename to be a UNIX timestamp. then run cron.

let it match the schedule

brst t's picture

Something worth noting - if the start time corresponds with a show already set in the schedule, when cron is run, it'll automatically be associated with that show. If it's not, then you'll have to do that step manually by editing the audio node after it's been imported.

Detailed how-to's for datestamps can be found at php.net, but here's one for an example -- it provides the UNIX datestamp next to one that anyone can read.

echo mktime(15, 0, 0, 12, 31, 2007) .date(" Ymd", mktime(15, 0, 0, 12, 31, 2007));

LIke this -
1199131200 20071231

And the first number is the start time hr in 24hr time.

good overview... it's been a

drewish's picture

good overview... it's been a while since i looked at the code but i think they actually need to be GMT timestamps so take a look at http://us3.php.net/gmmktime

Thank you both, I got it

miragliuolo's picture

Thank you both, I got it working. It probably would have taken me much too long to figure it out on my own, not being too experienced with Drupal or Station.

Good to hear it. And I

brst t's picture

Good to hear it. And I learned something in the process-- I'd set mine up around Daylight Savings Time changes so thought the +/-hour I saw was just that, but GMT -- ohh. Not the first time that time has made my head go for a spin.

good overview... it's been a while since i looked at the code but i think they actually need to be GMT timestamps so take a look at http://us3.php.net/gmmktime

a possibly related issue

miragliuolo's picture

Is there supposed to be a link between a certain playlist and the corresponding archive? Because if so, I'm not seeing one when I use the above discussed method of archiving. My archives are indeed associated with the correct program, and have the correct date, but there's no automatic link from the playlist to the archive for that playlist, or vice versa.

Just wondering if that's always like that (and therefore I'd have to edit some Views, or more, to get what I want), or if something is not working quite right in my setup?

Using Darkice for creating the archives

mattrock's picture

Here is a shell script I wrote called "radioplay" which I use to control darkice to create the archives. I am sure it could be modded to pick any .mp3 file instead of the darkice file. I implement this with the darkice init script to establish the temporary start time file which will be used to label the final file. Then from that point forward, cron runs this script to parse the .mp3 file, post it, and reset the start time index file. I use an ssh certificate file without a password to upload the completed file to the webhost to get around the authentication problem with secure file transfer to a remote server.
One of the nicest things I like about doing this with darkice is the resulting files don't overlap. When someone does a two hour show, they can take the two files and merge them together and they will line up perfect.

radioplay

#! /bin/sh
#
# radioplay by MattRock <matt@mattrock.net>
# This script is designed to create an archive file from Darkice
#

PID=cat /var/run/darkice.pid
CONFIGFILE=/etc/radioplay/radioplay.conf
LIBDIR=/var/lib/radioplay
RPINDEX=cat /var/lib/radioplay/radioplay.index
DPINDEX=cat /var/lib/radioplay/drupalplay.index
UNIXTIME=date +%s

# Check and load the conf file
[ -f "$CONFIGFILE" ] && . $CONFIGFILE

# Check for a prep command

case "$1" in
  init)
        echo -n "Initializing radioplay \n"
        echo $TIMESTAMP > $LIBDIR/radioplay.index
        echo $UNIXTIME > $LIBDIR/drupalplay.index
        ;;
 
  cron)
        echo "$LIBDIR/$RPINDEX.mp3" > /tmp/darkice.file-0.$PID
        kill -s 10 $PID
        echo $TIMESTAMP > $LIBDIR/radioplay.index
        echo $UNIXTIME > $LIBDIR/drupalplay.index
        sleep 5
        chmod 666 $LIBDIR/$RPINDEX.mp3
        /usr/bin/id3v2 --artist "$ID3V2ARTIST" --album "$ID3V2ALBUM" --song "$ID3V2SONG" --year "$ID3V2YEAR" --comment "$ID3V2DESC" $LIBDIR/$RPINDEX.mp3
        cp $LIBDIR/$RPINDEX.mp3 $ARCHIVE_FOLDER/
        scp $LIBDIR/$RPINDEX.mp3 $REMOTEUSER@$REMOTESITE:$REMOTEFOLDER/$DPINDEX.mp3
        [ -f "$ARCHIVE_FOLDER/$RPINDEX.mp3" ] && rm $LIBDIR/$RPINDEX.mp3
        ;;

  *)
        echo "Usage: $0 {init|cron}" >&2
        exit 1
        ;;
esac

exit 0

radioplay.conf

# radioplay conf file
#   by Matt Rockwell <matt@mattrock.net>
#   depends on darkice, ID3V2
#

# Set the timestamp filename
TIMESTAMP=date +%F-%a-%H%M

# Set the final archive folder
ARCHIVE_FOLDER=/mnt/media/AirCheck

# Set ID3V2 variables
ID3V2ARTIST="WSUM Student Radio"
ID3V2ALBUM="AirCheck"
ID3V2SONG=date +%a\ %I%P
ID3V2YEAR=date +%Y
ID3V2DESC="Copyright $ID3V2YEAR"

# Set Drupal Remote Post variables
# Note: This method requires an exchange of SSH keys to prevent the request for password
REMOTESITE="{remote_site}"
REMOTEFOLDER="import/showaudio"
REMOTEUSER="{remoteuser}"

Podcasting Module

gate-gdo's picture

Moved it to it's own discussion item.

Radio

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: