From 7c661ba685287efd21512f9f0203641200bffed2 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Sun, 17 Dec 2006 08:41:21 +0000 Subject: * Added Recommendations based on matching ratings between users * Integrated LastFM plugin (defaults to disabled still) * Fixed a view issue with the Admin Localplay Level preference * removed some old MPD pages that were not being usedwq --- templates/show_mpd_pl_box.inc.php | 29 ----- templates/show_mpdpl.inc | 179 ---------------------------- templates/show_mpdplay.inc | 174 --------------------------- templates/show_user_recommendations.inc.php | 60 ++++++++++ templates/show_user_stats.inc.php | 60 ++++++++++ templates/show_users.inc | 6 +- 6 files changed, 123 insertions(+), 385 deletions(-) delete mode 100644 templates/show_mpd_pl_box.inc.php delete mode 100644 templates/show_mpdpl.inc delete mode 100644 templates/show_mpdplay.inc create mode 100644 templates/show_user_recommendations.inc.php create mode 100644 templates/show_user_stats.inc.php (limited to 'templates') diff --git a/templates/show_mpd_pl_box.inc.php b/templates/show_mpd_pl_box.inc.php deleted file mode 100644 index 429a2866..00000000 --- a/templates/show_mpd_pl_box.inc.php +++ /dev/null @@ -1,29 +0,0 @@ - - - - - -
- -
diff --git a/templates/show_mpdpl.inc b/templates/show_mpdpl.inc deleted file mode 100644 index 50da3349..00000000 --- a/templates/show_mpdpl.inc +++ /dev/null @@ -1,179 +0,0 @@ - - -
" method="post" enctype="multipart/form-data"> - - - - - - - - - - -
- -
> - - - - - - - - - - - - playlist; - if (is_null($pl)) { echo "ERROR: ".$myMpd->errStr."\n"; } - else { - $maxlen = strlen (count($pl)); - $condPL = conf('condPL'); - if ($condPL) { - echo ""; - } - else { - echo ""; - } - - foreach ($pl as $id=>$entry) { - if ( ($condPL) and (($id < $myMpd->current_track_id-1) or ($id > $myMpd->current_track_id + 10)) ) { - continue; - } - - unset($text_class); - $track = $id+1; - $len=strlen($track); - - while ($len < $maxlen) { - $track = "0".$track; - $len++; - } - - $flip = flip_class(); - echo ''; - - $mpddir = conf('mpd_dir')."/"; - - if (strtolower(conf('mpd_method')) == 'file') { - $sql = "SELECT genre.name, song.genre, song.id, song.album, song.artist FROM song, genre WHERE file = \"".$mpddir.$entry['file']."\" AND song.genre=genre.id"; - $db_results = @mysql_query($sql,dbh()); - $r = @mysql_fetch_object ($db_results); - $entry['genre'] = $r->name; - } - else { - list($tmp, $id, $tmp) = preg_split("/(song=|&)/", $entry['file']); - $r = new Song($id); - $entry['Title'] = $r->title; - $entry['Artist'] = $r->get_artist_name(); - $entry['Album'] = $r->get_album_name(); - $entry['genre'] = $r->get_genre_name(); - $entry['Time'] = $r->time; - $entry['Track'] = $r->track; - } - - $totaltime += $entry['Time']; - ?> - - - - - - - - - - current_track_id+10 <= $myMpd->playlistcount)) { - echo ""; - } - } //else - - $time = floor($totaltime/60) . ":" . sprintf("%02d", ($totaltime%60) ); - $num = count($pl); - if ($condPL) { - echo ""; - } - else { - echo ""; - } - ?> - - - - - - - - - - -
Select/
Invert
... Condensed Playlist ...
 
> > >        - >f  - >n  - >x -
... Condensed Playlist ...
... Condensed Playlist ...
 
- - - - song(s)   
-
- - [" href="">refresh] - playlist_count > 0 ) {$un = (conf('condPL')) ? "un" : ""; ?> - [" href="/amp-mpd.php?action=shuffle">] - [" href="/amp-mpd.php?action=clear">clear] - playlist_count > 10) { ?> - [condense] - - [" href="/amp-mpd.php?action=crop">crop] - - -
-
-
- diff --git a/templates/show_mpdplay.inc b/templates/show_mpdplay.inc deleted file mode 100644 index fd9c942d..00000000 --- a/templates/show_mpdplay.inc +++ /dev/null @@ -1,174 +0,0 @@ - - -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - -
- state} = "class='selected_button'"; - if (true) /* rigged to do AJAX for now; change to conf('AJAX') later*/ { ?> - - - id="stop_button" value=" X " onclick="startRequest('action=stop');"/> - id="play_button" value=" > " onclick="startRequest('action=play');"/> - id="pause_button" value=" | | " onclick="startRequest('action=pause');"/> - - -
- - " name="action" value="|< " /> - " name="action" value=" X " /> - " name="action" value=" > " /> - " name="action" value=" | | " /> - " name="action" value= " >|" /> -
- -
Volume: volume ?>%
- - - - - - - - [mute - -25 - -10 - +10 - +25] '; - -
- : -
- repeat); - ${$repeat_name} = "style=\"background-color: black;color:white;\""; - ?> -      - " name="val" value="On" /> - " name="val" value="Off" /> -
-
- : -
- random); - ${$random_name} = "style=\"background-color: black;color:white;\""; ?> - " name="val" value="On" /> - " name="val" value="Off" /> -
-
 
