spacer
spacer search

SwissCenter

Search
spacer
Main Menu
Home
Documentation + FAQ
Screenshots
Downloads
Forums
Bug Tracking
History
Login
Username

Password

Remember me
?
No account yet?

Locations of visitors to this page

 
Home arrow Forums

SwissCenter Forums  


How to include html page in "PLAY NOW"-screen - 2008/09/17 06:09 Hi all,

I’m a bit experimenting with the “PLAY NOW”-screen and I want to include a frame with a html-page within. In “image_screens.php” I added the following code:
Code:

 <iframe frameborder="1" height="200" name="frame1" scrolling="no" width="550"></iframe> <a href="http://www.977music.com/channels/80s/current.html" target="frame1"></a>

As a result the screen gets black and remains black. Also, I couldn't get functions “include" and “url" to work.

Who can help? I attached the full file.

regards, Klaas


File Attachment:
File name: klaas_image_screens_1791.zip
File size:3410 bytes


---------------------------------------------------------------------------
SwissCenter SVN 1087
Simese 1.40 / PHP 4.4.4 / MySQL 4.0.21 / Windows XP
Apache 2.2.8 / PHP 5.2.6 / MySQL 5.0.51b / Linux Synology 2.6.15
Synology DS107+ (128), firmware: DSM 2.0-0702
Pinnacle SC200
  | | The administrator has disabled public write access.
Re: How to include html page in "PLAY NOW"-screen - 2008/09/17 06:25 I see what you are trying to do but it will not work.

You have to understand the purpose of image_screens.php, it generates png images, and not html pages.

The Now Playing screen is a png image which is generated and synced which music in a playlist.

When streaming music we are not in browser mode so cannot display html, only sync images.

Does this clarify things?

Nigel
Player : Netgear EVA700 & Popcorn A-100 (081106)
Server : Vista SP1 Home Premium (Simese 2.07, SwissCenter current SVN)
Spec : Intel C2Q Q6600, 2GB RAM, 1Tb storage.
  | | The administrator has disabled public write access.
Re: How to include html page in "PLAY NOW"-screen - 2008/09/17 07:12 Hi Nigel,

Thanks for your swift reply. Yep, I got your point, but I was thinking/hoping that it would be possible to overlay a frame, more or less alike the AlbumArt that is overlaid; too bad.

Is there another way to get the info located the html-file into the “PLAY NOW” screen? IOW is it possible to retrieve the info with a PHP-script?

regards, Klaas

---------------------------------------------------------------------------
SwissCenter SVN 1087
Simese 1.40 / PHP 4.4.4 / MySQL 4.0.21 / Windows XP
Apache 2.2.8 / PHP 5.2.6 / MySQL 5.0.51b / Linux Synology 2.6.15
Synology DS107+ (128), firmware: DSM 2.0-0702
Pinnacle SC200
  | | The administrator has disabled public write access.
Re: How to include html page in "PLAY NOW"-screen - 2008/09/17 07:19 You can parse the returned html page and use the details to generate the image.

Currently the radio playing screen is static so this would also need changing so that it refreshed at a predefined interval, ie. every 30s.
Player : Netgear EVA700 & Popcorn A-100 (081106)
Server : Vista SP1 Home Premium (Simese 2.07, SwissCenter current SVN)
Spec : Intel C2Q Q6600, 2GB RAM, 1Tb storage.
  | | The administrator has disabled public write access.
Re: How to include html page in "PLAY NOW"-screen - 2008/09/17 08:55 Hi Nigel,

With this
Code:

 <?php $track_977_80s file_get_contents('http://www.977music.com/channels/80s/current.html'); // display file echo $track_977_80s; ?>

I can parse the html-page and it works in my browser. I named the file “details_977_80s.php”.

I’ve saved file “details_977_80s.php” into /etc/parsers/. I added this path to “image_screens.php” (row 13 of attached file) by
Code:

 require_once( realpath(dirname(__FILE__).'/ext/parsers/details_977_80s.php'));


