コード例 #1
0
ファイル: getalbumcover.php プロジェクト: cyrilix/rompr
function tryLocal()
{
    global $albumpath;
    global $covernames;
    global $album;
    global $artist;
    global $fname;
    if ($albumpath == "" || $albumpath == "." || $albumpath === null) {
        return "";
    }
    $files = scan_for_images($albumpath);
    foreach ($files as $i => $file) {
        $info = pathinfo($file);
        $file_name = strtolower(rawurldecode(html_entity_decode(basename($file, '.' . $info['extension']))));
        if ($file_name == $fname) {
            debuglog("    Returning archived image", "GETALBUMCOVER");
            return $file;
        }
    }
    foreach ($files as $i => $file) {
        $info = pathinfo($file);
        $file_name = strtolower(rawurldecode(html_entity_decode(basename($file, '.' . $info['extension']))));
        if ($file_name == strtolower($artist . " - " . $album) || $file_name == strtolower($album)) {
            debuglog("    Returning file matching album name", "GETALBUMCOVER");
            return $file;
        }
    }
    foreach ($covernames as $j => $name) {
        foreach ($files as $i => $file) {
            $info = pathinfo($file);
            $file_name = strtolower(rawurldecode(html_entity_decode(basename($file, '.' . $info['extension']))));
            if ($file_name == $name) {
                debuglog("    Returning " . $file, "GETALBUMCOVER");
                return $file;
            }
        }
    }
    // If we haven't found one but there's only one, then return that
    if (count($files) == 1) {
        debuglog("    Returning " . $files[0], "GETALBUMCOVER");
        return $files[0];
    }
    return "";
}
コード例 #2
0
ファイル: findLocalImages.php プロジェクト: cyrilix/rompr
<?php

chdir('..');
include "includes/vars.php";
include "includes/functions.php";
$donkeymolester = scan_for_images($_REQUEST['path']);
print json_encode($donkeymolester);