diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2008-03-21 04:43:48 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2008-03-21 04:43:48 +0000 |
commit | 260b62361e031b3a0d4261e892170f294825ed61 (patch) | |
tree | 9ba79b0c5ac498c4cfd1caf896baa1d1caab7a84 /lib/song.php | |
parent | 06652fe0406b45732ad80a3ab08c7d97bae4b47c (diff) | |
download | ampache-260b62361e031b3a0d4261e892170f294825ed61.tar.gz ampache-260b62361e031b3a0d4261e892170f294825ed61.tar.bz2 ampache-260b62361e031b3a0d4261e892170f294825ed61.zip |
fixed recently played, removed a bunch of useless files, added new methods to api as requested by dev, fixed some minor issues with enabling of localplay methods
Diffstat (limited to 'lib/song.php')
-rw-r--r-- | lib/song.php | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/lib/song.php b/lib/song.php deleted file mode 100644 index c9262e56..00000000 --- a/lib/song.php +++ /dev/null @@ -1,77 +0,0 @@ -<?php -/* - - Copyright (c) 2001 - 2006 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. - -*/ - -/** - * Song Library - * This is for functions that don't make sense in the class because we aren't looking - * at a specific song... these should be general function that return arrays of songs - * and the like - */ - -/** - * get_recently_played - * This function returns the last X songs that have been played - * It uses the 'popular' threshold to determine how many to pull - */ -function get_recently_played($user_id='') { - - if ($user_id) { - $user_limit = " AND object_count.user='" . Dba::escape($user_id) . "'"; - } - - $sql = "SELECT object_count.object_id, object_count.user, object_count.object_type, object_count.date " . - "FROM object_count " . - "WHERE object_type='song'$user_limit " . - "ORDER by object_count.date DESC " . - "LIMIT " . Config::get('popular_threshold'); - $db_results = Dba::query($sql); - - $results = array(); - - while ($r = Dba::fetch_assoc($db_results)) { - $results[] = $r; - } - - return $results; - -} // get_recently_played - - -/** - * get_song_id_from_file - * This function takes a filename and returns it's best guess for a song id - * It is used by some of the localplay methods to go from filename to ampache - * song record for items that are manualy entered into the clients - */ -function get_song_id_from_file($filename) { - - $filename = Dba::escape($filename); - - $sql = "SELECT `id` FROM `song` WHERE `file` LIKE '%$filename'"; - $db_results = Dba::query($sql); - - $results = Dba::fetch_assoc($db_results); - - return $results['id']; - -} // get_song_id_from_file - -?> |