RadioDJ - Free Radio Automation Software Forum

RadioDJNow Anyone???

Offline RFU

  • *****
  • 567
    • Radio Free Ukraine
Re: RadioDJNow Anyone???
« Reply #30 on: December 29, 2020, 10:06:15 AM »
I had another thought about this Bill. When your RadioDJ extracts the album art from the tag and inserts it in the album_art folder, how is it naming the files?

I'm using standard naming where "Joes Band - Joes Song" becomes "joesband-joessong.jpg"

The only thing I can think of is if you programmed a different naming system into the plugin
Гордий бути українцем, Ми - Радіо Вільної України.

Offline bill

Re: RadioDJNow Anyone???
« Reply #31 on: December 29, 2020, 05:25:14 PM »
Hey RFU,
Please don't take offence at the following instructions...  I had added them to the RadioDJ TrackUpdate, but in my rush to get out the RadioDJNow plugin to you I apparently had not added these same instructions.

The WordPress plugins will look for art exactly like it is sent for the RadioDJ software Now Playing module sends it.

Yes RadioDJ automation does extract some art, but not all are available.  You need to find most own your own..  Again I apologize for not including the detailed instructions in RadioDJNow, but will and upload it to MediaFire.  For now here it is as it is in TrackUpdate......

Again I ask that you or anyone else not take offence at the following.  I have found that by downloading previous versions of RadioDJNow and RadioDJ TrackUpdate users think that between RadioDJ and these WordPress plugins that all of the images a miraculously there, they are not.  I hope the following is helpful not offensive....


  Now you need all of your images...
  1. Upload images to webserver.
  2. Enter the URL of this images location in your WordPress RadioDJNow admin page.
  3. This script will in the following order
   A. Look for Artist - Track Title.(png, jpg or gif)
   B. Look for Track Title.(png, jpg or gif)
   C. Look for Album.(png, jpg or gif)
   D. Look for no-image.(png, jpg or gif) or default.(png, jpg or gif) if none of the above are found
   "D." Is very important you must have a fallback image. Use a no-image image or a default.png
So if RadioDJ has found some track images use them. However RadioDJ will not find all images. You can search the internet and get album images or just Artist images. This script will try and find any of the above and if none of the above are found it will default to the default image. So again make sure that you have a fallback image!!

Please Remember:

RadioDJ is a Radio Automation playout software. It does a great job at automation and in my opinion the best. So this small contribution is my way of saying Thank-you.

However RadioDJ will not find all of your images for you. If your tracks have embedded images it will bring them into RadioDJ. It will not find images that are not in the imported tracks. You will need to find the rest from sources on the internet. You still need to place all of your images on your webserver.

RadioDJNow will only find your images if they are titled correctly in the format that RadioDJ sends the metadata.

You will have to do this work yourself it is impossible to expect RadioDJ or RadioDJNow to this for you!!!!
« Last Edit: December 29, 2020, 05:42:15 PM by bill »

Offline bill

Re: RadioDJNow Anyone???
« Reply #32 on: December 29, 2020, 06:03:40 PM »
I had another thought about this Bill. When your RadioDJ extracts the album art from the tag and inserts it in the album_art folder, how is it naming the files?

I'm using standard naming where "Joes Band - Joes Song" becomes "joesband-joessong.jpg"

The only thing I can think of is if you programmed a different naming system into the plugin

Nothing so elaborate...
Just like the RadioDJ automation Now Playing sends the meta-data is how the WordPress plugin is calling the images...

If you look on The WordPress RadioDJNow settings page below the URL input entry you will see this paragraph


Full Artist Image directory URL... ex. https://mysite.com/myimages/ The trailing "/" slash is needed for all to work properly. Image search can't work reliably on remote storage so images need to be stored on same server as your WordPress installation. This script is built to look for Artist Name ex. The Beatles and will also look for FULL track name ex. The Beatles - Eight Days A Week or title only ex. Eight Days A Week (exactly like RadioDJ sends it) either "png" or "jpg" or "gif" image and if not exist it will look for "noimage.png" or "noimage.jpg" or "noimage.gif" or "default.png" or "default.jpg" or "default.gif" so please make sure there is a fallback image in Artist Images URL!!


