123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- declare(strict_types=1);
- namespace OCA\Files\Service;
- use OCP\FilesMetadata\Exceptions\FilesMetadataNotFoundException;
- use OCP\FilesMetadata\IFilesMetadataManager;
- class LivePhotosService {
- public function __construct(
- private IFilesMetadataManager $filesMetadataManager,
- ) {
- }
-
- public function getLivePhotoPeerId(int $fileId): ?int {
- try {
- $metadata = $this->filesMetadataManager->getMetadata($fileId);
- } catch (FilesMetadataNotFoundException $ex) {
- return null;
- }
- if (!$metadata->hasKey('files-live-photo')) {
- return null;
- }
- return (int)$metadata->getString('files-live-photo');
- }
- }
|