Changeset 1730
- Timestamp:
- 08/31/08 08:57:33 (3 months ago)
- Location:
- trunk
- Files:
-
- 1 removed
- 10 modified
-
image.php (modified) (1 diff)
-
lib/album.lib.php (deleted)
-
lib/class/album.class.php (modified) (1 diff)
-
lib/class/catalog.class.php (modified) (1 diff)
-
lib/init.php (modified) (1 diff)
-
logout.php (modified) (1 diff)
-
modules/localplay/httpq.controller.php (modified) (11 diffs)
-
modules/localplay/mpd.controller.php (modified) (14 diffs)
-
server/index.ajax.php (modified) (1 diff)
-
templates/show_album_art.inc.php (modified) (1 diff)
-
templates/sidebar_modules.inc.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/image.php
r1536 r1730 68 68 vauth::check_session(); 69 69 $key = scrub_in($_REQUEST['image_index']); 70 $image = get_image_from_source($_SESSION['form']['images'][$key]);70 $image = Album::get_image_from_source($_SESSION['form']['images'][$key]); 71 71 $mime = $_SESSION['form']['images'][$key]['mime']; 72 72 $data = explode("/",$mime); -
trunk/lib/class/album.class.php
r1665 r1730 823 823 } // save_resized_art 824 824 825 /** 826 * get_random_albums 827 * This returns a random number of albums from the catalogs 828 * this is used by the index to return some 'potential' albums to play 829 */ 830 public static function get_random_albums($count=6) { 831 832 $sql = 'SELECT `id` FROM `album` ORDER BY RAND() LIMIT ' . ($count*2); 833 $db_results = Dba::query($sql); 834 835 $in_sql = '`album_id` IN ('; 836 837 while ($row = Dba::fetch_assoc($db_results)) { 838 $in_sql .= "'" . $row['id'] . "',"; 839 $total++; 840 } 841 842 if ($total < $count) { return false; } 843 844 $in_sql = rtrim($in_sql,',') . ')'; 845 846 $sql = "SELECT `album_id`,ISNULL(`art`) AS `no_art` FROM `album_data` WHERE $in_sql"; 847 $db_results = Dba::query($sql); 848 $results = array(); 849 850 while ($row = Dba::fetch_assoc($db_results)) { 851 $results[$row['album_id']] = $row['no_art']; 852 } // end for 853 854 asort($results); 855 $albums = array_keys($results); 856 $results = array_slice($albums,0,$count); 857 858 return $results; 859 860 } // get_random_albums 861 862 /** 863 * get_image_from_source 864 * This gets an image for the album art from a source as 865 * defined in the passed array. Because we don't know where 866 * its comming from we are a passed an array that can look like 867 * ['url'] = URL *** OPTIONAL *** 868 * ['file'] = FILENAME *** OPTIONAL *** 869 * ['raw'] = Actual Image data, already captured 870 */ 871 public static function get_image_from_source($data) { 872 873 // Already have the data, this often comes from id3tags 874 if (isset($data['raw'])) { 875 return $data['raw']; 876 } 877 878 // If it came from the database 879 if (isset($data['db'])) { 880 // Repull it 881 $album_id = Dba::escape($data['db']); 882 $sql = "SELECT * FROM `album_data` WHERE `album_id`='$album_id'"; 883 $db_results = Dba::query($sql); 884 $row = Dba::fetch_assoc($db_results); 885 return $row['art']; 886 } // came from the db 887 888 // Check to see if it's a URL 889 if (isset($data['url'])) { 890 $snoopy = new Snoopy(); 891 $snoopy->fetch($data['url']); 892 return $snoopy->results; 893 } 894 895 // Check to see if it's a FILE 896 if (isset($data['file'])) { 897 $handle = fopen($data['file'],'rb'); 898 $image_data = fread($handle,filesize($data['file'])); 899 fclose($handle); 900 return $image_data; 901 } 902 903 // Check to see if it is embedded in id3 of a song 904 if (isset($data['song'])) { 905 // If we find a good one, stop looking 906 $getID3 = new getID3(); 907 $id3 = $getID3->analyze($data['song']); 908 909 if ($id3['format_name'] == "WMA") { 910 return $id3['asf']['extended_content_description_object']['content_descriptors']['13']['data']; 911 } 912 elseif (isset($id3['id3v2']['APIC'])) { 913 // Foreach incase they have more then one 914 foreach ($id3['id3v2']['APIC'] as $image) { 915 return $image['data']; 916 } 917 } 918 } // if data song 919 920 return false; 921 922 } // get_image_from_source 923 825 924 } //end of album class 826 925 -
trunk/lib/class/catalog.class.php
r1663 r1730 641 641 if (count($results)) { 642 642 // Pull the string representation from the source 643 $image = get_image_from_source($results['0']);643 $image = Album::get_image_from_source($results['0']); 644 644 if (strlen($image) > '5') { 645 645 $album->insert_art($image,$results['0']['mime']); -
trunk/lib/init.php
r1722 r1730 122 122 123 123 // Library and module includes we can't do with the autoloader 124 require_once $prefix . '/lib/album.lib.php';125 124 require_once $prefix . '/lib/search.php'; 126 125 require_once $prefix . '/lib/preferences.php'; -
trunk/logout.php
r1363 r1730 2 2 /* 3 3 4 Copyright (c) 2001 - 2007Ampache.org4 Copyright (c) Ampache.org 5 5 All rights reserved. 6 6 -
trunk/modules/localplay/httpq.controller.php
r1560 r1730 313 313 * This deletes the entire Httpq playlist... nuff said 314 314 */ 315 function clear_playlist() {315 public function clear_playlist() { 316 316 317 317 if (is_null($this->_httpq->clear())) { return false; } … … 359 359 * This tells HttpQ to skip to the specified song 360 360 */ 361 function skip($song) {361 public function skip($song) { 362 362 363 363 if (is_null($this->_httpq->skip($song))) { return false; } … … 369 369 * This tells Httpq to increase the volume by WinAmps default amount 370 370 */ 371 function volume_up() {371 public function volume_up() { 372 372 373 373 if (is_null($this->_httpq->volume_up())) { return false; } … … 379 379 * This tells HttpQ to decrease the volume by Winamps default amount 380 380 */ 381 function volume_down() {381 public function volume_down() { 382 382 383 383 if (is_null($this->_httpq->volume_down())) { return false; } … … 388 388 /** 389 389 * next 390 * This just tells MPDto skip to the next song391 */ 392 function next() {390 * This just tells HttpQ to skip to the next song 391 */ 392 public function next() { 393 393 394 394 if (is_null($this->_httpq->next())) { return false; } … … 400 400 /** 401 401 * prev 402 * This just tells MPDto skip to the prev song403 */ 404 function prev() {402 * This just tells HttpQ to skip to the prev song 403 */ 404 public function prev() { 405 405 406 406 if (is_null($this->_httpq->prev())) { return false; } … … 412 412 /** 413 413 * pause 414 * This tells MPDto pause the current song415 */ 416 function pause() {414 * This tells HttpQ to pause the current song 415 */ 416 public function pause() { 417 417 418 418 if (is_null($this->_httpq->pause())) { return false; } … … 426 426 * is 0-100 427 427 */ 428 function volume($volume) {428 public function volume($volume) { 429 429 430 430 if (is_null($this->_httpq->set_volume($volume))) { return false; } … … 478 478 479 479 $url_data = $this->parse_url($entry); 480 480 481 switch ($url_data['primary_key']) { 481 482 case 'song': … … 490 491 $data['link'] = ''; 491 492 break; 493 case 'random': 494 $data['name'] = _('Random') . ' - ' . scrub_out(ucfirst($url_data['type'])); 495 $data['link'] = ''; 496 break; 492 497 default: 493 498 … … 510 515 } // end switch on primary key type 511 516 512 513 517 $data['track'] = $key+1; 514 518 -
trunk/modules/localplay/mpd.controller.php
r1728 r1730 314 314 * This deletes the entire MPD playlist... nuff said 315 315 */ 316 function clear_playlist() {316 public function clear_playlist() { 317 317 318 318 if (is_null($this->_mpd->PLClear())) { return false; } … … 327 327 * take any arguments 328 328 */ 329 function play() {329 public function play() { 330 330 331 331 if (is_null($this->_mpd->Play())) { return false; } … … 339 339 * any arguments 340 340 */ 341 function stop() {341 public function stop() { 342 342 343 343 if (is_null($this->_mpd->Stop())) { return false; } … … 350 350 * This tells MPD to skip to the specified song 351 351 */ 352 function skip($song) {352 public function skip($song) { 353 353 354 354 if (is_null($this->_mpd->SkipTo($song))) { return false; } … … 360 360 * This tells MPD to increase the volume by 5 361 361 */ 362 function volume_up() {362 public function volume_up() { 363 363 364 364 if (is_null($this->_mpd->AdjustVolume('5'))) { return false; } … … 370 370 * This tells MPD to decrese the volume by 5 371 371 */ 372 function volume_down() {372 public function volume_down() { 373 373 374 374 if (is_null($this->_mpd->AdjustVolume('-5'))) { return false; } … … 381 381 * This just tells MPD to skip to the next song 382 382 */ 383 function next() {383 public function next() { 384 384 385 385 if (is_null($this->_mpd->Next())) { return false; } … … 392 392 * This just tells MPD to skip to the prev song 393 393 */ 394 function prev() {394 public function prev() { 395 395 396 396 if (is_null($this->_mpd->Previous())) { return false; } … … 403 403 * This tells MPD to pause the current song 404 404 */ 405 function pause() {405 public function pause() { 406 406 407 407 if (is_null($this->_mpd->Pause())) { return false; } … … 415 415 * This tells MPD to set the volume to the parameter 416 416 */ 417 function volume($volume) {417 public function volume($volume) { 418 418 419 419 if (is_null($this->_mpd->SetVolume($volume))) { return false; } … … 426 426 * This tells MPD to set the repeating the playlist (i.e. loop) to either on or off 427 427 */ 428 function repeat($state) {428 public function repeat($state) { 429 429 430 430 if (is_null($this->_mpd->SetRepeat($state))) { return false; } … … 432 432 433 433 } // repeat 434 435 434 436 435 /** … … 438 437 * This tells MPD to turn on or off the playing of songs from the playlist in random order 439 438 */ 440 function random($onoff) {439 public function random($onoff) { 441 440 442 441 if (is_null($this->_mpd->SetRandom($onoff))) { return false; } … … 449 448 * This tells MPD to move song from SrcPos to DestPos 450 449 */ 451 function move($SrcPos, $DestPos) {450 public function move($SrcPos, $DestPos) { 452 451 453 452 if (is_null($this->_mpd->PLMoveTrack($SrcPos, $DestPos))) { return false; } -
trunk/server/index.ajax.php
r1720 r1730 27 27 switch ($_REQUEST['action']) { 28 28 case 'random_albums': 29 $albums = get_random_albums('6');29 $albums = Album::get_random_albums('6'); 30 30 if (count($albums)) { 31 31 ob_start(); -
trunk/templates/show_album_art.inc.php
r1692 r1730 34 34 $key = $i*4+$j; 35 35 $image_url = Config::get('web_path') . '/image.php?type=session&image_index=' . $key; 36 $dimensions = Core::image_dimensions( get_image_from_source($_SESSION['form']['images'][$key]));36 $dimensions = Core::image_dimensions(Album::get_image_from_source($_SESSION['form']['images'][$key])); 37 37 if (!isset($images[$key])) { echo "<td> </td>\n"; } 38 38 else { -
trunk/templates/sidebar_modules.inc.php
r1608 r1730 39 39 <li><h4><?php echo _('Information'); ?></h4> 40 40 <ul class="sb3" id="sb_home_info"> 41 <li id="sb_home_info_CurrentlyPlaying"><a href="<?php echo $web_path; ?>/index.php"><?php echo _('Currently Playing'); ?></a></li>42 41 <li id="sb_home_info_Statistics"><a href="<?php echo $web_path; ?>/stats.php"><?php echo _('Statistics'); ?></a></li> 43 42 <li id="sb_home_info_AddStationRadio"><a href="<?php echo $web_path; ?>/radio.php?action=show_create"><?php echo _('Add Radio Station'); ?></a></li>
