summaryrefslogtreecommitdiffstats
path: root/stats.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-08-06 01:57:29 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-08-06 01:57:29 +0000
commitfb5c43b2df8a190fecfe4bf04bcd64aa1bad9c2d (patch)
tree86cee2ea4acaaf51dae5f4732d13e54213f12137 /stats.php
parent573c3014b982bd52f0b6959f51d65dfc86ae35c0 (diff)
downloadampache-fb5c43b2df8a190fecfe4bf04bcd64aa1bad9c2d.tar.gz
ampache-fb5c43b2df8a190fecfe4bf04bcd64aa1bad9c2d.tar.bz2
ampache-fb5c43b2df8a190fecfe4bf04bcd64aa1bad9c2d.zip
proof of concept, nothing one should actually use
Diffstat (limited to 'stats.php')
-rw-r--r--stats.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/stats.php b/stats.php
index 63fa4f3a..2b99df95 100644
--- a/stats.php
+++ b/stats.php
@@ -45,6 +45,47 @@ switch ($_REQUEST['action']) {
require_once Config::get('prefix') . '/templates/show_user_stats.inc.php';
break;
+ //FIXME:: The logic in here should be moved to our metadata class
+ case 'recommend_similar':
+ // For now this is just MyStrands so verify they've filled out stuff
+ if (!$GLOBALS['user']->has_access('25') || !$GLOBALS['user']->prefs['mystrands_pass'] || !$GLOBALS['user']->prefs['mystrands_user']) {
+ access_denied();
+ exit;
+ }
+
+ // We're good attempt to dial up MyStrands
+ OpenStrands::set_auth_token(Config::get('mystrands_developer_key'));
+ $openstrands = new OpenStrands($GLOBALS['user']->prefs['mystrands_user'],$GLOBALS['user']->prefs['mystrands_pass']);
+
+ if (!$openstrands) {
+ debug_event('openstrands','Unable to authenticate MyStrands user, or authtoken invalid','3');
+ Error::add('general','Unable to authenticate MyStrands user, or authtoken invalid');
+ }
+
+ // Do our recommendation
+ switch ($_REQUEST['type']) {
+ case 'artist':
+ $artist = new Artist($_REQUEST['id']);
+ $seed = array('name'=>array($artist->name));
+ $results = $openstrands->recommend_artists($seed);
+ break;
+ } // end switch
+
+ // Run through what we've found and build out the data
+ foreach ($results as $result) {
+
+ switch ($_REQUEST['type']) {
+ case 'artist':
+ $data['name'] = $result['ArtistName'];
+ $data['f_name_link'] = "<a href=\"" . $result['URI'] . "\">" . $data['name'] . "</a>";
+ $object_ids[] = Artist::construct_from_array($data);
+ break;
+ }
+ } // end foreach
+
+ require_once Config::get('prefix') . '/templates/show_artists.inc.php';
+
+ break;
/* Show their stats */
default:
/* Here's looking at you kid! */