Now Playing Info

Please note that this script and plugin are currently in a testing phase. We are not responsible for any system crashes or website downtime that may occur as a result of using this software

Plugin Name: Now Playing Info

Description:

“Now Playing Info” is a versatile WordPress plugin designed to enhance online radio websites by displaying currently playing song information. Seamlessly integrating with SAM Broadcaster, this plugin utilizes a PAL script to fetch and update song metadata in real-time, ensuring your audience stays engaged with up-to-date track information.

Key Features:

  • SAM Broadcaster Integration: Utilize a custom PAL (Playlist Automation Language) script to connect directly with SAM Broadcaster, fetching live song data to display on your WordPress site. This feature is perfect for radio stations that require dynamic content synchronization between their broadcast software and their website.
  • Dynamic Content Display: The plugin allows the song information to auto-refresh at customizable intervals, ranging from 5 seconds to 120 seconds, to ensure your audience sees the latest tracks as they are played.
  • Customizable Display Options:
    • Header Customization: Add a custom header above the now playing information, such as “Now Playing,” to attract attention and fit the style of your site.
    • Inline Display: Choose to display artist and song title inline, making it a seamless part of your site’s content flow.
    • Label Control: Optionally show or hide the labels for “Artist” and “Title,” providing a cleaner and more customizable look to fit various design preferences.

Perfect For: Radio stations, DJs, and music enthusiasts who use WordPress to power their sites and wish to provide a real-time, interactive listening experience for their audience. This plugin bridges the gap between SAM Broadcaster’s powerful broadcasting capabilities and the accessibility and flexibility of WordPress.

PAL Script:



PAL.Loop := True; // Enable continuous looping

while True do
begin
    // Initialize HTTP client
    var httpClient : THttpClient;
    var url : string = 'https://yourwebsite.com/wp-content/plugins/now-playing-info/post_song_details.php';
    httpClient := THttpClient.Create(url);

    // Set authentication if required
    httpClient.Username := 'myusername';
    httpClient.Password := 'pass123';

    // Get current song info
    var songInfo : TSongInfo;
    songInfo := ActivePlayer.GetSongInfo;

    if songInfo <> nil then
    begin
        var songData : string;
        songData := 'artist=' + URLEncode(songInfo['artist']) + '&title=' + URLEncode(songInfo['title']);

        // HTTP POST request to send song data
        httpClient.Post(songData, 'application/x-www-form-urlencoded');

        // Check for response
        while not httpClient.ResponseReady do
            Pal.WaitForTime('+00:00:01');

    end
    else
        WriteLn('No track is currently loaded.');

    // Cleanup
    httpClient.Free;

    // Wait for 5 seconds before the next loop iteration
    PAL.WaitForTime('+00:00:05');
end;

Installation Instructions for “Now Playing Info” Plugin

Follow these steps to install and configure the “Now Playing Info” plugin to display live song information from SAM Broadcaster on your WordPress site.

Step 1: Download the Plugin

  1. Obtain the plugin zip file (now-playing-info.zip).

    Download Here

Step 2: Install the Plugin on WordPress

  1. Log in to your WordPress admin dashboard.
  2. Navigate to Plugins > Add New.
  3. Click the Upload Plugin button at the top of the page.
  4. Click Choose File and select the now-playing-info.zip file from your computer.
  5. Click Install Now to upload and install the plugin.
  6. Once the installation is complete, click Activate Plugin to activate “Now Playing Info” on your WordPress site.

Step 3: Configure the Plugin

  1. After activation, go to the newly added Now Playing menu in your WordPress admin dashboard.
  2. Configure the following settings:
    • Auto-refresh Interval: Set how often the plugin updates the now playing information, between 5 seconds (minimum) and 120 seconds (maximum).
    • Header Text: Enter a custom header that will appear above the now playing information, e.g., “Now Playing”.
    • Display Options:
      • Show Labels: Choose whether to display labels such as “Artist” and “Title”.
      • Display Inline: Check this option if you want the artist name and song title to be displayed on a single line.
  3. Save your changes.

Step 4: Implement the Shortcode

  1. To display the now playing information on your site, place the now-playing shortcode in the content of pages, posts, or widgets where you want the song information to appear.

Step 5: Configure the PAL Script in SAM Broadcaster

  1. Ensure SAM Broadcaster is set up to use the PAL script that interacts with the plugin. This script is responsible for sending the current song information to your WordPress site.
  2. Load the PAL script provided with the plugin into SAM Broadcaster.
  3. Start the script to begin transmitting song data to your WordPress site.

Step 6: Test the Setup

  1. Visit the page or post where you placed the shortcode to see the now playing information displayed.
  2. Check if the information updates at the interval you set and verifies that the display settings (header, inline, labels) are correct.

Troubleshooting

  • If the now playing information does not update, check your PAL script configuration in SAM Broadcaster and ensure it is running correctly.
  • Verify that the plugin settings in WordPress are configured correctly, particularly the URL or endpoint that the PAL script should target.
  • Ensure that your server’s firewall or security settings do not block outgoing data from SAM Broadcaster or incoming data to WordPress.