I should add that if the URL is pointing to correct location it should be at least show your fall back image

Offline RFU

  • *****
  • 567
    • Radio Free Ukraine
Re: RadioDJNow Anyone???
« Reply #33 on: December 30, 2020, 02:56:58 PM »

  Now you need all of your images...
  1. Upload images to webserver.
  2. Enter the URL of this images location in your WordPress RadioDJNow admin page.
  3. This script will in the following order
   A. Look for Artist - Track Title.(png, jpg or gif)
   B. Look for Track Title.(png, jpg or gif)
   C. Look for Album.(png, jpg or gif)
   D. Look for no-image.(png, jpg or gif) or default.(png, jpg or gif) if none of the above are found
   "D." Is very important you must have a fallback image. Use a no-image image or a default.png
So if RadioDJ has found some track images use them. However RadioDJ will not find all images. You can search the internet and get album images or just Artist images. This script will try and find any of the above and if none of the above are found it will default to the default image. So again make sure that you have a fallback image!!



1. They are, and they are in the same subdir that they have always been in on the server "https://rfu.in.ua/album_art/"

2. your plugin refused to save the directory link for the image files. In fact, there was no field for it in the database. I added it using phpmyadmin and your insert code
Code: [Select]
INSERT INTO wp_options (option_name,option_value) VALUES ('rdj_images','https://yourdomain.com/images/')
3. All the images are in the subdir but your plugin doesn't fine them, nor does it find the file default.png that I uploaded to the server


Every mp3 file in my collection of 114,751 songs has properly configured data and album art in the tag file and every song had the album art extracted by RadioDJ in the proper RadioDJ format when they were imported. In fact, because if an error I made, every track was recently reimported and the album art again extracted and placed in the proper subdir. All of the album art is a jpg file either 600x600 or 640x640 pixels.


If your plugin didn't add the field in the database for the directory link, i have to wonder what else it didn't insert into the database

Looking at the database using phpmyadmin I can only see three fields in wp_options that relate to your plugin

widget_rdjnow_widget
widget_rdjnow_track_widget
rdj_images

And looking under Settings > RadioDJNow it shows the proper Artist Image URL that I inserted into the database using your above mentioned Insert code

Гордий бути українцем, Ми - Радіо Вільної України.

Offline bill

Re: RadioDJNow Anyone???
« Reply #34 on: December 31, 2020, 03:05:57 AM »
1. They are, and they are in the same subdir that they have always been in on the server "https://rfu.in.ua/album_art/"

2. your plugin refused to save the directory link for the image files. In fact, there was no field for it in the database. I added it using phpmyadmin and your insert code
Code: [Select]
INSERT INTO wp_options (option_name,option_value) VALUES ('rdj_images','https://yourdomain.com/images/')
3. All the images are in the subdir but your plugin doesn't fine them, nor does it find the file default.png that I uploaded to the server


Every mp3 file in my collection of 114,751 songs has properly configured data and album art in the tag file and every song had the album art extracted by RadioDJ in the proper RadioDJ format when they were imported. In fact, because if an error I made, every track was recently reimported and the album art again extracted and placed in the proper subdir. All of the album art is a jpg file either 600x600 or 640x640 pixels.


If your plugin didn't add the field in the database for the directory link, i have to wonder what else it didn't insert into the database

Looking at the database using phpmyadmin I can only see three fields in wp_options that relate to your plugin

widget_rdjnow_widget
widget_rdjnow_track_widget
rdj_images

And looking under Settings > RadioDJNow it shows the proper Artist Image URL that I inserted into the database using your above mentioned Insert code

I hope my answers will make sense tonight.  I think I got a bug coming on. Achy, fever etc.  Don't want that virus....


 When plugin is activated in WordPress it should register one and only one option; the rdj_images. I can't fathom why it didn't..  The Widgets will go in to the option table when you add a widget.

