diff options
author | Paul 'flowerysong' Arthur <flowerysong00@yahoo.com> | 2010-08-17 20:59:16 +0000 |
---|---|---|
committer | Paul 'flowerysong' Arthur <flowerysong00@yahoo.com> | 2010-08-17 20:59:16 +0000 |
commit | df80bd72432011010dc0e91ab564659ca6b2c500 (patch) | |
tree | c68f957da32a382bf3a542b7e7f3e54b886483ca /templates | |
parent | 34d1449660437c2ea24dd55989efebf4e01d485f (diff) | |
download | ampache-df80bd72432011010dc0e91ab564659ca6b2c500.tar.gz ampache-df80bd72432011010dc0e91ab564659ca6b2c500.tar.bz2 ampache-df80bd72432011010dc0e91ab564659ca6b2c500.zip |
Refactored Last.FM recommendations; drop new dependency on curl since
Snoopy works just as well for this application.
Diffstat (limited to 'templates')
-rw-r--r-- | templates/show_artist.inc.php | 3 | ||||
-rw-r--r-- | templates/show_install_check.inc.php | 11 | ||||
-rw-r--r-- | templates/show_now_playing_row.inc.php | 38 | ||||
-rw-r--r-- | templates/show_recommended_artists.inc.php | 72 |
4 files changed, 110 insertions, 14 deletions
diff --git a/templates/show_artist.inc.php b/templates/show_artist.inc.php index d14bc665..408e6b5e 100644 --- a/templates/show_artist.inc.php +++ b/templates/show_artist.inc.php @@ -54,9 +54,6 @@ if (Config::get('ratings')) { <?php echo Ajax::button('?action=basket&type=artist_random&id=' . $artist->id,'random',_('Random'),'random_' . $artist->id); ?> <?php echo Ajax::text('?action=basket&type=artist_random&id=' . $artist->id, sprintf(_('Add Random Songs By %s'), $artist->f_name),'random_text_' . $artist->id); ?> </li> -<li> - <a href="<?php echo $web_path; ?>/artists.php?action=show_like&artist=<?php echo $artist->id; ?>"><?php echo get_user_icon('view'); ?></a> <a href="<?php echo $web_path; ?>/artists.php?action=show_like&artist=<?php echo $artist->id; ?>"><?php printf(_("Show Similar to %s"), $artist->f_name); ?></a> -</li> <?php if (Access::check('interface','50')) { ?> <li> <a href="<?php echo $web_path; ?>/artists.php?action=update_from_tags&artist=<?php echo $artist->id; ?>"><?php echo get_user_icon('cog', _('Update from tags')); ?></a> diff --git a/templates/show_install_check.inc.php b/templates/show_install_check.inc.php index 97bdb64b..08952496 100644 --- a/templates/show_install_check.inc.php +++ b/templates/show_install_check.inc.php @@ -174,16 +174,5 @@ } ?> </td> -</tr><tr> -<td><?php echo _('PHP cURL extension Support'); ?>:</td> -<td> -<?php - if (!check_php_curl()) { - echo debug_result(_('Some functions might not run correctly.'), false); - } - else { - echo debug_result(_(''), true); - } -?> </tr> </table> diff --git a/templates/show_now_playing_row.inc.php b/templates/show_now_playing_row.inc.php index ad33429f..c6f4988f 100644 --- a/templates/show_now_playing_row.inc.php +++ b/templates/show_now_playing_row.inc.php @@ -82,3 +82,41 @@ $artist = scrub_out(truncate_with_ellipsis($media->f_artist_full)); </div> </div> <?php } // end play album art ?> + +<?php if (Config::get('show_similar')) { ?> +<div class="np_group"> +<?php if ($artists = Recommendation::get_artists_like($media->artist, 3, false)) { ?> + <div class="np_cel cel_similar"> + <label><?php echo _('Similar Artists'); ?></label> + <?php foreach ($artists as $a) { ?> + <div class="np_cel cel_similar_artist"> + <?php + if (is_null($a['id'])) { + echo scrub_out(truncate_with_ellipsis($a['name']), Config::get('ellipse_threshold_artist')); + } + else { + $artist = new Artist($a['id']); + $artist->format(); + echo $artist->f_name_link; + } + ?> + </div> + <?php } // end foreach ?> + </div> +<?php } // end show similar artists ?> +<?php if ($songs = Recommendation::get_songs_like($media->id, 3)) { ?> + <div class="np_cel cel_similar"> + <label><?php echo _('Similar Songs'); ?></label> + <?php foreach ($songs as $s) { ?> + <div class="np_cel cel_similar_song"> + <?php + $song = new Song($s['id']); + $song->format(); + echo $song->f_link; + ?> + </div> + <?php } // end foreach ?> + </div> +<?php } // end show similar songs ?> +</div> +<?php } // end show similar things ?> diff --git a/templates/show_recommended_artists.inc.php b/templates/show_recommended_artists.inc.php new file mode 100644 index 00000000..459e2d63 --- /dev/null +++ b/templates/show_recommended_artists.inc.php @@ -0,0 +1,72 @@ +<?php +/* vim:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab: */ +/* + + Copyright (c) Ampache.org + All rights reserved. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License v2 + as published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +?> +<?php show_box_top(_('Similar Artists'), 'info-box'); ?> +<table class="tabledata" cellpadding="0" cellspacing="0"> +<colgroup> + <col id="col_add" /> + <col id="col_artist" /> + <col id="col_songs" /> + <col id="col_albums" /> + <col id="col_tags" /> + <col id="col_rating" /> + <col id="col_action" /> +</colgroup> +<tr class="th-top"> + <th class="cel_add"><?php echo _('Add'); ?></th> + <th class="cel_artist"><?php echo _('Artist'); ?></th> + <th class="cel_songs"><?php echo _('Songs'); ?></th> + <th class="cel_albums"><?php echo _('Albums'); ?></th> + <th class="cel_time"><?php echo _('Time'); ?></th> + <th class="cel_tags"><?php echo _('Tags'); ?></th> + <th class="cel_rating"> <?php echo _('Rating'); ?> </th> + <th class="cel_action"> <?php echo _('Action'); ?> </th> +</tr> +<?php +// Cache the ratings we are going to use +if (Config::get('ratings')) { Rating::build_cache('artist',$object_ids); } + +/* Foreach through every artist that has been passed to us */ +foreach ($object_ids as $artist_id) { + $artist = new Artist($artist_id); + $artist->format(); +?> +<tr id="artist_<?php echo $artist->id; ?>" class="<?php echo flip_class(); ?>"> + <?php require Config::get('prefix') . '/templates/show_artist_row.inc.php'; ?> +</tr> +<?php } //end foreach ($artists as $artist) ?> +<?php if (!count($object_ids)) { ?> +<tr class="<?php echo flip_class(); ?>"> + <td colspan="5"><span class="fatalerror"><?php echo _('Not Enough Data'); ?></span></td> +</tr> +<?php } ?> +<tr class="th-bottom"> + <th class="cel_add"><?php echo _('Add'); ?></th> + <th class="cel_artist"><?php echo _('Artist'); ?></th> + <th class="cel_songs"> <?php echo _('Songs'); ?> </th> + <th class="cel_albums"> <?php echo _('Albums'); ?> </th> + <th class="cel_time"> <?php echo _('Time'); ?> </th> + <th class="cel_tags"><?php echo _('Tags'); ?></th> + <th class="cel_rating"> <?php echo _('Rating'); ?> </th> + <th class="cel_action"> <?php echo _('Action'); ?> </th> +</tr> +</table> |