-
- state == "stop") or ($myMpd->state == "pause")) { echo 'class="nodisplay"'; } ?> border="0" cellpadding="0" cellspacing="0"> - - - - - - - - - - - - - - - -
playlist[($myMpd->current_track_id)]['Title']) { - list($tmp, $id, $tmp) = preg_split("/(song=|&)/", $myMpd->playlist[($myMpd->current_track_id)]['file']); - $r = new Song($id); - $myMpd->playlist[($myMpd->current_track_id)]['Title'] = $r->title; - $myMpd->playlist[($myMpd->current_track_id)]['Artist'] = $r->get_artist_name(); - $myMpd->playlist[($myMpd->current_track_id)]['Album'] = $r->get_album_name(); - } - echo ""; - echo ($myMpd->current_track_id+1). - ". ".$myMpd->playlist[$myMpd->current_track_id]['Artist']. - " - ".$myMpd->playlist[$myMpd->current_track_id]['Title']. - " - ".$myMpd->playlist[$myMpd->current_track_id]['Album']. - " - ".format_time($myMpd->playlist[$myMpd->current_track_id]['Time']); - echo ""; ?> -
- current_track_position)?> - (current_track_position/$myMpd->current_track_length),2)*100)."%) played" ?> -
- ".format_time($myMpd->current_track_length - $myMpd->current_track_position).")"?> - -
playlist[($myMpd->current_track_id+1)]['Title']) { - list($tmp, $id, $tmp) = preg_split("/(song=|&)/", $myMpd->playlist[($myMpd->current_track_id+1)]['file']); - $r = new Song($id); - $myMpd->playlist[($myMpd->current_track_id+1)]['Title'] = $r->title; - $myMpd->playlist[($myMpd->current_track_id+1)]['Artist'] = $r->get_artist_name(); - $myMpd->playlist[($myMpd->current_track_id+1)]['Album'] = $r->get_album_name(); - } - echo ($myMpd->current_track_id+2). - ". ".$myMpd->playlist[($myMpd->current_track_id+1)]['Artist']. - " - ".$myMpd->playlist[($myMpd->current_track_id+1)]['Title']. - " - ".$myMpd->playlist[($myMpd->current_track_id+1)]['Album']. - " - ".format_time($myMpd->playlist[($myMpd->current_track_id+1)]['Time']);?> -
-
-
diff --git a/templates/show_user_recommendations.inc.php b/templates/show_user_recommendations.inc.php new file mode 100644 index 00000000..a89be09e --- /dev/null +++ b/templates/show_user_recommendations.inc.php @@ -0,0 +1,60 @@ + +fullname . ' ' . _('Recommendations')); ?> + + + + + + +
+ format_recommendations($recommended_artists,'artist'); + show_info_box(_('Recommended Aritsts'),'artist',$items); + } + else { + echo "" . _('Not Enough Data') . ""; + } + ?> + + format_recommendations($recommended_albums,'album'); + show_info_box(_('Recommended Albums'),'album',$items); + } + else { + echo "" . _('Not Enough Data') . ""; + } + ?> + + format_recommendations($recommended_songs,'song'); + show_info_box(_('Recommended Songs'),'song',$items); + } + else { + echo "" . _('Not Enough Data') . ""; + } + ?> +
+ diff --git a/templates/show_user_stats.inc.php b/templates/show_user_stats.inc.php new file mode 100644 index 00000000..ab962874 --- /dev/null +++ b/templates/show_user_stats.inc.php @@ -0,0 +1,60 @@ + +fullname . ' ' . _('Favorites')); ?> + + + + + + +
+ format_favorites($favorite_artists); + show_info_box(_('Favorite Artists'),'artist',$items); + } + else { + echo "" . _('Not Enough Data') . ""; + } + ?> + + format_favorites($favorite_albums); + show_info_box(_('Favorite Albums'),'album',$items); + } + else { + echo "" . _('Not Enough Data') . ""; + } + ?> + + format_favorites($favorite_songs); + show_info_box(_('Favorite Songs'),'your_song',$items); + } + else { + echo "" . _('Not Enough Data') . ""; + } + ?> +
+ diff --git a/templates/show_users.inc b/templates/show_users.inc index f0c4997c..6b7d3e14 100644 --- a/templates/show_users.inc +++ b/templates/show_users.inc @@ -99,17 +99,17 @@ while ($results = mysql_fetch_object($db_result)) { - + - + - + -- cgit