I tried to see your album_art directory, but got a 403 and that is the way it should be..
Just curious what the filenames look like.  I did notice the couple of images on the side are from your WordPress uploads directory, but I realize the are Program images not song images.  And I don't know how the language would make any difference. 
Also you are welcome to translate

The pixels help to be smaller, but doesn't effect the plugin.  I spent months getting the filenames correct in mine, but didn't change any sizes.
I made sure all of mine were
songtitle.(jpg or png)
artist - songtitle.(jpg or png)
artist.(jpg or png)
album.(jpg or png)

You can use the images RadioDJ Automation exports from tracks, but you should rename all.  You are going find the image filenames will be like the  track filenames.  You need them to be like Artist and/or Songnames.

I didn't remove spaces in filenames because RadioDJ automation sets songnames with spaces in them
 as
Gaither Vocal Band - I Do Believe


You are welcome to look through the code...

Around line 559 you will see the function to validate the file....
Code: [Select]
function validate_url( $url ) {
        if (@file_get_contents($url, 0, NULL, 0, 1)) {
            return 1;
        }
        return 0;
}

Around line 781 is where it looks for the images

Code: [Select]
  $imageurl = get_option( 'rdj_images');

  if( isset($_SERVER['HTTPS'] ) ) { $imagepath = $_SERVER['DOCUMENT_ROOT'] . str_replace('https://' . $_SERVER['HTTP_HOST'], '', $imageurl); }else{ $imagepath = $_SERVER['DOCUMENT_ROOT'] . str_replace('http://' . $_SERVER['HTTP_HOST'], '', $imageurl); }

 // echo $imagepath . "<br>";

  $artist = $rdj['artist'];

  $title = $rdj['title'];

  $album = $rdj['album'];

//  $artist = str_replace(" ","_",strtolower(($rdj['artist'])));

//  $title = str_replace(" ","_",strtolower(($rdj['title'])));

 //  echo $artist . "<br>";

 //  echo $title . "<br>";

   if (validate_url($imagepath . $artist . " - " . $title . ".png")) { $artistimg = $artist . " - " . $title . ".png";
} elseif (validate_url($imagepath . $artist . " - " . $title . ".jpg")) { $artistimg = $artist . " - " . $title . ".jpg";
} elseif (validate_url($imagepath . $artist . " - " . $title . ".gif")) { $artistimg = $artist . " - " . $title . ".gif";
} elseif (validate_url($imagepath . $artist . " - " . $title . ".tif")) { $artistimg = $artist . " - " . $title . ".tif";
} elseif (validate_url($imagepath . $title . ".png")) { $artistimg = $title . ".png";
} elseif (validate_url($imagepath . $title . ".jpg")) { $artistimg = $title . ".jpg";
} elseif (validate_url($imagepath . $title . ".gif")) { $artistimg = $title . ".gif";
} elseif (validate_url($imagepath . $title . ".tif")) { $artistimg = $title . ".tif";
} elseif (validate_url($imagepath . $album . ".png")) { $artistimg = $album . ".png";
} elseif (validate_url($imagepath . $album . ".jpg")) { $artistimg = $album . ".jpg";
} elseif (validate_url($imagepath . $album . ".gif")) { $artistimg = $album . ".gif";
} elseif (validate_url($imagepath . $album . ".tif")) { $artistimg = $album . ".tif";
} elseif (validate_url($imagepath . $artist . ".png")) { $artistimg = $artist . ".png";
} elseif (validate_url($imagepath . $artist . ".jpg")) { $artistimg = $artist . ".jpg";
} elseif (validate_url($imagepath . $artist . ".gif")) { $artistimg = $artist . ".gif";
} elseif (validate_url($imagepath . $artist . ".tif")) { $artistimg = $artist . ".tif";
} elseif (validate_url($imagepath . "noimage.png")) { $artistimg = "noimage.png";
} elseif (validate_url($imagepath . "noimage.jpg")) { $artistimg = "noimage.jpg";
} elseif (validate_url($imagepath . "noimage.gif")) { $artistimg = "noimage.gif";
} elseif (validate_url($imagepath . "noimage.tif")) { $artistimg = "noimage.tif";
} elseif (validate_url($imagepath . "default.jpg")) { $artistimg = "default.jpg";
} elseif (validate_url($imagepath . "default.gif")) { $artistimg = "default.gif";
} elseif (validate_url($imagepath . "default.tif")) { $artistimg = "default.tif";
} else { $artistimg = "default.png"; }

