Author Topic: Album art file name problem  (Read 8151 times)

GSE

  • Jr. Member

  • Offline
  • **
  • 94
Album art file name problem
« on: September 22, 2014, 03:09:56 AM »
So I'm having a hard time trying to get the album art to play fair.. my issue here is that I'm calling the images in via php

Code: [Select]
<img src="Album-Art/<?php print file_get_contents("NowPlaying.txt")?>.jpg" width="134px" height="134px" />
However I'm finding that it never works unless I manually rename every single image that RDJ album art has downloaded. Everything is in lowercase with no proper spaces.. is there a setting I can change to stop this? Or even better maybe I'm not utilising the power of RDJ and someone could show me an easier way?

Thank you very much.

Jhonny

  • Hero Member

  • Offline
  • *****
  • 4118
  • Personal Text
    Peace, enjoy life, last sleep is longer than live!
    • Jhonny's RadioDJ tutorials.
Re: Album art file name problem
« Reply #1 on: September 22, 2014, 10:05:36 AM »
I assume that you do not use the Web Site script RadioDJDemoScriptV2.2

grtz.
R.T.F.M. means to me, Read The Fantastic Messages.
Einstein says: Make things simple, but don't make simple things simpler! (wise) this is just my life lesson you know.

I don't do drugs, I do tuts. ( ͡° ͜ʖ ͡°) visit  https://radiodj.info

Testing RadioDJ v2.0.3.4 Beta

GSE

  • Jr. Member

  • Offline
  • **
  • 94
Re: Album art file name problem
« Reply #2 on: September 22, 2014, 02:29:45 PM »
I assume that you do not use the Web Site script RadioDJDemoScriptV2.2

grtz.


I have it installed, but how will that change things as you would still have the issue of songs having gaps in their track titles (although that would fix the issue with the hyphen and spacing in between), plus the names would still have some uppercase letters surely?

My knowledge on php is pretty much nothing, so any guidance is much appreciated.

Thanks  :)

Jhonny

  • Hero Member

  • Offline
  • *****
  • 4118
  • Personal Text
    Peace, enjoy life, last sleep is longer than live!
    • Jhonny's RadioDJ tutorials.
Re: Album art file name problem
« Reply #3 on: September 22, 2014, 05:34:06 PM »
Ok,
As you can see is your topic moved to the correct section.

In your line:
<img src="Album-Art/<?php print file_get_contents("NowPlaying.txt")?>.jpg" width="134px" height="134px" />
You use the nowplaying txt file to show a album pic, and you had to rename all pictures.
And when you import new tracks you should do that again and again.

A little explanation what does rdj while importing tracks.

If there is album-art in the id3tag of the track rdj copy the pic to the album art folder in the radiodj/Album-Art folder and gives the pic the name artist-albumname.jpg without spaces and put the pic name in the table songs and column album_art of the database.

You can retrieve from the database the name of the album pic.

In many topics in the board Website, Programming and related are various options described how to do this and script examples or pieces.

grtz.



R.T.F.M. means to me, Read The Fantastic Messages.
Einstein says: Make things simple, but don't make simple things simpler! (wise) this is just my life lesson you know.

I don't do drugs, I do tuts. ( ͡° ͜ʖ ͡°) visit  https://radiodj.info

Testing RadioDJ v2.0.3.4 Beta

Jhonny

  • Hero Member

  • Offline
  • *****
  • 4118
  • Personal Text
    Peace, enjoy life, last sleep is longer than live!
    • Jhonny's RadioDJ tutorials.
Re: Album art file name problem
« Reply #4 on: September 22, 2014, 07:34:17 PM »
This I forgot to ask, you can place a link to your station so we can see it?

Makes it is easier for what you want on your site.

grtz.
R.T.F.M. means to me, Read The Fantastic Messages.
Einstein says: Make things simple, but don't make simple things simpler! (wise) this is just my life lesson you know.

I don't do drugs, I do tuts. ( ͡° ͜ʖ ͡°) visit  https://radiodj.info

Testing RadioDJ v2.0.3.4 Beta

GSE

  • Jr. Member

  • Offline
  • **
  • 94