Subsequently, I added the next code to “image_screens.php” (see lines 179 through 190 of the attached file)
Code:

 # ------------------------       # URL Track Info       # ------------------------            $url_width     convert_x(860,SCREEN_COORDS);       $url_x         convert_x(80,SCREEN_COORDS);       $url_y         max($url_y,convert_y(640,SCREEN_COORDS));       $url->rectangle($title_x$time_text_y convert_x(850,SCREEN_COORDS), convert_y(2,SCREEN_COORDS), $title_text_col);       $url_y        += convert_y(60,SCREEN_COORDS);       $image->text(str('TRACK_NAME'),  $url_x$url_y$label_text_col$label_text_size);       wrap($imagenvl($track_977_80s["TITLE"])), $url_x $indent$url_y$url_width$detail_text_col$detail_text_size);


Then I jumped to my TV to find out the screen went black again. Obviously, I’m doing something wrong, but what?

regards, Klaas

PS after I got the parser working, I try to work out the page refreshment



File Attachment:
File name: klaas_image_screens_1792.zip
File size:3379 bytes


---------------------------------------------------------------------------
SwissCenter SVN 1087
Simese 1.40 / PHP 4.4.4 / MySQL 4.0.21 / Windows XP
Apache 2.2.8 / PHP 5.2.6 / MySQL 5.0.51b / Linux Synology 2.6.15
Synology DS107+ (128), firmware: DSM 2.0-0702
Pinnacle SC200
  | | The administrator has disabled public write access.
Re: How to include html page in "PLAY NOW"-screen - 2008/09/17 09:39 Ok, a few issues here...

You have the right idea with:

$track_977_80s = file_get_contents('http://www.977music.com/channels/80s/current.html');

but you don't want this in a separate file in the parsers folder. You are also simply echoing the html contents when you should be parsing the contents to get the required data.

In your image_screens.php you also have $track_977_80s["TITLE"] which is never defined.

In image_screens.php try something like this:

// Get html page contents
$html = file_get_contents('http://www.977music.com/channels/80s/current.html');

// Get title from html page
$title = substr_between_strings($html,'color="#FFFFFFF">','</center>');

You should be applying these changes to music_radio_image.php and not image_screens.php. In music_radio_image.php you can see the refresh period of the radio playing screen is set to 3600secs. Modify this to something more suitable like 30.
Player : Netgear EVA700 & Popcorn A-100 (081106)
Server : Vista SP1 Home Premium (Simese 2.07, SwissCenter current SVN)
Spec : Intel C2Q Q6600, 2GB RAM, 1Tb storage.
  | | The administrator has disabled public write access.