// echo $imageurl . $artistimg . "<br>";

// $artistimg = $title . ".jpg";

// $artistimg = $artist . ".jpg";

// echo $imageurl . $artistimg . "<br>";


You are welcome to look through and make changes to help. As you can see there is places to do some debugging. 
I have used CentOS and Apache PHP 7.2+ with MariaDB 10+ for  a good while now.

Offline RFU

  • *****
  • 567
    • Radio Free Ukraine
Re: RadioDJNow Anyone???
« Reply #35 on: December 31, 2020, 04:51:50 AM »
As I said before, the image files are all named by RadioDJ.  "Aerosmith - Rocks.jpg" becomes "aerosmith-rocks.jpg"

all characters are automatically changed to lowercase, spaces and punctuation are removed. It's an automatic process by RadioDJ. I explained that in an earlier post. And when I asked you if you changed your file names you said no. Now you're saying I need to change all the file names.

The sizes 600x600 or 640x640 are optimized for social media. Anything smaller is posted to twitter or instagram anchored to the top left and anything smaller posted in facebook is stretched to fit by facebook and the images become pixilated.

So, your plugin may work for you but it won't work for anyone else because your image naming system is not RadioDJ standard.
Гордий бути українцем, Ми - Радіо Вільної України.

Offline bill

Re: RadioDJNow Anyone???
« Reply #36 on: December 31, 2020, 07:37:14 PM »
Quote
As I said before, the image files are all named by RadioDJ.  "Aerosmith - Rocks.jpg" becomes "aerosmith-rocks.jpg"
I understand what you are saying.  Yes I originally went with that way of naming image files. RadioDJ is a great automation software.  It does a good job of pulling images from track files.  In my experience though CDs and tracks purchased from internet only 1 percent of one percent have images embedded in file. So instead of going through adding images to track files and reimporting music again. I started naming images as meta-data is sent from RadioDJ  Artist and Songname.  The Beatles - Yellow Submarine  I also experimented with using LastFM and Google and Amazon, but again names won't always be whats needed.  I also found it better to have images on server website with WordPress

Quote
all characters are automatically changed to lowercase, spaces and punctuation are removed. It's an automatic process by RadioDJ. I explained that in an earlier post. And when I asked you if you changed your file names you said no. Now you're saying I need to change all the file names.
No I am not saying you need to rename all of your files.  No I didn't rename files. 99% of images I had to obtain from internet.  If you had 10% of your tracks after ripping CDs or purchased tracks to have all of the images embedded.  You did great.  If you had 100% That's wonderful.  I only had my experience to rely on.

Quote
The sizes 600x600 or 640x640 are optimized for social media. Anything smaller is posted to twitter or instagram anchored to the top left and anything smaller posted in facebook is stretched to fit by facebook and the images become pixilated.
You are absolutely correct on the file sizes. I didn't say filesize doesn't matter in that respect. I just meant that the plugin doesn't look for filesize.

Quote
So, your plugin may work for you but it won't work for anyone else because your image naming system is not RadioDJ standard.
No that is not my intention.  RadioDJ is great software and I just wanted to give back a little.  As I have said before I don't claim to be a professional programmer  and for the biggest part I only have my own experience to rely on.
In the last post I showed the section of code that looks for the images starting at line 781. You should notice two lines at 789
Code: [Select]
//  $artist = str_replace(" ","_",strtolower(($rdj['artist'])));
//  $title = str_replace(" ","_",strtolower(($rdj['title'])));
You will see that it does a string replace of a space to underscore.
Uncomment the two lines.  Change the string replace to what you need...
 
« Last Edit: December 31, 2020, 07:45:24 PM by bill »

