• Welcome to RadioDJ - Free Radio Automation Software Forum. Please log in or sign up.

Adding year to 'Now Playing' in WP plugin

Started by Kilrock, January 03, 2024, 10:54:07 PM

Kilrock

At the moment the WP plugin for Radio DJ is running smoothly on the KilRock homepage.

But there's something missing: we would like to add the year of release of the titles added to the info as displayed on the page.

Anyone who can help us to edit the plugin script in such a way we can display that information too on our homepage?
Tried to be smart, didn't work so I ask...

Kiwi

Visited your website (nice one!) but it appears you have solved your problem. Did you use $year$ in the streaming titles?

Kilrock

Thank you for the compliment about the website. It's nice to read.

To be precise: the problem is not 100% solved, but it comes close :)

On the page https://kilrock.nl/kilrock-muziekradio-uit-het-dordtsche-kilgebied/kilrock-live-spelers/ the year-of-release data is handled by a php script:
_______________________________________________
<h4><span style="font-family: 'arial black', sans-serif;"><span class="cc_streaminfo" data-type="rawmeta" data-username="kilrock"></span></h4><br />

<script language="javascript" type="text/javascript" src="https://mediaserv30.live-streams.nl:2199/system/streaminfo.js"></script>
_______________________________________________

That works fine for this page, but what this method can't do is what the RDJ WP plugin is able to: to display the playlist of upcoming titles. The intention is to edit the plugin in such a way that it also retrieves the 'year' parameter from the database and adds it to the title info on the homepage.

I have examined the script of the plugin. Indeed, what I find missing is the extraction of the year of release data from the database. Now the question is: how can I modify the plugin to do that? I don't want to just tinker without a clear plan.

A brief explanation: KilRock is a kind of museum radio. We consider it important for listeners to see when a song was released, allowing them to grasp a bit of the zeitgeist.
Tried to be smart, didn't work so I ask...

stevewa

file
lib\radiodj.class.php

line 150
$upcoming_items = (int)get_option('upcoming_items');
if( $upcoming_items > 0) {
$order = get_option('shuffle_next') ? 'RAND()' : 'queuelist.ID';

$upcoming_show_titles = (bool)get_option('rdj_upcoming_show_titles');
if($upcoming_show_titles) {
$sql = $DB->prepare( "SELECT songs.artist, songs.title, songs.year FROM songs, queuelist WHERE songs.song_type IN ($song_types) AND songs.ID=queuelist.songID " .
"ORDER BY " . $order . " LIMIT 0,%d", $upcoming_items );
$upcoming = $DB->get_results( $sql );
} else {
$sql = $DB->prepare( "SELECT songs.artist FROM songs, queuelist WHERE songs.song_type IN ($song_types) AND songs.ID=queuelist.songID " .
"ORDER BY " . $order . " LIMIT 0,%d", $upcoming_items );
$upcoming = $DB->get_col( $sql );
}
}

Kilrock

[strong male voice with American/Texan accent]

''Hell... the damn thing ain't working..."

I copied the code you've posted at line 150 and further, but still.... no 'Year' info on the homepage.

Is it my deodorant? Is it my toothpaste? Is it my face the code doesn't like? ;D

Tried to be smart, didn't work so I ask...

stevewa

well if you're texan, than your stupider than a rock, so no wonder  :D

well if you want the other half of the solution, you gotta pay me a million dollars.

clue is, look in folder "views", file "nowplaying.php"

since you mentioned upcoming

around Line 41, copy

<span class="separator">-</span>
                <span class="title"><?php echo htmlspecialchars$song->titleENT_QUOTES ); ?></span>

and paste
<span class="separator">-</span>
                <span class="title"><?php echo htmlspecialchars$song->yearENT_QUOTES ); ?></span>

and see if that punches your cow  :hihi:


RFU

Take a look at my site. I can help you set yours up like that if you want
Гордий бути українцем, Ми - Радіо Вільної України.

Kilrock

The cow has hit the fan! We're almost there, but... the year isn't displayed behind the artist-title info in 'now playing'. :hihi:

I've been scrutinizing the code in lines 130- 146 (lib/radiodj.class.php).

It seems to me that it doesn't allow retrieving year-information as it is right now. Do you have any suggestions?
Tried to be smart, didn't work so I ask...

Casper-emmen

Quote from: stevewa on January 12, 2024, 10:25:48 PMwell if you're texan, than your stupider than a rock, so no wonder  :D

well if you want the other half of the solution, you gotta pay me a million dollars.

clue is, look in folder "views", file "nowplaying.php"

since you mentioned upcoming

around Line 41, copy

<span class="separator">-</span>
                <span class="title"><?php echo htmlspecialchars$song->titleENT_QUOTES ); ?></span>

and paste
<span class="separator">-</span>
                <span class="title"><?php echo htmlspecialchars$song->yearENT_QUOTES ); ?></span>

and see if that punches your cow  :hihi:



Thanks for that!
You're a hero!

Working like a charm!
see: https://www.freeradioemmen.nl

Casper-emmen

Quote from: Kilrock on January 20, 2024, 03:16:28 AMThe cow has hit the fan! We're almost there, but... the year isn't displayed behind the artist-title info in 'now playing'. :hihi:

I've been scrutinizing the code in lines 130- 146 (lib/radiodj.class.php).

It seems to me that it doesn't allow retrieving year-information as it is right now. Do you have any suggestions?

At line 41 begins the display of "upcoming tracks" so it works for that section.
For the "now playing" track, you heve to look around line 16 - 18


stevewa

well, you started by talking about "upcoming", so that was the code I provided.  >:D
now you want now playing too, and Casper has provided that clue.

Kilrock

Don't kill the messenger... ::)
I've read Casper's comment. Not too much time to work on it, but I'll give it a try of course. :cool:
Tried to be smart, didn't work so I ask...

stevewa

it's election season in the USA, so I kill everyone in my crosshairs  :angel:

Kilrock

Ahem... is has been awhile but... welll.....
Take a look for yourself: www.kilrock.nl

Thnx for your help.
Tried to be smart, didn't work so I ask...