/**
  * Gets a jingle of the station.
  *
  * @param	integer	$index	Format index of the jingle in the $audioFormats global variable
  * @return	mixed	Returns the path of the jingle if exist, else return boolean false
  * @use	$audioFormats
  */
 function getJingle($index)
 {
     global $audioFormats;
     $file = $this->getStationDir() . '/jingle_' . sotf_AudioCheck::getFormatFilename($index);
     if (is_file($file) && !is_file($file . '.lock')) {
         return $file;
     } else {
         return false;
         //return new PEAR_Error($stationId . " has no jingle!");
     }
 }
 /**
  * Gets a jingle of the station.
  *
  * @param	integer	$index	Format index of the jingle in the $config['audioFormats'] global variable
  * @return	mixed	Returns the path of the jingle if exist, else return boolean false
  * @use	$config['audioFormats']
  */
 function getJingle($index = 0)
 {
     global $config;
     $file = $this->getMetaDir() . '/jingle_' . sotf_AudioCheck::getFormatFilename($index);
     debug("searching for", $file);
     if (is_file($file) && !is_file($file . '.lock')) {
         return $file;
     }
     $file = '';
     $jdir = $this->getMetaDir();
     if (is_dir($jdir)) {
         $d = dir($jdir);
         while ($entry = $d->read()) {
             if (substr($entry, 0, 6) == 'jingle_') {
                 $file = $jdir . '/' . $entry;
                 break;
             }
         }
         $d->close();
     }
     debug("2nd round", $file);
     if ($file) {
         return $file;
     } else {
         return false;
     }
 }