Offline RFU

  • *****
  • 567
    • Radio Free Ukraine
Re: RadioDJNow Anyone???
« Reply #37 on: January 01, 2021, 12:20:56 PM »
No that is not my intention.  RadioDJ is great software and I just wanted to give back a little.  As I have said before I don't claim to be a professional programmer  and for the biggest part I only have my own experience to rely on.
In the last post I showed the section of code that looks for the images starting at line 781. You should notice two lines at 789
Code: [Select]
//  $artist = str_replace(" ","_",strtolower(($rdj['artist'])));
//  $title = str_replace(" ","_",strtolower(($rdj['title'])));
You will see that it does a string replace of a space to underscore.
Uncomment the two lines.  Change the string replace to what you need...

Well I'm not a programmer either. I wouldn't have a clue what to change it to in order to display the proper images
Гордий бути українцем, Ми - Радіо Вільної України.

Offline bill

Re: RadioDJNow Anyone???
« Reply #38 on: January 02, 2021, 05:03:00 AM »
Well I'm not a programmer either. I wouldn't have a clue what to change it to in order to display the proper images

I'm only trying to be helpful. 

The reason I have learned the little bit of PHP I have is that I have never found a free PHP download that worked perfectly out of the box.  The authors intention and your intention may not always be exactly the same.

Also here on the forums please do a search for "Cover Art" or "Album Art"  You will find that CDs and downloaded tracks will very rarely have embedded art.  What RadioDJ is able to pull from the imported tracks is that much you won't need to search the internet for.  You said that you have over 100,000 tracks it may seem that you have a lot.  I did the same.  The more I sorted through the image files the more I found that the filenames would not be found by web scripts.

In my experience the image filename will be patterned after the track filename not artist-title.jpg
For example if the audio track filename actually contains the artist and tile it will be something like 111_I_Can_t_Deny_The_Light.mp3 so art becomes 111_I_Can_t_Deny_The_Light.jpg.   You will need to do some work to correct your image files.  Even if the ID3 tag has the Artist and Title of the track the filename itself maybe SID1234.mp3  so the art will be named SID1234.jpg

I grant you that I know the least of the least here on these forums. From what I see The Now Playing from RadioDJ is sending Artist - Title. It will even send Album.  It will not send image filenames through the Now Playing from RadioDJ.

If you prefer not to have spaces in your image filenames all you need to do is  go down to around line 793

//  $artist = str_replace(" ","_",strtolower(($rdj['artist'])));

//  $title = str_replace(" ","_",strtolower(($rdj['title'])));

and change to what you need
something like

  $artist = str_replace(" ","",strtolower(($rdj['artist'])));

  $title = str_replace(" ","",strtolower(($rdj['title'])));

 and even add

  $title = str_replace(" ","",strtolower(($rdj['album'])));

Again I'm just trying to be helpful

Offline RFU

  • *****
  • 567
    • Radio Free Ukraine
Re: RadioDJNow Anyone???
« Reply #39 on: January 02, 2021, 06:58:50 AM »
Regardless of where you got the image, if it was imported into the tag of the mp3 file, it will be extracted by RadioDJ and put into the album art folder with the proper naming protocol

And I don't think I have ripped a cd in 4 or 5 years, so it doesn't matter to me if the album art is on the cd or not. Most of my album art comes from the artists websites, or the artists instagram or facebook profiles, or spotify.

Every single one of my files has a properly formatted tag with artist name, song name, album name, year, genre, image  and BPM. And every single one of them has the artists hashtags in the Composer field.

At a minimum, if you have artist name, song name, album name and image in the tag, it will be extracted with the proper naming system used by RadioDJ, and it doesn't matter what the physical file is named. And if it's an album it extracts the image once and uses it for all the tracks with the same artist/album name. The only way it would name an image after the physical file name is if the tag was blank. But then, if the tag is blank there's no album art to extract either.

The only time I have come up against a problem was if a single and an album track was a song of the same name but with different album art. But I've managed to find a work around for that too,

Гордий бути українцем, Ми - Радіо Вільної України.