Re: How to include html page in "PLAY NOW"-screen - 2008/09/17 10:27 I'm afraid I'm missing the clue. I followed your advice (or at least I think I did) and restored file "/base/image_screens.php" to its orginal state and adjusted file "music_radio_image.php" as follows
Code:

 :<?php /**************************************************************************************************    SWISScenter Source                                                              Robert Taylor  *************************************************************************************************/   require_once( realpath(dirname(__FILE__).'/base/image_screens.php'));   require_once( realpath(dirname(__FILE__).'/base/capabilities.php'));   if ( isset($_REQUEST["list"]))   {     // List of images to display to the user (changes every 30 seconds)     $server     server_address();     $url        $server."music_radio_image.php?".current_session()."&station=".urlencode(un_magic_quote($_REQUEST["station"]))."&x=.jpg";     $transition now_playing_transition();          // Get html page contents     $html file_get_contents('http://www.977music.com/channels/80s/current.html');     // Get title from html page     $title substr_between_strings($html,'color="#FFFFFFF">','</center>');     echo "30|$transition| |$url|\n";     echo "30|$transition| |$url|\n";   }   else   {     // Generate and display the "Now Playing" screen.         $image station_playing_image(un_magic_quote($_REQUEST["station"]));     $image->output('jpeg');   } /**************************************************************************************************                                                End of file  **************************************************************************************************/ ?>

The original radio screen returns, but no info from the 977 html file.

Can you give me an extra hint, how to deal with this?

many thanks in advance & regards, Klaas

---------------------------------------------------------------------------
SwissCenter SVN 1087
Simese 1.40 / PHP 4.4.4 / MySQL 4.0.21 / Windows XP
Apache 2.2.8 / PHP 5.2.6 / MySQL 5.0.51b / Linux Synology 2.6.15
Synology DS107+ (128), firmware: DSM 2.0-0702
Pinnacle SC200
  | | The administrator has disabled public write access.
Re: How to include html page in "PLAY NOW"-screen - 2008/09/17 10:43 You would just need to paint the text onto the image:

Code:

 {     $colour $this->allocate_colour(255,0,0,0);   // (red,green,blue,alpha)     $font_size 14;     // Generate and display the "Now Playing" screen.         $image station_playing_image(un_magic_quote($_REQUEST["station"]));     $image->text($title100100$colour$font_size);     $image->output('jpeg'); }



Adjusting the X,Y location (100,100) as required.
Player : Pinnacle Showcenter 200 and 1000 (wired ethernet)
Server : Windows XP Pro running on an Athlon XP 2200, 768 Mb RAM, 1.8 Tb storage.

  | | The administrator has disabled public write access.
Re: How to include html page in "PLAY NOW"-screen - 2008/09/17 11:01 Hi Rob & Nigel

I'm getting to feel a bit dum by now

Still don't get it to work. I included Rob's suggestion into file "/music_radio_image.php", but the info doesn't appear. Currently, the file looks like this:
Code:

 <?php /**************************************************************************************************    SWISScenter Source                                                              Robert Taylor  *************************************************************************************************/   require_once( realpath(dirname(__FILE__).'/base/image_screens.php'));   require_once( realpath(dirname(__FILE__).'/base/capabilities.php'));   if ( isset($_REQUEST["list"]))   {     // List of images to display to the user (changes every 30 seconds)     $server     server_address();     $url        $server."music_radio_image.php?".current_session()."&station=".urlencode(un_magic_quote($_REQUEST["station"]))."&x=.jpg";     $transition now_playing_transition();          // Get html page contents     $html file_get_contents('http://www.977music.com/channels/80s/current.html');     // Get title from html page     $title substr_between_strings($html,'color="#FFFFFFF">','</center>');     echo "30|$transition| |$url|\n";     echo "30|$transition| |$url|\n";     $colour $this->allocate_colour(255,0,0,0);   // (red,green,blue,alpha)     $font_size 14;     // Generate and display the "Now Playing" screen.         $image station_playing_image(un_magic_quote($_REQUEST["station"]));     $image->text($title100100$colour$font_size);     $image->output('jpeg');        }   else   {     // Generate and display the "Now Playing" screen.         $image station_playing_image(un_magic_quote($_REQUEST["station"]));     $image->output('jpeg');   } /**************************************************************************************************                                                End of file  **************************************************************************************************/ ?>

What should I do?

regards, Klaas

---------------------------------------------------------------------------
SwissCenter SVN 1087
Simese 1.40 / PHP 4.4.4 / MySQL 4.0.21 / Windows XP
Apache 2.2.8 / PHP 5.2.6 / MySQL 5.0.51b / Linux Synology 2.6.15
Synology DS107+ (128), firmware: DSM 2.0-0702
Pinnacle SC200
  | | The administrator has disabled public write access.
Re: How to include html page in "PLAY NOW"-screen - 2008/09/17 11:11 You put the code in the wrong place, that's all.

The first part of the IF statement returns the list of images that the player will display while the music is playing.

The second part of the IF statement gets used when it's time to actually display the image on the screen. It's here that we need to determine what is playing and paint the text onto the image.

Code:

  <?php /**************************************************************************************************    SWISScenter Source                                                              Robert Taylor  *************************************************************************************************/   require_once( realpath(dirname(__FILE__).'/base/image_screens.php'));   require_once( realpath(dirname(__FILE__).'/base/capabilities.php'));   if ( isset($_REQUEST["list"]))   {     // List of images to display to the user (changes every 30 seconds)     $server     server_address();     $url        $server."music_radio_image.php?".current_session()."&station=".urlencode(un_magic_quote($_REQUEST["station"]))."&x=.jpg";     $transition now_playing_transition();          echo "30|$transition| |$url|\n";     echo "30|$transition| |$url|\n";   }   else   {     // Get html page contents     $html file_get_contents('http://www.977music.com/channels/80s/current.html');     // Get title from html page     $title substr_between_strings($html,'color="#FFFFFFF">','</center>');     // Generate and display the "Now Playing" screen.         $image station_playing_image(un_magic_quote($_REQUEST["station"]));     $colour $image->allocate_colour(255,0,0,0);   // (red,green,blue,alpha)     $font_size 14;     $image->text($title100100$colour$font_size);     $image->output('jpeg');   } /**************************************************************************************************                                                End of file  **************************************************************************************************/ ?>


[EDIT] Corrected the setting of $colour.
Player : Pinnacle Showcenter 200 and 1000 (wired ethernet)
Server : Windows XP Pro running on an Athlon XP 2200, 768 Mb RAM, 1.8 Tb storage.

  | | The administrator has disabled public write access.
Re: How to include html page in "PLAY NOW"-screen - 2008/09/17 11:14 So close...

Code:

 <?php /**************************************************************************************************    SWISScenter Source                                                              Robert Taylor  *************************************************************************************************/   require_once( realpath(dirname(__FILE__).'/base/image_screens.php'));   require_once( realpath(dirname(__FILE__).'/base/capabilities.php'));   if ( isset($_REQUEST["list"]))   {     // List of images to display to the user (changes every 30 seconds)     $server     server_address();     $url        $server."music_radio_image.php?".current_session()."&station=".urlencode(un_magic_quote($_REQUEST["station"]))."&x=.jpg";     $transition now_playing_transition();     echo "30|$transition| |$url|\n";     echo "30|$transition| |$url|\n";       }   else   {     // Generate and display the "Now Playing" screen.         $image station_playing_image(un_magic_quote($_REQUEST["station"]));     // Get html page contents     $html file_get_contents('http://www.977music.com/channels/80s/current.html');     // Get title from html page     $title substr_between_strings($html,'color="#FFFFFFF">','</center>');     $colour $image->allocate_colour(255,0,0,0);   // (red,green,blue,alpha)     $font_size 14;     $image->text($title100100$colour$font_size);     $image->output('jpeg');   } /**************************************************************************************************                                                End of file  **************************************************************************************************/ ?>

Player : Netgear EVA700 & Popcorn A-100 (081106)
Server : Vista SP1 Home Premium (Simese 2.07, SwissCenter current SVN)
Spec : Intel C2Q Q6600, 2GB RAM, 1Tb storage.
  | | The administrator has disabled public write access.
Re: How to include html page in "PLAY NOW"-screen - 2008/09/17 11:40 CHAPEAU guys,

You got it to work ...

I'll work it out a bit for all .977 channels and create a "PLAY NOW"-screen. When done I'll post the files for those interested.

once again many thanks for your support, Klaas

---------------------------------------------------------------------------
SwissCenter SVN 1087
Simese 1.40 / PHP 4.4.4 / MySQL 4.0.21 / Windows XP
Apache 2.2.8 / PHP 5.2.6 / MySQL 5.0.51b / Linux Synology 2.6.15
Synology DS107+ (128), firmware: DSM 2.0-0702
Pinnacle SC200
  | | The administrator has disabled public write access.
Re: How to include html page in "PLAY NOW"-screen - 2008/09/17 12:27 Well, I'm back again ... this time for a small issue (I hope).

I cannot change the colour of the displayed info. It's black and whatever colour code I try the characters remain black.

What should I do to get the characters in white?

many thanks and regards, Klaas

---------------------------------------------------------------------------
SwissCenter SVN 1087
Simese 1.40 / PHP 4.4.4 / MySQL 4.0.21 / Windows XP
Apache 2.2.8 / PHP 5.2.6 / MySQL 5.0.51b / Linux Synology 2.6.15
Synology DS107+ (128), firmware: DSM 2.0-0702
Pinnacle SC200
  | | The administrator has disabled public write access.
Re: How to include html page in "PLAY NOW"-screen - 2008/09/17 12:45 Change the RGB values in the $colour line:

$colour = $image->allocate_colour(255,255,255,0);

Try this site to determine RGB values for various colours.
Player : Netgear EVA700 & Popcorn A-100 (081106)
Server : Vista SP1 Home Premium (Simese 2.07, SwissCenter current SVN)
Spec : Intel C2Q Q6600, 2GB RAM, 1Tb storage.
  | | The administrator has disabled public write access.
Re: How to include html page in "PLAY NOW"-screen - 2008/09/17 13:20 Hi Nigel,

Thanks, problem solved, regards, Klaas

---------------------------------------------------------------------------
SwissCenter SVN 1087
Simese 1.40 / PHP 4.4.4 / MySQL 4.0.21 / Windows XP
Apache 2.2.8 / PHP 5.2.6 / MySQL 5.0.51b / Linux Synology 2.6.15
Synology DS107+ (128), firmware: DSM 2.0-0702
Pinnacle SC200
  | | The administrator has disabled public write access.
Re: How to include html page in "PLAY NOW"-screen - 2008/09/17 16:22 Hi Nigel & Rob,

As the journey continues new challenges pop up. With the parser working for the “.977 The 80s Channel” (http://www.977music.com/channels/80s/current.html), the info of this particular station appears on all radio screens, so while listening to “.977 The Classic Rock Channel” (track info stored in (http://www.977music.com/channels/classicrock/current.html), the track details of "The 80s Channel" appear.

In order to avoid this I tried an “if ... else” statement based on $station_name, defined in “/base/image_screens.php”-file, but $station_name isn’t part of “/music_radio_image.php”-file, so the trick doesn’t work.

I suppose the “if … else”-statement should be based upon the url in which the track info is included, but I don’t have a clue how to do this.

Could you help me out once again?

thanks & regards, Klaas

---------------------------------------------------------------------------
SwissCenter SVN 1087
Simese 1.40 / PHP 4.4.4 / MySQL 4.0.21 / Windows XP
Apache 2.2.8 / PHP 5.2.6 / MySQL 5.0.51b / Linux Synology 2.6.15
Synology DS107+ (128), firmware: DSM 2.0-0702
Pinnacle SC200
  | | The administrator has disabled public write access.
Re: How to include html page in "PLAY NOW"-screen - 2008/09/17 17:53 in music_radio_image.php you can check the station name in $_REQUEST["station"].

Code:

 $station_name un_magic_quote($_REQUEST["station"]; if ($station_name== '.977 The 80s Channel')   $html file_get_contents('http://www.977music.com/channels/80s/current.html'); elseif ($station_name== '.977 The Classic Rock Channel')   $html file_get_contents('http://www.977music.com/channels/classicrock/current.html'); else   $html '';

Player : Netgear EVA700 & Popcorn A-100 (081106)
Server : Vista SP1 Home Premium (Simese 2.07, SwissCenter current SVN)
Spec : Intel C2Q Q6600, 2GB RAM, 1Tb storage.
  | | The administrator has disabled public write access.
Re: How to include html page in "PLAY NOW"-screen - 2008/09/17 19:05 Hi Nigel,

Something's going wron'; I added your suggested code to "/music_radio_image.php" as follows:
Code:

 <?php /**************************************************************************************************    SWISScenter Source                                                              Robert Taylor  *************************************************************************************************/   require_once( realpath(dirname(__FILE__).'/base/image_screens.php'));   require_once( realpath(dirname(__FILE__).'/base/capabilities.php'));   if ( isset($_REQUEST["list"]))   {     // List of images to display to the user (changes every 30 seconds)     $server     server_address();     $url        $server."music_radio_image.php?".current_session()."&station=".urlencode(un_magic_quote($_REQUEST["station"]))."&x=.jpg";     $transition now_playing_transition();     echo "10|$transition| |$url|\n";     echo "10|$transition| |$url|\n";       }   else   {     // Generate and display the "Now Playing" screen & Get html page contents       $station_name un_magic_quote($_REQUEST["station"];     if ($station_name == '.977 The 80s Channel')       {$html file_get_contents('http://www.977music.com/channels/80s/current.html');}     elseif ($station_name == '.977 The Classic Rock Channel')       {$html file_get_contents('http://www.977music.com/channels/classicrock/current.html');}     else       {$html '';}     // Get title from html page     $title substr_between_strings($html,'color="#FFFFFFF">','</center>');     $font_size 14;          $colour_track $image->allocate_colour(255,255,0);     $image->text(str('TRACK_NAME'), 52470$colour_track$font_size);       $colour $image->allocate_colour(255,255,255,0);     $image->text($title52500$colour$font_size);     $image->output('jpeg');   } /**************************************************************************************************                                                End of file  **************************************************************************************************/ ?>


However, the screen turns black. I've added braces in your "if ... elseif ... else"-statement, but with or without braces still no screen.

Any idea what can I try?

regards, Klaas

---------------------------------------------------------------------------
SwissCenter SVN 1087
Simese 1.40 / PHP 4.4.4 / MySQL 4.0.21 / Windows XP
Apache 2.2.8 / PHP 5.2.6 / MySQL 5.0.51b / Linux Synology 2.6.15
Synology DS107+ (128), firmware: DSM 2.0-0702
Pinnacle SC200
  | | The administrator has disabled public write access.
Re: How to include html page in "PLAY NOW"-screen - 2008/09/17 20:24 Missing bracket at end of $station_name line:

$station_name = un_magic_quote($_REQUEST["station"]);

You should get yourself a PHP editor which will show any syntax issues.
Player : Netgear EVA700 & Popcorn A-100 (081106)
Server : Vista SP1 Home Premium (Simese 2.07, SwissCenter current SVN)
Spec : Intel C2Q Q6600, 2GB RAM, 1Tb storage.
  | | The administrator has disabled public write access.
Re: How to include html page in "PLAY NOW"-screen - 2008/09/18 05:26 Hi Nigel,

Euh … to be honest I’m using a PHP editor (“PHP Editor 2.22), but you’re right syntax error problems can be easily solved; I’m now using a simple internet tool that flags them.

I worked out the “music_radio_image.php”-file according your suggestion and it seems to work fine by now.
Code:

 <?php /**************************************************************************************************    SWISScenter Source                                                              Robert Taylor  *************************************************************************************************/   require_once( realpath(dirname(__FILE__).'/base/image_screens.php'));   require_once( realpath(dirname(__FILE__).'/base/capabilities.php'));   if ( isset($_REQUEST["list"]))   {     // List of images to display to the user (changes every 30 seconds)     $server     server_address();     $url        $server."music_radio_image.php?".current_session()."&station=".urlencode(un_magic_quote($_REQUEST["station"]))."&x=.jpg";     $transition now_playing_transition();     echo "10|$transition| |$url|\n";     echo "10|$transition| |$url|\n";       }   else   {     // Generate and display the "Now Playing" screen.         $image station_playing_image(un_magic_quote($_REQUEST["station"]));     // Get html page contents     $station_name un_magic_quote($_REQUEST["station"]);     if ($station_name == '.977 The 80s Channel')         {$html file_get_contents('http://www.977music.com/channels/80s/current.html');}     elseif ($station_name == '.977 The Classic Rock Channel')         {$html file_get_contents('http://www.977music.com/channels/classicrock/current.html');}     else         {$html '';}     {      // Get title from html page      $title substr_between_strings($html,'color="#FFFFFFF">','</center>');      $font_size 14;      if (!empty($html))      {      $colour_track $image->allocate_colour(255,255,0);      $image->text(str('TRACK_NAME'), 52470$colour_track$font_size);      }      else      {}        $colour $image->allocate_colour(255,255,255,0);      $image->text($title52500$colour$font_size);      $image->output('jpeg');     }   } /**************************************************************************************************                                                End of file  **************************************************************************************************/ ?>


When I’ve got the ‘PLAY NOW”-screen ready for all .977 radio channels and maybe a couple of radio stations more, I’ll post the files.

many thanks to you and Rob for all support to help me out with this,

regards, Klaas

---------------------------------------------------------------------------
SwissCenter SVN 1087
Simese 1.40 / PHP 4.4.4 / MySQL 4.0.21 / Windows XP
Apache 2.2.8 / PHP 5.2.6 / MySQL 5.0.51b / Linux Synology 2.6.15
Synology DS107+ (128), firmware: DSM 2.0-0702
Pinnacle SC200