Index: ffpc.module =================================================================== --- ffpc.module (revision 27) +++ ffpc.module (working copy) @@ -1,6 +1,47 @@ 'Filefield Podcast settings.', + 'title' => 'Filefield Podcast Settings', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('ffpc_admin_settings'), + 'access arguments' => array('administer ffpc'), + ); + return $items; +} + +/** + * Admin settings form + */ +function ffpc_admin_settings() { + $form['ffpc_item_settings'] = array( + '#type' => 'fieldset', + '#title' => t('Settings for individual podcast episodes'), + '#description' => t('Control where various values come from.') + ); + $form['ffpc_item_settings']['ffpc_episode_title_field'] = array( + '#type' => 'radios', + '#description' => t('Control where the title of each episode will come from. The node title or from within the file itself (using the ID3 tag).'), + '#title' => t('Episode titles'), + "#default_value" => variable_get('ffpc_episode_title_field', 'node'), + '#options' => array('node' => t('Node title'), 'file' => t('File ID3 tag')), + ); + + return system_settings_form($form); +} + +/** * Implementation of hook_views_api(). */ function ffpc_views_api() { Index: ffpc_plugin_row_podcast.inc =================================================================== --- ffpc_plugin_row_podcast.inc (revision 27) +++ ffpc_plugin_row_podcast.inc (working copy) @@ -89,7 +89,7 @@ $extra[] = array( 'key' => 'enclosure', 'attributes' => array( - 'url' => url( $file['filepath'], array('absolute'=>TRUE) ), + 'url' => file_create_url($file['filepath']), 'length' => $file['filesize'], 'type' => $file['filemime'], ), @@ -114,8 +114,13 @@ $extra[] = array('key' => 'pubDate', 'value' => gmdate('r', $item->created)); $extra[] = array( 'key' => 'guid', - 'value' => url( $file['filepath'], array('absolute'=>TRUE) ), + 'value' => file_create_url($file['filepath']), ); + // Swap out the item title for the ID3 title if it exists and set to do so + $file_title = $info['tags']['id3v2']['title'][0]; + if (!empty($file_title) && variable_get('ffpc_episode_title_field', 'node') == 'file') { + $item->title = $file_title; + } /* * The following function takes title, link, description and then * all additional XML elements. For the title we'll use the node