Fix FileSystem Listing during tests

This commit is contained in:
alphayax 2016-06-14 22:38:16 +02:00
parent 6700b1dbb3
commit 59d4316ec9
2 changed files with 9 additions and 10 deletions

View File

@ -11,14 +11,12 @@ $App->openSession();
/// Scan files in root
$FSListService = new \alphayax\freebox\api\v3\services\FileSystem\FileSystemListing( $App);
$FilesInRoot = $FSListService->getFilesFromDirectory( '/');
foreach( $FilesInRoot as $fileInfo){
echo '- '. $fileInfo->getPath() . PHP_EOL;
}
print_r( $FilesInRoot);
/// Get a file information (Will throw an exception if file does not exists)
try {
$VideoFile = $FSListService->getFileInformation( '/Disque dur/Téléchargements/The.100.S03E14.FASTSUB.VOSTFR.1080p.HDTV.x264.AAC-GOBO2S/The.100.S03E14.FASTSUB.VOSTFR.1080p.HDTV.x264.AAC-GOBO2S.mkv');
var_dump( $VideoFile);
$VideoFile = $FSListService->getFileInformation( '/Disque dur/Téléchargements/');
print_r( $VideoFile);
} catch (Exception $e){
echo $e->getMessage();
}

View File

@ -24,11 +24,12 @@ class FileSystemListing extends Service {
public function getFilesFromDirectory( $DirectoryName = '/Disque dur/', $onlyFolder = true, $countSubFolder = false, $removeHidden = true){
$Directory_b64 = base64_encode( $DirectoryName);
$rest = $this->getAuthService( self::API_FS_LS . $Directory_b64);
$rest->GET([
'onlyFolder' => $onlyFolder,
'countSubFolder' => $countSubFolder,
'removeHidden' => $removeHidden,
]);
$rest->GET();
// $rest->GET([
// 'onlyFolder' => $onlyFolder,
// 'countSubFolder' => $countSubFolder,
// 'removeHidden' => $removeHidden,
// ]);
return $rest->getResultAsArray( models\FileSystem\FileInfo::class);
}