Re: Album art file name problem
« Reply #5 on: September 22, 2014, 07:50:22 PM »
Thank you for the help so far.

My only issue with carrying on forward with what I have been doing so far is that I have just short of 800 tracks to rename, and I'm sure as you can understand it's not exactly the fastest way of doing things.

The link to where I'm playing about with the script at the moment is here http://musicrad.io/index.php

For now I have come up with the idea of replacing the stream title options in RDJ to $album_cover$ - rather than $artist$ - $title - for now this works with limitations, those being that I'll have to work out another way of taking the artist and track titles to put online too.

The Demo Script V2.2 can be found here: http://media-ice.musicrad.io/live_script/

If I'm honest I used to rely on Last.fm a few years ago, that always worked however you didn't always get the right album art cover - keeping it all in-house under RDJ would be nice if it's possible (which I'm guessing it is by your response).

Inside of the source for this page -  http://media-ice.musicrad.io/live_script/live_stat.php - is there a way I can call the album art in there? For example at the moment there is an ID for artist, title, duration etc etc - is there one for calling the album art file name? (just like you can do in RDJ stream options '$album_cover$')

TQ

  • Sr. Member

  • Offline
  • ****
  • 293
  • Personal Text
    Perseverance is everything!
    • Emen Valley Radio
Re: Album art file name problem
« Reply #6 on: September 22, 2014, 08:27:11 PM »
Hi

Have you looked at this thread? How to use Export to web feature? it may be what you are looking for.

I have used the basic code that Marius supplied in a completely unorthodox way ie I send all the variables I need for the site in a single string and use a delimiter to put it all into an array. This means I can use Marius's code as-is to get it there. I use this method so that my site, which refreshes every 15 seconds, doesn't put too much pressure on my studio machine yet shows the current track rather than the track that was playing when the page is loaded.

If you want to see the result I have a page which I use to display all the variables to help me code my site here: my variable data.

I'm sure I will get flamed by all the clever coders out there for crappy coding but I'd be glad to give you my code if this approach helps.

TQ
PS Criticisms are very welcome, provided you can supply meaningful code that I can learn from.
A problem is only a problem if you can't find the solution.

Jhonny

  • Hero Member

  • Offline
  • *****
  • 4118
  • Personal Text
    Peace, enjoy life, last sleep is longer than live!
    • Jhonny's RadioDJ tutorials.
Re: Album art file name problem
« Reply #7 on: September 22, 2014, 08:52:48 PM »
Hi TQ.
Quote
I'm sure I will get flamed by all the clever coders out there for crappy coding but I'd be glad to give you my code if this approach helps.

Well i flame you, damm good job.

grtz.
R.T.F.M. means to me, Read The Fantastic Messages.
Einstein says: Make things simple, but don't make simple things simpler! (wise) this is just my life lesson you know.

I don't do drugs, I do tuts. ( ͡° ͜ʖ ͡°) visit  https://radiodj.info

Testing RadioDJ v2.0.3.4 Beta

AndyDeGroo

  • Guest
Re: Album art file name problem
« Reply #8 on: September 22, 2014, 09:19:47 PM »
If you want to see the result I have a page which I use to display all the variables to help me code my site here: my variable data.

I'm sure I will get flamed by all the clever coders out there for crappy coding but I'd be glad to give you my code if this approach helps.
I can't reach the link you provided. It's timing out. Are you sure it is correct and server is up?

I can't flame you until I see your code. :)

Inside of the source for this page -  http://media-ice.musicrad.io/live_script/live_stat.php - is there a way I can call the album art in there? For example at the moment there is an ID for artist, title, duration etc etc - is there one for calling the album art file name? (just like you can do in RDJ stream options '$album_cover$')
If you've successfully set up the demo scripts and they work for you, you should check out my improvements to Jhonny's playing.php script with lastfm art here. It will fetch and save album art and artist's picture from last.fm if it is not found on server. Just modify settings according to your paths and you should be able to test it on your server.

Jhonny

  • Hero Member

  • Offline
  • *****
  • 4118
  • Personal Text
    Peace, enjoy life, last sleep is longer than live!
    • Jhonny's RadioDJ tutorials.
