[ABD] Last.fm API 0.9.2

Any abandoned MODs will be moved to this forum.

WARNING: MODs in this forum are not currently being supported or maintained by the original MOD author. Proceed at your own risk.
Forum rules
IMPORTANT: MOD Development Forum rules

WARNING: MODs in this forum are not currently being supported nor updated by the original MOD author. Proceed at your own risk.
User avatar
woipi90
Registered User
Posts: 908
Joined: Mon Feb 16, 2009 5:32 pm
Location: Austria

Re: [BETA] Last.fm API

Post by woipi90 » Fri May 01, 2009 10:34 am

hy,

thanks for this great mod....

here is the german language file if you want to include it....

Code: Select all

<?php
/**
*
* @package Last.fm API
* @version $Id: $
* @copyright (c) 2009 Tomas Sevcik (sheVcza) http://phpbb.metallum.cz
* @          (c)  based on PHP Last.fm API by Matt Oakes http://www.matto1990.com/
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB'))
{
 exit;
}

// Last.fm API
$lang = array_merge($lang, array(
	'LASTFM'							=> 'Last.fm',
	'LASTFM_EXPLAIN'					=> 'Last.fm Username',
	'LASTFM_STATISTICS'					=> 'Last.fm Statistik',
	'LASTFM_PROFILE'					=> 'Besuche Last.fm Userprofil',
	'LASTFM_RECENT_ARTISTS'				=> 'Interpreten der letzten 7 Tage',
	'LASTFM_NOW_PLAYING'				=> 'h&ouml;rt gerade',
	'LASTFM_NOT_LISTENING'				=> 'h&ouml;rt gerade nichts',
	'LASTFM_ALBUM'						=> 'Album',
	'LASTFM_TODAY'						=> 'Heute, ',
	'LASTFM_YESTERDAY'					=> 'Gestern, ',
	'LASTFM_TOP_ARTISTS'				=> 'TOP Interpreten',
	'LASTFM_PLAYS1'						=> ' spielt', // > 4
	'LASTFM_PLAYS2'						=> ' spielt', // 2 - 4
	'LASTFM_PLAYS3'						=> ' spielt',  // 1
	'LASTFM_RECENT_TRACKS'				=> 'Letzte Songs',
	
));
?>

grz woipi
My mods: Ultimate Board Clubs
Support: only for the UBCS!
-----
function be_friends($uid, $u){return ($u == $user->['user_id']) ? false : true;}
$this->be_friends($uid, $user->['user_id']) ? $allow_pm : echo "You failed again";

User avatar
Mrraider
Registered User
Posts: 100
Joined: Thu Apr 02, 2009 7:54 pm

Re: [BETA] Last.fm API

Post by Mrraider » Sun May 31, 2009 9:12 pm

Problems after updating to version phpBB 3.0.5!

Error:

Code: Select all

Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in C:\wamp\www\forum\lastfmapi\core\class\apibase.php:45 Stack trace: #0 C:\wamp\www\forum\lastfmapi\core\class\apibase.php(45): SimpleXMLElement->__construct('') #1 C:\wamp\www\forum\lastfmapi\core\class\apibase.php(87): lastfmApiBase->process_response() #2 C:\wamp\www\forum\lastfmapi\core\api\user.php(624): lastfmApiBase->apiGetCall(Array) #3 C:\wamp\www\forum\lastfmapi\lastfmapi_mod.php(43): lastfmApiUser->getTopArtists(Array) #4 C:\wamp\www\forum\memberlist.php(907): include('C:\wamp\www\for...') #5 {main} thrown in C:\wamp\www\forum\lastfmapi\core\class\apibase.php on line 45
here are my files:

apibase.php

Code: Select all

<?php
/**
*
* @package Last.fm API
* @version $Id: $
* @copyright (c) 2009 Tomas Sevcik (sheVcza) http://phpbb.metallum.cz
* @          (c)  based on PHP Last.fm API by Matt Oakes http://www.matto1990.com/
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB'))
{
 exit;
}

class lastfmApiBase {
	public $error;
	
	private $host;
	private $port;
	private $url;
	private $response;
	private $socket;
	private $cache;
	
	function setup() {
		$this->host = 'ws.audioscrobbler.com';
		$this->port = 80;
		
		$this->socket = new lastfmApiSocket($this->host, $this->port);
	}
	
	function process_response() {
		$xmlstr = '';
		$record = 0;
		foreach ( $this->response as $line ) {
			if ( $record == 1 ) {
				$xmlstr .= $line;
			}
			elseif( substr($line, 0, 1) == '<' ) {
				$record = 1;
			}
		}
		
		$xml = new SimpleXMLElement($xmlstr);
			
		if ( $xml['status'] == 'ok' ) {
			// All is well :)
			return $xml;
		}
		elseif ( $xml['status'] == 'failed' ) {
			// Woops - error has been returned
			$this->handleError($xml->error);
			return FALSE;
		}
		else {
			// I put this in just in case but this really shouldn't happen. Pays to be safe
			$this->handleError();
			return FALSE;
		}
	}
	
	function apiGetCall($vars) {
		$this->setup();
		
		$this->cache = new lastfmApiCache($this->config);
		if ( $cache = $this->cache->get($vars) ) {
			// Cache exists
			$this->response = $cache;
		}
		else {
			// Cache doesnt exist
			$url = '/2.0/?';
			foreach ( $vars as $name => $value ) {
				$url .= trim(urlencode($name)).'='.trim(urlencode($value)).'&';
			}
			$url = substr($url, 0, -1);
			$url = str_replace(' ', '%20', $url);
			
			$out = "GET ".$url." HTTP/1.0\r\n";
			$out .= "Host: ".$this->host."\r\n";
			$out .= "\r\n";
			$this->response = $this->socket->send($out, 'array');
			$this->cache->set($vars, $this->response);
		}
		
		return $this->process_response();
	}
	
	function apiPostCall($vars, $return = 'bool') {
		$this->setup();
		
		$url = '/2.0/';
		
		$data = '';
		foreach ( $vars as $name => $value ) {
			$data .= trim($name).'='.trim($value).'&';
		}
		$data = substr($data, 0, -1);
		$data = str_replace(' ', '%20', $data);
		
		$out = "POST ".$url." HTTP/1.1\r\n";
   		$out .= "Host: ".$this->host."\r\n";
   		$out .= "Content-Length: ".strlen($data)."\r\n";
   		$out .= "Content-Type: application/x-www-form-urlencoded\r\n";
   		$out .= "\r\n";
   		$out .= $data."\r\n";
		$this->response = $this->socket->send($out, 'array');
		
		return $this->process_response();
	}
	
	function handleError($error = '', $customDesc = '') {
		if ( !empty($error) && is_object($error) ) {
			// Fail with error code
			$this->error['code'] = $error['code'];
			$this->error['desc'] = $error;
		}
		elseif( !empty($error) && is_numeric($error) ) {
			// Fail with custom error code
			$this->error['code'] = $error;
			$this->error['desc'] = $customDesc;
		}
		else {
			//Hard failure
			$this->error['code'] = 0;
			$this->error['desc'] = 'Unknown error';
		}
	}
	
	function apiSig($secret, $vars) {
		ksort($vars);
		
		$sig = '';
		foreach ( $vars as $name => $value ) {
			$sig .= $name.$value;
		}
		$sig .= $secret;
		$sig = md5($sig);
		
		return $sig;
	}
}

?>
This error appears only when I visit my own profile.
But not when I visit other members' profiles.


Someone who has the same problem? :|

jkun666
Registered User
Posts: 23
Joined: Fri May 01, 2009 2:37 pm

Re: [BETA] Last.fm API

Post by jkun666 » Mon Jun 01, 2009 12:31 am

I can't save my username in profile. It says it's too short :?:

How can I increase the min characters ?

demon327
Registered User
Posts: 847
Joined: Thu Nov 16, 2006 2:16 pm

Re: [BETA] Last.fm API

Post by demon327 » Mon Jun 01, 2009 7:51 am

mm, the mod works fine in 3.0.5 ;)

User avatar
Mrraider
Registered User
Posts: 100
Joined: Thu Apr 02, 2009 7:54 pm

Re: [BETA] Last.fm API

Post by Mrraider » Mon Jun 01, 2009 10:43 am

Never Mind ... It works now.
I do not know what has happened but it works.

CemetaryMan
Registered User
Posts: 59
Joined: Sat Jun 21, 2008 2:29 pm
Contact:

Re: [BETA] Last.fm API

Post by CemetaryMan » Sun Jun 21, 2009 5:12 am

Thanks for the mod, working great :twisted:

CemetaryMan
Registered User
Posts: 59
Joined: Sat Jun 21, 2008 2:29 pm
Contact:

Re: [BETA] Last.fm API

Post by CemetaryMan » Mon Jun 22, 2009 12:52 am

I noticed one thing and that is users have to have a Last.fm account on their profile to view others list.

This i what i experienced.

User #1 has a last.fm account added to their profile, user #2 has not.
User #1 can view this mod, user #2 can not.

When user #1 views user #2 account the mod shows up even though they do not have a last.fm account added.
When user #2 views user #1 account the mod does not show up.

It shows up correct in the viewtopic, user #1 has and user #2 hasnt.

Is there something i have missed or will this be corrected in future release.

User avatar
Epick One
Registered User
Posts: 27
Joined: Mon Jul 28, 2008 6:24 pm

Re: [BETA] Last.fm API

Post by Epick One » Mon Jun 22, 2009 1:07 am

This is a great modification your have developed, I may install it on my forum once in a stable release at the moment it can be handy for my website witch is related to Artist, Producers Etc. Just might spark up things on their! :D
Pyscho Streets Down Town - Music's Best Creations.

User avatar
dragnaar
Registered User
Posts: 43
Joined: Sun Jan 25, 2009 10:56 pm
Location: Crimea

Re: [BETA] Last.fm API

Post by dragnaar » Thu Jul 09, 2009 12:10 pm

Hi!!!
What about a new version of this mod?

demon327
Registered User
Posts: 847
Joined: Thu Nov 16, 2006 2:16 pm

Re: [BETA] Last.fm API

Post by demon327 » Thu Jul 09, 2009 1:46 pm

dragnaar wrote:Hi!!!
What about a new version of this mod?
don't know, but he is not realy active:

Last visited: Tue Jun 09, 2009 9:13 am :(

User avatar
woipi90
Registered User
Posts: 908
Joined: Mon Feb 16, 2009 5:32 pm
Location: Austria

Re: [BETA] Last.fm API

Post by woipi90 » Thu Jul 09, 2009 2:34 pm

how can i make it that the lastfm username only shows if i entered one?
if he isn't developing anymore can somebody else take care of it?


grz woipi
My mods: Ultimate Board Clubs
Support: only for the UBCS!
-----
function be_friends($uid, $u){return ($u == $user->['user_id']) ? false : true;}
$this->be_friends($uid, $user->['user_id']) ? $allow_pm : echo "You failed again";

User avatar
darkonia
Registered User
Posts: 1901
Joined: Tue May 13, 2008 1:10 pm
Location: Munich, Germany
Contact:

Re: [BETA] Last.fm API

Post by darkonia » Thu Jul 23, 2009 9:26 am

when i go on my profile this error appears:

Code: Select all

Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /phpBB3/lastfmapi/core/class/apibase.php on line 17
i use phpBB 3.0.5
MMOG-Heaven - Das Gaming Portal
Community bedeutet Gleichgesinnte finden - MMOG-Heaven ist Deine Community! Von Spielern für Spieler bietet Dir dieses Portal genau das, was ein Spieler braucht. Bleibe ständig informiert, finde die neuesten MMORPGs, oder suche die frischesten News aus der Welt des Online Gamings - dieses und vieles mehr erwartet Dich auf MMOG-Heaven.

User avatar
sheVcza
Registered User
Posts: 26
Joined: Tue Apr 15, 2008 3:05 pm
Location: Czech Republic
Contact:

Re: [BETA] Last.fm API

Post by sheVcza » Sun Aug 23, 2009 9:15 am

demon327 wrote:
dragnaar wrote:Hi!!!
What about a new version of this mod?
don't know, but he is not realy active:

Last visited: Tue Jun 09, 2009 9:13 am :(
Yes, sorry, time pressure. :( But new version coming soon! With some new features... ;)
Skalat maðr rúnar rista
nema raða vel kunni
þat verðr morgum manni
es of myrkvan staaf villisk.

demon327
Registered User
Posts: 847
Joined: Thu Nov 16, 2006 2:16 pm

Re: [BETA] Last.fm API

Post by demon327 » Sun Aug 23, 2009 9:25 am

sheVcza wrote:
demon327 wrote:
dragnaar wrote:Hi!!!
What about a new version of this mod?
don't know, but he is not realy active:

Last visited: Tue Jun 09, 2009 9:13 am :(
Yes, sorry, time pressure. :( But new version coming soon! With some new features... ;)
yeah! nice to hear :)

User avatar
stickerboy
Former Team Member
Posts: 7349
Joined: Mon Mar 29, 2004 2:27 pm
Location: Airdrie, UK (127.0.0.1)
Name: Kenny Cameron
Contact:

Re: [BETA] Last.fm API

Post by stickerboy » Tue Sep 29, 2009 6:56 pm

Slight bump, but just to say thanks for your work on this. I was going to delve into the api myself until I seen someone already had :D
I'm a web-designing code-decrypting tech-support musician
|| Twitter || Flickr || phpBB Snippets ||
Formerly known as cherokee red

Locked

Return to “[3.0.x] Abandoned MODs”