Index: mp3player.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mp3player/mp3player.install,v
retrieving revision 1.1.2.8
diff -u -p -r1.1.2.8 mp3player.install
--- mp3player.install	13 Oct 2009 12:25:31 -0000	1.1.2.8
+++ mp3player.install	11 Aug 2010 13:40:05 -0000
@@ -6,6 +6,24 @@
  * The install file for MP3 Player.
  */
 
+/**
+ * Implementation of hook_requirements().
+ */
+function mp3player_requirements($phase) {
+  $t = get_t();
+  $path = variable_get('mp3player_library_path', 'sites/all/modules/mp3player/mp3player');
+  $has_mp3player = file_exists($path .'/audio-player.js') && file_exists($path .'/player.swf');
+  $requirements['mp3player'] = array(
+    'title' => $t('MP3 Player'),
+    'value' => $has_mp3player ? $t('Installed') : $t('Not found'),
+  );
+  if (!$has_mp3player) {
+    $requirements['mp3player']['severity'] = REQUIREMENT_ERROR;
+    $requirements['mp3player']['description'] = $t("MP3 Player requires the <a href='!mp3_url'>standalone WordPress Audio Player</a>.", array('!mp3_url' => 'http://wpaudioplayer.com/download'));
+  }
+
+  return $requirements;
+}
 
 /**
  * Implementation of hook_install().
@@ -219,4 +237,4 @@ function mp3player_update_1() {
   $ret = array();
   db_add_field($ret, 'mp3player_players', 'checkpolicy', array('type' => 'varchar', 'length' => 3, 'not null' => TRUE, 'default' => 'no'));
   return $ret;
-}
\ No newline at end of file
+}
Index: mp3player.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mp3player/mp3player.module,v
retrieving revision 1.1.2.13
diff -u -p -r1.1.2.13 mp3player.module
--- mp3player.module	13 Oct 2009 12:25:31 -0000	1.1.2.13
+++ mp3player.module	11 Aug 2010 13:40:06 -0000
@@ -147,6 +147,13 @@ function mp3player_players($pid = NULL) 
  */
 function mp3player_settings() {
   if (user_access('administer mp3player')) {
+    $form['mp3player_library_path'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Path to mp3 library'),
+      '#default_value' => variable_get('mp3player_library_path', 'sites/all/modules/mp3player/mp3player'),
+      '#description' => t("This Player requires the <a href='!mp3_url'>standalone WordPress Audio Player</a>, enter the directory where the two required files can be found, by default this is set to sites/all/modules/mp3player/mp3player", array('!mp3_url' => 'http://wpaudioplayer.com/download')),
+    );
+  
     $form['mp3player_encode'] = array(
       '#type' => 'select',
       '#title' => t('Encode Audio File URLs'),
@@ -190,12 +197,20 @@ function mp3player_settings() {
       '#description' => t('List one page per line as Drupal paths.  The * character is a wildcard.  Example paths are "node/add/page" and "node/add/*".  Use &lt;front&gt; to match the front page.'),
       '#default_value' => variable_get('mp3player_page_list', ''),
     );
+    $form['#submit'][] = 'mp3player_settings_submit';
     
     return system_settings_form($form);
   }
 }
 
 /**
+ * Force the mp3player cache to be rebuilt.
+ */
+function mp3player_settings_submit($form, &$form_state) {
+  cache_clear_all('mp3player_default', 'cache');
+}
+
+/**
  * Form to add a new player.
  */
 function mp3player_player_add($form_state) {
@@ -894,11 +909,7 @@ function mp3player_player_delete_submit(
  */
 function mp3player_init() {
   if (mp3player_exclude_these_paths() != 1) {
-    if(!file_exists(drupal_get_path('module', 'mp3player').'/mp3player/audio-player.js') || !file_exists(drupal_get_path('module', 'mp3player').'/mp3player/player.swf')) {
-      drupal_set_message(t('%file1 or %file2 were not found in %directory, download the <a href="http://wpaudioplayer.com/download">standalone WordPress Audio Player</a>.', array('%file1' => 'audio-player.js', '%file2' => 'player.swf', '%directory' => '/'.drupal_get_path('module', 'mp3player').'/mp3player/')), 'error');
-    }
-
-    drupal_add_js(drupal_get_path('module', 'mp3player').'/mp3player/audio-player.js');
+    drupal_add_js(variable_get('mp3player_library_path', 'sites/all/modules/mp3player/mp3player') .'/audio-player.js');
     drupal_add_js(drupal_get_path('module', 'mp3player').'/mp3player.js');
 
     //If cache isn't set, set it.
@@ -918,7 +929,7 @@ function mp3player_init() {
 function mp3player_player_default_settings() {
   $player = mp3player_players(1);
   
-  $js_audio_settings = 'AudioPlayer.setup("'.base_path().drupal_get_path('module', 'mp3player').'/mp3player/player.swf", {';
+  $js_audio_settings = 'AudioPlayer.setup("'. base_path() . variable_get('mp3player_library_path', 'sites/all/modules/mp3player/mp3player') .'/player.swf", {';
   $js_audio_settings .= 'width:'.$player['width'].',';
   
   if($player['autostart'] != 'no') {
@@ -1255,4 +1266,4 @@ function mp3player_exclude_these_paths()
   }
 
   return ($action == 'page_disable' ? 0 : 1);
-}
\ No newline at end of file
+}