Re: Album art file name problem
« Reply #9 on: September 22, 2014, 09:31:56 PM »
I have seen the link and is truly impressed to me.
And your quote can help for GSE.
Quote
If you've successfully set up the demo scripts and they work for you, you should check out my improvements to Jhonny's playing.php script with lastfm art here. It will fetch and save album art and artist's picture from last.fm if it is not found on server. Just modify settings according to your paths and you should be able to test it on your server.

But GSE questions are free for what you want,

grtz.
R.T.F.M. means to me, Read The Fantastic Messages.
Einstein says: Make things simple, but don't make simple things simpler! (wise) this is just my life lesson you know.

I don't do drugs, I do tuts. ( ͡° ͜ʖ ͡°) visit  https://radiodj.info

Testing RadioDJ v2.0.3.4 Beta

GSE

  • Jr. Member

  • Offline
  • **
  • 94
Re: Album art file name problem
« Reply #10 on: September 23, 2014, 01:44:43 AM »
Thanks for the help guys, just as a reminder my knowledge on php is really non existent, my best understandings fall under audio production rather.

I'm having a bit of a hard time trying to get this setup to work though "playing.php+save-lastfm-art.zip" (from here http://www.radiodj.ro/community/index.php?topic=5884.msg34270#msg34270)

I'm finding that it only searches on lastfm, yet the album art is already locally stored on the server. I have double checked all of the configurations and they all point in direction to the local folder.

The top part of the code for 'playing.php' is as follows:

Code: [Select]
<?php
error_reporting
(0);
error_reporting(E_ALL & ~E_DEPRECATED);
$pageTitle " Now Playing";
require_once(
'serv_inc.php');
require_once(
'function.php');
require_once(
'header.php');

define('ALBUM_ART_PATH'"C:\inetpub\wwwroot\Sub MR\live_script\Album-Art"); // Location of album art on local file system
define('ALBUM_ART_URL'"/album-art/"); // URL of album art directory

define('ARTIST_ART_PATH'"artist-art/"); // Location of artists' pictures on local file system
define('ARTIST_ART_URL'"/artist-art/"); // URL of artists' pictures directory


If anyone here is able to setup a couple of customisations of the script, then I'll be most happy to pay them for their time :)

Ideally what I need the album art script to do is the follow:

  • Check the local folder first > if not found check lastfm > if not found display default station logo
  • Refresh only when the next track starts to play in RDJ -- a good example of this working can be seen here: http://www.gdnradio.com/play/gravity/ although it does appear to be delayed on their player every now and again

Maybe I've missed out some information from some of your resources so far that explain all of this, but I seem to be struggling and coming to a dead end. Like I said if somebody is able to whip up a script that works to those needs above, then please tell me what expense we're looking at and I'll message you about it.

AndyDeGroo

  • Guest
Re: Album art file name problem
« Reply #11 on: September 23, 2014, 02:17:04 AM »
I'm having a bit of a hard time trying to get this setup to work though "playing.php+save-lastfm-art.zip" (from here http://www.radiodj.ro/community/index.php?topic=5884.msg34270#msg34270)

I'm finding that it only searches on lastfm, yet the album art is already locally stored on the server. I have double checked all of the configurations and they all point in direction to the local folder.

The top part of the code for 'playing.php' is as follows:

Code: [Select]
<?php
error_reporting
(0);
error_reporting(E_ALL & ~E_DEPRECATED);
$pageTitle " Now Playing";
require_once(
'serv_inc.php');
require_once(
'function.php');
require_once(
'header.php');

define('ALBUM_ART_PATH'"C:\inetpub\wwwroot\Sub MR\live_script\Album-Art"); // Location of album art on local file system
define('ALBUM_ART_URL'"/album-art/"); // URL of album art directory

define('ARTIST_ART_PATH'"artist-art/"); // Location of artists' pictures on local file system
define('ARTIST_ART_URL'"/artist-art/"); // URL of artists' pictures directory

You're missing the last slash in ALBUM_ART_PATH, that's why it is always fetching last.fm album art and fails to save it locally on server. That constant is used to check if file exists.
Code: [Select]
<?php
define
('ALBUM_ART_PATH'"C:/inetpub/wwwroot/Sub MR/live_script/Album-Art/"); // Location of album art on local file system
define('ALBUM_ART_URL'"/album-art/"); // URL of album art directory

