Community Documentation

Installing Station Archive

Last updated November 6, 2012. Created by joachim on September 24, 2006.
Edited by frederickjh, drewish. Log in to edit this page.

You'll need to complete the following steps to setup the station archive:

  1. Enable the taxonomy module. The archive uses a vocabulary to assign days and times to the audio files.
  2. Download and enable the audio module. You'll want to follow the instructions to setup the audio_getid3 sub-module, it is strongly recommended.
  3. Enable the station and station_archive modules.
  4. Configure the station module at admin >> settings >> station. If the schedule module is running on another machine, you'll want to set the XMLRPC URL.
  5. Download and install the StreamRipper executable.
  6. Edit the station/archive/scripts/ripper.inc file. Set your web stream's URL, the full path of the import directory, and the full path to the stream ripper executable.
  7. Test running the ripper script on the command line. You'll need to determine the full path to the file and pass that to PHP as the first parameter. So, if you've installed the module into /usr/local/www/drupal/modules then you'd run it by typing: php /usr/local/www/drupal/modules/station/archive/scripts/ripper.php
    If you see any error messages you'll need to correct those. If not, it'll grind away ripping the stream for up-to an hour. Let it run for a few minutes then stop it by pressing CTRL+C. Look in the import directory and make sure you've got an .MP3 file. If there's a .CUE file with the name, delete it.
  8. Setup Drupal's cron job. The audio files are automatically imported as part of a cron task.
  9. Run Drupal's cron script to import this test file then check that an audio node was created by visiting Home > > audio.
  10. Add two cron jobs to run the ripper script. One for even, and one for odd hours. Here's a sample that rips every hour from 9am through 2am the next day:
    # note that times start one minute before the hour
    # run the even hourly stream rip
    59 9,11,13,15,17,19,21,23 * * * /usr/local/bin/php /usr/local/www/drupal/modules/station/archive/scripts/ripper.php
    # run the odd hourly stream rip
    59 0,8,10,12,14,16,18,20,22 * * * /usr/local/bin/php /usr/local/www/drupal/modules/station/archive/scripts/ripper.php

    You might be able to do it with a single cronjob I've gotten mixed results using a single one.

Comments

Removing .cue files

Cue files should remove themselves automatically.

From the issue queue...

One user (lokey) was having troubles with interrupted files, caused by StreamRipper not picking up on the stream and writing to the same file. This is a StreamRipper problem. Lokey provided this patch for StreamRipper 1.62.0 to fix the problem:

--- streamripper-1.62.0.orig/lib/filelib.c   Sat May 19 10:03:13 2007
+++ streamripper-1.62.0.new/lib/filelib.c       Wed Mar 10 15:07:07 2010
@@ -1026,7 +1026,7 @@
     /* For unix, we need to convert to char, and just open.
        http://mail.nl.linux.org/linux-utf8/2001-02/msg00103.html
     */
-    *fp = open (fn, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+    *fp = open (fn, O_APPEND | O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
     if (*fp == INVALID_FHANDLE) {
        /* GCS FIX -- need error message here! */
        // printf ("ERROR creating file: %s\n",filename);

Lokey also suggested a cron script to check that the ripper is running - that way, if a stream isn't picked up right at the start of the main cron job, it can be started into the hour.

#!/usr/local/bin/bash

isrunning=` ps -auxw | grep radio | grep -v grep | grep -c 'streamripper' `


if [ $isrunning -gt 0 ]
        then
        exit 0
        else
        echo restarting ripper..
        /home/radio/rip.sh >>/home/radio/rip.log 2>/dev/null
fi

Lokey's original post with this information can be found here.

About this page

Drupal version
Drupal 4.7.x, Drupal 5.x
Keywords
archive, radio station, shoutcast, station
Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.
nobody click here