Apr
16
It’s Easier Being a Pirate
Posted by john in music

276bgblack.jpgAfter much resistance from me and his mom, my nephew finally convinced his mom to let him purchase a MP3 player. So being the family tech geek, my services were called upon to help get the player working.

They seemed to be willing to pay for a subscription fee, so I was going to be a good internet user and go the “legal” route. So we open the box and start to install the software (Yahoo Music Manager and Player -I forget the exact name). After about 45 min of installing the software getting the updates, signing up for an account, we’re finally ready to start purchasing songs.

We search for a song and find the one he wants to add. We add it to our “Playlist” first then we have to drag it to our player. Extra step, but ok, I can deal with that. Do we start to transfer the song over to the player and nothing happens. It just sits there saying “Transfering files (1 of 1)” for about 15 min. But nothing gets transfered. So we try another song, then another and so on. Nothing worked!

At this point I had to get going as my 2 hour patience limit had expired, but this leads me to my point: It’s easier being a pirate.

We could have downloaded any torrent software, found the songs we wanted, and been listening to them in under 30 min. And best of all that music we got could have been transfered to any player and would ours to keep. (not to mention free, but that’s really not the point.)

I’ve used iTunes in the past and my experience was not as bad as this, but the simple fact that these songs can only be played on X number of players and PCs really turns me off. I know I can burn them to a CD and yady ya… but that’s such a waste of time and resources.

So until these companies get their business model fixed, I still think it’s easier to be a pirate. Arrggg!



Mar
21
Display Last.fm’s Recent Tracks on Web Site with PHP Function
Posted by john in music, php, programing

Being a very big music buff, I love being able to see what my music habits are. I’m currently using the most up-to-date version of Winamp, which does a good job of keep a history of what I listen to, but I wanted this info on the web for the world to see.

Fortunatly, Last.fm has this sweet software that “scrobbles” or sends your track data via a third part plugin to Winamp to their servers which out puts in return to a standard text file. (check out Last.fm anyway if you’re into music - it’s a cool way to meet people with similar music tastes.)

Just call up this function and echo it as followed.

// Program: recenttracks.php
// By: linein.org
// Date: 11.3.2006
// File format: timestamp,artist - track

// your last.fm username

function recenttracks($user)
{
// location on server where the cached file will be located (it must be absolute and the folder must have full (777) permission)
$cache = "$_SERVER[DOCUMENT_ROOT]/media/recenttracks.txt";

// sets played date using PHP date
$date_format = 'g:i a m.d.Y'; // 10:31 am 11.03.2006

// display styles
$track_num_style = 'font-family: arial; font-size: 10px; color: #666;';
$artist_style = 'font-family: arial; font-size: 11px; color: #fff;';
$track_style = 'font-family: arial; font-size: 11px; color: #fff;';
$date_style = 'font-family: arial; font-size:9px; color: #666;';
$dash_style = 'font-family: arial; font-size:9px; color: #999;';

// you could add here the ability to only cache ever 30 min or so, but I like it live
filemtime($cache);
$update = @file_get_contents("http://ws.audioscrobbler.com/1.0/user/$user/recenttracks.txt");
$f = fopen($cache, "w");
fwrite($f, $update);
fclose($f);

$cache = file_get_contents($cache);
$cache = str_replace( '–', '-', $cache ); // replaces en dash with regular dash (thanks MrSomeone - http://www.last.fm/user/MrSomeone/)
$cache = explode("\n", $cache);

$track_num = 1; // starting track number (you could change to count($cache) and count down)
foreach($cache as $data)
{
if(!empty($data))
{
$info = explode(",", $data, 2); // sperates date by only seperating at fist instance of a comma (since some artist/track have comma in their names

$played_time = $info[0];
$info_track = explode(" - ", $info[1]); // seperates artist and title

$artist = $info_track[0];
$title = $info_track[1];

$listingto .= ''.$track_num.')
'.$artist.'
-
'.$title.'
('.date("$date_format", $played_time).')

';
$track_num++; // adds 1 to track number
}
}
return $listingto;
}

(download as text)

Then once you’ve called the function:

$last_fm_username = 'linein_org';
$recent_tracks = recenttracks($last_fm_username);

Example with formating.

Feel free to change the function (especially the styles) to fit your needs, but please do give credit where it’s needed. I’m currently using a modified version to not only display these tracks, but to store them into a MySQL database which allows me to keep track of my music history. check it out here



|