Exemple #1
0
                exit;
            }
            $songId = $collection->getSongByPath($arguments['path']);
            $collection->registerPlay($songId);
            header('Content-Type:' . $ftype);
            \OCP\Response::enableCaching(3600 * 24);
            // 24 hour
            header('Accept-Ranges: bytes');
            header('Content-Length: ' . \OC\Files\Filesystem::filesize($arguments['path']));
            $mtime = \OC\Files\Filesystem::filemtime($arguments['path']);
            \OCP\Response::setLastModifiedHeader($mtime);
            \OC\Files\Filesystem::readfile($arguments['path']);
            exit;
        case 'find_music':
            $scanner = new Scanner($collection);
            $music = $scanner->getMusic();
            \OCP\JSON::encodedPrint($music);
            exit;
    }
}
class ScanWatcher
{
    /**
     * @var \OC_EventSource $eventSource;
     */
    private $eventSource;
    private $scannedCount = 0;
    public function __construct($eventSource)
    {
        $this->eventSource = $eventSource;
    }