define('ARTIST_ART_PATH'"artist-art/"); // Location of artists' pictures on local file system
define('ARTIST_ART_URL'"/artist-art/"); // URL of artists' pictures directory
?>

Yes, you can use forward slashes for paths in PHP on Windows.

If anyone here is able to setup a couple of customisations of the script, then I'll be most happy to pay them for their time :)

Ideally what I need the album art script to do is the follow:
  • Check the local folder first > if not found check lastfm > if not found display default station logo
  • Refresh only when the next track starts to play in RDJ -- a good example of this working can be seen here: http://www.gdnradio.com/play/gravity/ although it does appear to be delayed on their player every now and again
I can help you out with custom solution for what you need.

First point is already covered by the playing.php I posted. I could use parts of that code for your page.

Second point - realtime updates - can be accomplished using web sockets. Web sockets are easy to set up if you are in full control of your server and can launch PHP as separate process or install node.js to handle Web sockets requests. However, if you don't need near realtime updates, you should be fine with periodic AJAX requests. Indeed, gdnradio.com does exactly that every 15 seconds and that's why it is delayed sometimes.
Similar thing is done in playing.php. Only difference is that it reloads the whole page when current song ends (or should end according to data from database). I'd prefer polling AJAX or Web sockets. An example of polling AJAX (every 10 seconds) I've implemented in RadioH2O player.

Using Web sockets, data can be updated as soon as RadioDJ sends a request to Web Export feature, but downside is that older browsers don't support websockets and you'd still have to use polling AJAX as fallback.

BTW, I'm listening to your radio right now. Sounds great and I like the music for the most part, but it looks like you've placed the $album_cover$ in Stream Titles of RadioDJ options rather than in Now Playing Info settings where it should be.

GSE

  • Jr. Member

  • Offline
  • **
  • 94
Re: Album art file name problem
« Reply #12 on: September 23, 2014, 11:13:49 AM »
Hey - thanks! That seems to have fixed that. I'll message you a little later on about those extras we spoke about and payment for the changes I need - I'm back in at work today (GMT) so I can't really respond during the first part of the day.

As for my stream, well.. I'll warn you now it might sound a little screwed haha. It's not exactly public right now as everything is still being built up, so you were probably likely to hear me firing off multiple songs last night aha. The $album_cover$ call that was in the stream title was something I forgot to change after I was trying something out.

Thanks  :)

TQ

  • Sr. Member

  • Offline
  • ****
  • 293
  • Personal Text
    Perseverance is everything!
    • Emen Valley Radio
Re: Album art file name problem
« Reply #13 on: September 23, 2014, 11:57:43 AM »
I can't reach the link you provided. It's timing out. Are you sure it is correct and server is up?
Had a particularly bad spammer night on another site I've got on that server (hamfiles.co.uk), caused php-cgi to throw a fit. This is why I don't want a direct connection to my station db.

Nick
A problem is only a problem if you can't find the solution.

Jhonny

  • Hero Member

  • Offline
  • *****
  • 4118
  • Personal Text
    Peace, enjoy life, last sleep is longer than live!
    • Jhonny's RadioDJ tutorials.
Re: Album art file name problem
« Reply #14 on: September 23, 2014, 06:46:51 PM »
@ GSE,

I have the script updated with a refresh (java, got it from Marius) and album art.
You must make a fofder where the album art of radio DJ can be copied to and edit the file if necessary.

Save your file live_stat.php some where.
And test the new one maybe this is what you mean.

I have test it for some hours and work nice.
grtz.

ps. You get at least an idea of ​​how it works
And I'm not a programmer

[attachment deleted by admin]
R.T.F.M. means to me, Read The Fantastic Messages.
Einstein says: Make things simple, but don't make simple things simpler! (wise) this is just my life lesson you know.

I don't do drugs, I do tuts. ( ͡° ͜ʖ ͡°) visit  https://radiodj.info

Testing RadioDJ v2.0.3.4 Beta