diff options
author | pb1dft <pb1dft@ampache> | 2006-11-08 19:46:31 +0000 |
---|---|---|
committer | pb1dft <pb1dft@ampache> | 2006-11-08 19:46:31 +0000 |
commit | 627efa4dd844c89bb752f4484d1395409c2dbf76 (patch) | |
tree | 71f34c36d26e3ecc17e2a22990e6a65f31f413cc /albums.php | |
parent | 3914736c941f9cee4e78d1ee0be61f7216d43cff (diff) | |
download | ampache-627efa4dd844c89bb752f4484d1395409c2dbf76.tar.gz ampache-627efa4dd844c89bb752f4484d1395409c2dbf76.tar.bz2 ampache-627efa4dd844c89bb752f4484d1395409c2dbf76.zip |
Addition for ip_history and browse for local album art
Diffstat (limited to 'albums.php')
-rw-r--r-- | albums.php | 61 |
1 files changed, 46 insertions, 15 deletions
@@ -90,25 +90,56 @@ elseif ($_REQUEST['action'] === 'find_art') { $search = $artist . " " . $album_name; - // Attempt to find the art with what we've got - $images = $album->find_art($_REQUEST['cover'], $search); - $_SESSION['form']['images'] = $images; + //Find out if the cover url is a local filename or an url + if (empty($_FILES['file'])){ + $coverurl = $_REQUEST['cover']; + + // Attempt to find the art with what we've got + $images = $album->find_art($_REQUEST['cover'], $search); + $_SESSION['form']['images'] = $images; + + if (count($images)) { + include(conf('prefix') . '/templates/show_album_art.inc.php'); + } + else { + show_confirmation(_('Album Art Not Located'),_('Album Art could not be located at this time. This may be due to Amazon being busy, or the album not being present in their collection.'),"/albums.php?action=show&album=" . $album->id); + } + + $albumname = $album->name; + $artistname = $artist; + + // Remember the last typed entry, if there was one + if (isset($_REQUEST['album_name'])) { $albumname = scrub_in($_REQUEST['album_name']); } + if (isset($_REQUEST['artist_name'])) { $artistname = scrub_in($_REQUEST['artist_name']); } + + include(conf('prefix') . '/templates/show_get_albumart.inc.php'); - if (count($images)) { - include(conf('prefix') . '/templates/show_album_art.inc.php'); } - else { - show_confirmation(_('Album Art Not Located'),_('Album Art could not be located at this time. This may be due to Amazon being busy, or the album not being present in their collection.'),"/albums.php?action=show&album=" . $album->id); - } - - $albumname = $album->name; - $artistname = $artist; + elseif (isset($_FILES['file']['tmp_name'])){ + $album_id = $_REQUEST['album_id']; + + $album = new Album($album_id); + + $dir = dirname($_FILES['file']['tmp_name']) . "/"; + $filename = $dir . basename($_FILES['file']['tmp_name']); + $handle = fopen($filename, "rb"); + $mime = $_FILES['file']['type']; - // Remember the last typed entry, if there was one - if (isset($_REQUEST['album_name'])) { $albumname = scrub_in($_REQUEST['album_name']); } - if (isset($_REQUEST['artist_name'])) { $artistname = scrub_in($_REQUEST['artist_name']); } + $art = ''; + while(!feof($handle)) { + $art .= fread($handle, 1024); + } + fclose($handle); + if (!empty($art)){ + $album->insert_art($art,$mime); + show_confirmation(_("Album Art Inserted"),"","/albums.php?action=show&album=$album_id"); + } + else { + show_confirmation(_('Album Art Not Located'),_('Album Art could not be located at this time. This may be due to write acces error, or the file is not received corectly.'),"/albums.php?action=show&album=" . $album->id); + } - include(conf('prefix') . '/templates/show_get_albumart.inc.php'); + } + } // find_art |