Anybody good at PHP? attn: bitwise
- FragaGeddon
- Posts: 3229
- Joined: Sun Sep 17, 2000 7:00 am
Anybody good at PHP? attn: bitwise
I don't know shit and need some help.
Last edited by FragaGeddon on Mon May 16, 2005 4:13 am, edited 1 time in total.
[img]http://www.fragageddon.com/images/albums/userpics/10001/FragaGeddon.png[/img]
What are you trying to do?
http://andyman82.com/forum/index.php
Edit: while its out there, how in the hell can I cahnge the big "LOGO" on the top left?
http://andyman82.com/forum/index.php
Edit: while its out there, how in the hell can I cahnge the big "LOGO" on the top left?
Uhhh...with a flash editor?andyman wrote:What are you trying to do?
http://andyman82.com/forum/index.php
Edit: while its out there, how in the hell can I cahnge the big "LOGO" on the top left?
[img]http://www.subliminaldissonance.com/popehat.jpg[/img] [img]http://www.subliminaldissonance.com/images/smilies/nothing.jpg[/img]
- FragaGeddon
- Posts: 3229
- Joined: Sun Sep 17, 2000 7:00 am
I'm want to use this program: Now Playing
I just need help with the PHP file to set it up the way I want.
I want to find the images from my own directory on my site.
Want to remove the Now Playing link and move the artists name above the album cover.
I was hoping of someway of making it into a gif.
Or does someone know of a better program that works with iTunes?
I just need help with the PHP file to set it up the way I want.
Code: Select all
<?php
error_reporting(E_ALL ^ E_NOTICE);
$file = "now_playing.xml";
$xml_parser = xml_parser_create();
if ( is_file( $file ) )
{
$fp = fopen( $file, "r" );
$data = fread( $fp, filesize( $file ) );
fclose( $fp );
xml_parse_into_struct( $xml_parser, $data, $vals, $index );
xml_parser_free( $xml_parser );
if ( isset( $_GET["debug"] ) )
{
echo "<pre>";
echo "Index array\n";
print_r($index);
echo "\nVals array\n";
print_r($vals);
echo "</pre>\n\n";
}
$fHeader = false;
if ( $vals[ $index["NOW_PLAYING"][0] ]["attributes"]["PLAYING"] == 1 )
{
foreach ( $index["TITLE"] as $i => $j )
{
$url = '';
$title = $vals[ $index["TITLE"][$i] ]["value"];
if ( strlen( $title ) > 0 )
{
$artist = $vals[ $index["ARTIST"][$i] ]["value"];
$album = $vals[ $index["ALBUM"][$i] ]["value"];
$genre = $vals[ $index["GENRE"][$i] ]["value"];
$kind = $vals[ $index["KIND"][$i] ]["value"];
$track = $vals[ $index["TRACK"][$i] ]["value"];
$numtracks = $vals[ $index["NUMTRACKS"][$i] ]["value"];
$year = $vals[$index["YEAR"][$i] ]["value"];
$comments = $vals[ $index["COMMENTS"][$i] ]["value"];
$time = $vals[ $index["TIME"][$i] ]["value"];
$bitrate = $vals[ $index["BITRATE"][$i] ]["value"];
$rating = $vals[ $index["RATING"][$i] ]["value"];
$disc = $vals[ $index["DISC"][$i] ]["value"];
$numdiscs = $vals[ $index["NUMDISCS"][$i] ]["value"];
$playcount = $vals[ $index["PLAYCOUNT"][$i] ]["value"];
$compilation = $vals[ $index["COMPILATION"][$i] ]["value"];
$urlamazon = $vals[ $index["URLAMAZON"][$i] ]["value"];
$urlapple = $vals[ $index["URLAPPLE"][$i] ]["value"];
$imageurl = $vals[ $index["IMAGE"][$i] ]["value"];
$composer = $vals[ $index["COMPOSER"][$i] ]["value"];
$urlsource = $vals[ $index["URLSOURCE"][$i] ]["value"];
$grouping = $vals[ $index["GROUPING"][$i] ]["value"];
if ( strlen( $grouping ) > 0 && strcmp( $grouping, "Podcast" ) == 0 )
{
$imageurl = '/images/podcast.gif';
}
else if ( strlen( $imageurl ) == 0 )
{
$imageurl = '/images/music-no-image.gif';
}
else
{
list($width, $height, $type, $attr) = getimagesize( $imageurl );
if ( $width == 1 || $height == 1 )
{
$imageurl = '/images/music-no-image.gif';
}
}
#
# If we couldn't find them at Amazon, let's just do an artist search at B&N
#
if ( strlen( $urlamazon ) > 0 )
{
$url = $urlamazon;
}
else if ( strncmp( $comments, "http://", 7 ) == 0 )
{
$url = $comments;
}
else if ( strlen( $urlsource ) > 0 )
{
$url = $urlsource;
}
else
{
$url = 'http://music.barnesandnoble.com/search/results.asp?NME=' . urlencode( $artist ) . '&SNG=&INS=&LBL=&TYP=P&CAT=&Search=Search';
}
#
# Output
#
if ( isset( $_GET["debug"] ) )
{
echo "<script type=\"text/javascript\">\n";
}
if ( !$fHeader )
{
$fHeader = true;
echo 'document.write("<div class=\"sidetitle\">Now Playing (<a href=\"http://brandon.fuller.name/archives/hacks/nowplaying/\">?</a>)</div>");' . "\n";
}
echo 'document.write("<div class=\"side\" style=\"text-align: center;\"><a href=\"' . $url . '\" target=\"new\"><img src=\"' . $imageurl . '\" alt=\"' . htmlentities( $artist, ENT_QUOTES );
if ( strlen( $album ) > 0 )
{
echo ' - ' . htmlentities( $album, ENT_QUOTES );
}
echo '\" /></a><br /><a href=\"' . $url . '\" target=\"new\">' . htmlentities( $artist, ENT_QUOTES ) . '</a><br><i>' . htmlentities( $title, ENT_QUOTES ) . "</i>\");\n";
if ( strlen( $rating ) > 0 && !isset( $_GET["hide_rating"] ) )
{
echo 'document.write("<br /><br /><img src=\"/images/stars-' . $rating . '.gif\" alt=\"Rating\" />");' . "\n";
}
if ( strlen( $urlapple ) > 0 )
{
echo 'document.write("<br /><br /><a href=\"' . $urlapple . '\"><img src=\"/images/iTunes.gif\" alt=\"View at iTunes Music Store!\" /></a>");' . "\n";
}
echo "document.write(\"</div>\");\n";
if ( isset( $_GET["debug"] ) )
{
echo "</script>\n";
}
}
}
}
}
?>Want to remove the Now Playing link and move the artists name above the album cover.
I was hoping of someway of making it into a gif.
Or does someone know of a better program that works with iTunes?
[img]http://www.fragageddon.com/images/albums/userpics/10001/FragaGeddon.png[/img]
yea i know that but it is embedded in the php code somewhere and i don't know how to make it read a different image. I have found the original flash of LOGO HERE but no programs are able to break it down into editable parts.Canidae wrote:Uhhh...with a flash editor?andyman wrote:What are you trying to do?
http://andyman82.com/forum/index.php
Edit: while its out there, how in the hell can I cahnge the big "LOGO" on the top left?
If you look at the source code on your forum it has a line that says "comment out this line in order to use a gif image instead of flash." You have to find that in the code somewhere . I'd imagine it might be in the pages that deal with the template.
[size=85]yea i've too been kind of thinking about maybe a new sig but sort of haven't come to quite a decision yet[/size]
- FragaGeddon
- Posts: 3229
- Joined: Sun Sep 17, 2000 7:00 am
- FragaGeddon
- Posts: 3229
- Joined: Sun Sep 17, 2000 7:00 am
If you check the site you might understand it a bit better?!?
All mages are here: http://www.fragageddon.com/images/MP3
All mages are here: http://www.fragageddon.com/images/MP3
[img]http://www.fragageddon.com/images/albums/userpics/10001/FragaGeddon.png[/img]
Ok, this should tweak it the way you want. If you want to run images on your machine I could setup a system for you but we would have to agree on what you wanted to do and you would need to manually upload those images in the format. For example do want to have it setup like: 'images/albums/artist-album.gif' ?
Code: Select all
<?php
error_reporting(E_ALL ^ E_NOTICE);
$file = "now_playing.xml";
$xml_parser = xml_parser_create();
if ( is_file( $file ) )
{
$fp = fopen( $file, "r" );
$data = fread( $fp, filesize( $file ) );
fclose( $fp );
xml_parse_into_struct( $xml_parser, $data, $vals, $index );
xml_parser_free( $xml_parser );
if ( isset( $_GET["debug"] ) )
{
echo "<pre>";
echo "Index array\n";
print_r($index);
echo "\nVals array\n";
print_r($vals);
echo "</pre>\n\n";
}
$fHeader = false;
if ( $vals[ $index["NOW_PLAYING"][0] ]["attributes"]["PLAYING"] == 1 )
{
foreach ( $index["TITLE"] as $i => $j )
{
$url = '';
$title = $vals[ $index["TITLE"][$i] ]["value"];
if ( strlen( $title ) > 0 )
{
$artist = $vals[ $index["ARTIST"][$i] ]["value"];
$album = $vals[ $index["ALBUM"][$i] ]["value"];
$genre = $vals[ $index["GENRE"][$i] ]["value"];
$kind = $vals[ $index["KIND"][$i] ]["value"];
$track = $vals[ $index["TRACK"][$i] ]["value"];
$numtracks = $vals[ $index["NUMTRACKS"][$i] ]["value"];
$year = $vals[$index["YEAR"][$i] ]["value"];
$comments = $vals[ $index["COMMENTS"][$i] ]["value"];
$time = $vals[ $index["TIME"][$i] ]["value"];
$bitrate = $vals[ $index["BITRATE"][$i] ]["value"];
$rating = $vals[ $index["RATING"][$i] ]["value"];
$disc = $vals[ $index["DISC"][$i] ]["value"];
$numdiscs = $vals[ $index["NUMDISCS"][$i] ]["value"];
$playcount = $vals[ $index["PLAYCOUNT"][$i] ]["value"];
$compilation = $vals[ $index["COMPILATION"][$i] ]["value"];
$urlamazon = $vals[ $index["URLAMAZON"][$i] ]["value"];
$urlapple = $vals[ $index["URLAPPLE"][$i] ]["value"];
$imageurl = $vals[ $index["IMAGE"][$i] ]["value"];
$composer = $vals[ $index["COMPOSER"][$i] ]["value"];
$urlsource = $vals[ $index["URLSOURCE"][$i] ]["value"];
$grouping = $vals[ $index["GROUPING"][$i] ]["value"];
if ( strlen( $grouping ) > 0 && strcmp( $grouping, "Podcast" ) == 0 )
{
$imageurl = '/images/podcast.gif';
}
else if ( strlen( $imageurl ) == 0 )
{
$imageurl = '/images/music-no-image.gif';
}
else
{
list($width, $height, $type, $attr) = getimagesize( $imageurl );
if ( $width == 1 || $height == 1 )
{
$imageurl = '/images/music-no-image.gif';
}
}
#
# If we couldn't find them at Amazon, let's just do an artist search at B&N
#
if ( strlen( $urlamazon ) > 0 )
{
$url = $urlamazon;
}
else if ( strncmp( $comments, "http://", 7 ) == 0 )
{
$url = $comments;
}
else if ( strlen( $urlsource ) > 0 )
{
$url = $urlsource;
}
else
{
$url = 'http://music.barnesandnoble.com/search/results.asp?NME=' . urlencode( $artist ) . '&SNG=&INS=&LBL=&TYP=P&CAT=&Search=Search';
}
#
# Output
#
if ( isset( $_GET["debug"] ) )
{
echo "<script type=\"text/javascript\">\n";
}
if ( $fHeader )
{
$fHeader = true;
echo 'document.write("<div class=\"sidetitle\">Now Playing (<a href=\"http://brandon.fuller.name/archives/hacks/nowplaying/\">?</a>)</div>");' . "\n";
}
echo 'document.write("<div class=\"side\" style=\"text-align: center;\"><a href=\"' . $url . '\" target=\"new\">' . htmlentities( $artist, ENT_QUOTES ) . '</a><br><a href=\"' . $url . '\" target=\"new\"><img src=\"' . $imageurl . '\" alt=\"' . htmlentities( $artist, ENT_QUOTES );
if ( strlen( $album ) > 0 )
{
echo ' - ' . htmlentities( $album, ENT_QUOTES );
}
echo '\" /></a><br /><i>' . htmlentities( $title, ENT_QUOTES ) . "</i>\");\n";
if ( strlen( $rating ) > 0 && !isset( $_GET["hide_rating"] ) )
{
echo 'document.write("<br /><br /><img src=\"/images/stars-' . $rating . '.gif\" alt=\"Rating\" />");' . "\n";
}
if ( strlen( $urlapple ) > 0 )
{
echo 'document.write("<br /><br /><a href=\"' . $urlapple . '\"><img src=\"/images/iTunes.gif\" alt=\"View at iTunes Music Store!\" /></a>");' . "\n";
}
echo "document.write(\"</div>\");\n";
if ( isset( $_GET["debug"] ) )
{
echo "</script>\n";
}
}
}
}
}
?>
- FragaGeddon
- Posts: 3229
- Joined: Sun Sep 17, 2000 7:00 am
Yeah I'm planning on uploading the images.bitWISE wrote:Ok, this should tweak it the way you want. If you want to run images on your machine I could setup a system for you but we would have to agree on what you wanted to do and you would need to manually upload those images in the format. For example do want to have it setup like: 'images/albums/artist-album.gif' ?
The file name would be: Artist - Album title
[img]http://www.fragageddon.com/images/albums/userpics/10001/FragaGeddon.png[/img]
- FragaGeddon
- Posts: 3229
- Joined: Sun Sep 17, 2000 7:00 am
- FragaGeddon
- Posts: 3229
- Joined: Sun Sep 17, 2000 7:00 am
I believe I can change this to reflect my site:
Just not sure about this:
Code: Select all
http://music.barnesandnoble.com/search/results.asp?NME=Code: Select all
. urlencode( $artist ) . '&SNG=&INS=&LBL=&TYP=P&CAT=&Search=Search';[img]http://www.fragageddon.com/images/albums/userpics/10001/FragaGeddon.png[/img]
- FragaGeddon
- Posts: 3229
- Joined: Sun Sep 17, 2000 7:00 am