Skip to Content
It is currently November 20th, 2019, 3:25 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 106 posts ]  Go to page 1, 2, 3, 4, 5 ... 8  Next
Author Message
PostPosted: January 2nd, 2007, 9:44 am 
Offline
New User
New User

Joined: December 25th, 2006, 9:41 pm
Posts: 14
Hello,

Just developed (and have been testing for a few days now) a simple AudioScrobbler plugin for SAM.

Installation:
- install php4 or php5 (no web server required), enable the cURL module
- use the "_lastfm.html" file included as a template and make SAM generate a song information file (ie. "lastfm.html")
- edit lastfm.php and change the parameters (explained in the php file)
- run it

after the next song starts playing it will start gathering information (from the lastfm.html file sam generates) and submit it when the time is right (song is at 50% or at 240 secs, whichever comes first)


Download: http://www.ehore.com/apps/lastfm-sam/la ... am-0.1.zip

Comments are welcome.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 2nd, 2007, 10:19 am 
Offline
Super User
Super User

Joined: March 24th, 2006, 7:23 pm
Posts: 1037
can you explain how to know if cURL is working? or how to enable it. I installed it with PHP 5. Do I then have to run PHP - by clicking on php.exe?


and when you say "run it" at the end what do you mean? Run the lastfm.php file? How do you do that exactly?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 2nd, 2007, 10:34 am 
Offline
New User
New User

Joined: December 25th, 2006, 9:41 pm
Posts: 14
ah, yes.

php.exe is the way to run php files from the command-line (cli). we use that.

php configuration:
1. copy one of the sample php.ini files (there's a php.ini-recommended and one other iirc) as "c:\windows\php.ini"

2. edit php.ini and enable the curl module (look for curl, enable it by removing the ";" in the first column)

3. you might also have to change extension_dir in php.ini to "c:/php installation path/ext"

4. btw, php "installer" doesn't come with the extensions (ie. the cURL module) it's best to use the zip file (or you can copy over "extensions\php_curl.dll" from the zip to the extensions dir in php installation path)

running it: double click on lastfm.php, associate php files with php.exe (or you can just make a shortcut to "c:\php installation path\php.exe" "c:\path to lastfm plugin\lastfm.php"


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 2nd, 2007, 10:41 am 
Offline
Super User
Super User

Joined: March 24th, 2006, 7:23 pm
Posts: 1037
Quote:
4. btw, php "installer" doesn't come with the extensions (ie. the cURL module) it's best to use the zip file (or you can copy over "extensions\php_curl.dll" from the zip to the extensions dir in php installation path)

well it was an option when installing and I see the php_curl.dll in the ext folder.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 2nd, 2007, 10:44 am 
Offline
New User
New User

Joined: December 25th, 2006, 9:41 pm
Posts: 14
ah great, so they finally fixed that :)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 2nd, 2007, 10:49 am 
Offline
Super User
Super User

Joined: March 24th, 2006, 7:23 pm
Posts: 1037
I believe that I've done everything you've written...

when I run the php file, the command line window opens, a bunch of stuff flies by in the window and then it exits. Too fast to see what's happening. Nothing happens on my lastfm page.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 2nd, 2007, 11:05 am 
Offline
New User
New User

Joined: December 25th, 2006, 9:41 pm
Posts: 14
if the command line window doesn't stick then there's something wrong and it's printing a bunch of errors.

start->run, cmd.exe, run the lastfm.php from the command line. so the window stays open after you run it.

if you associated .php files with php.exe you could just naviate to the lastfm.php path (bunch of cd path commands) then just do a "lastfm.php <enter>". if not you'll have to do a c:\path\to\php\php.exe lastfm.php.

it's probably errors about curl extension not being found (extension path?) or something else maybe


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 2nd, 2007, 11:45 am 
Offline
Super User
Super User

Joined: March 24th, 2006, 7:23 pm
Posts: 1037
yeah it stays open if I do it that way - but so much junk flies by and it won't allow me to scroll up to see where it started. Stupid....

I checked the php.ini and it has the correct path the the ext folder and it already had the php_curl.dll extention un-commented at the bottom of the file. I copied the php.ini file to C:\WINDOWS

I set the php.ini to send the error to the NT event viewer

it says

php (2916), PHP Warning: Module 'curl' already loaded in Unknown on line 0.

I had two lines un-commented. So I removed one and now I don't get an error. It just runs and exits. :(


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 2nd, 2007, 11:46 am 
Offline
New User
New User

Joined: December 25th, 2006, 9:41 pm
Posts: 14
try setting display_errors to "On" in the ini. if it doesn't help, try using the php.ini-dist.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 2nd, 2007, 12:42 pm 
Offline
Super User
Super User

Joined: March 24th, 2006, 7:23 pm
Posts: 1037
http://www.wfzr.net/php.txt - - php.ini

I have no idea...

what do you mean by: you can remove the "md5" expression and add the md5 of the password

does that mean to remove 'md5' from

DEFINE(lastfmpassmd5, md5('password'));

so it looks like;

DEFINE(lastfmpassmd5, ('password'));

or what?


I tried it both ways and it didn't seem to matter - it doesn't work.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 2nd, 2007, 12:48 pm 
Offline
New User
New User

Joined: December 25th, 2006, 9:41 pm
Posts: 14
either use

DEFINE(lastfmpassmd5, md5('my cleartext password'));

or

DEFINE(lastfmpassmd5, 'md5 of my password');
('md5 of my password' is something like '4798bb6d72966e335602010c0cb6136a')

the second applies if you don't want your cleartext password to be seen by other people that have access to the php file/computer.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 2nd, 2007, 1:32 pm 
Offline
Super User
Super User

Joined: March 24th, 2006, 7:23 pm
Posts: 1037
well ok - but it doesn't work anyway so...

hopefully someone else can get it working and maybe explain something I'm missing.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 2nd, 2007, 2:42 pm 
Offline
New User
New User

Joined: December 25th, 2006, 9:41 pm
Posts: 14
here's the php.ini i'm using. php is installed in c:\program files\php. http://www.ehore.com/apps/lastfm-sam/phpini.zip

if it's running successfully the plugin should say:
Code:
07-01-02 18:03:36 | Logging in...
07-01-02 18:03:36 | The client is up to date.


then, starting from the _next_ song you play, it will read the lastfm.html file, parse it, say nothing about it. it will then send the song info to audioscrobbler after ~240 secs or 50% of the song is reached.

check if sam is generating the lastfm.html file from the template, and if the path is correct. "Auto generate on song change" option should be enabled in SAM, "config->HTML Output". Of course you should also add the _lastfm.html file in "html output" (general html output), input file is the template, outfile is a filename, which you then write in lastfm.php's configuration section.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 3rd, 2007, 7:28 am 
Offline
Super User
Super User

Joined: March 24th, 2006, 7:23 pm
Posts: 1037
well that works - but only if the password line looks like:

DEFINE(lastfmpassmd5, 'password');

otherwise it runs and exits

I also have an error about a mysql extention being missing. Do I need that?


hmmm.... well it runs and then it pauses like you say - but then after the song is half over it exits....


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 3rd, 2007, 8:05 am 
Offline
Super User
Super User

Joined: March 24th, 2006, 7:23 pm
Posts: 1037
I got it working with an md5 password. it gave a parse error with the plain text one.

thanks for the help - it must have been frustrating dealing with me ;)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 106 posts ]  Go to page 1, 2, 3, 4, 5 ... 8  Next

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: MSN [Bot] and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group