Skip to content

Commit

Permalink
Refactor to use a nicer structure.
Browse files Browse the repository at this point in the history
Add some logging.
Warn if using vendored perl.
Up version for release.
Allow Nextcloud 17.
  • Loading branch information
ariselseng committed Oct 12, 2019
1 parent 6b1c033 commit 1bf0a55
Show file tree
Hide file tree
Showing 7 changed files with 159 additions and 96 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Camera RAW Previews
[![Github All Releases](https://img.shields.io/github/downloads/cowai/camerarawpreviews/total.svg)](https://github.com/cowai/camerarawpreviews/releases) [![paypal](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/AriSelseng/2EUR)
[![Github All Releases](https://img.shields.io/github/downloads/ariselseng/camerarawpreviews/total.svg)](https://github.com/cowai/camerarawpreviews/releases) [![paypal](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/AriSelseng/2EUR)

A Nextcloud/ownCloud app that provides previews for camera RAW images like .CR2, .CRW, .DNG, .MRW, .NEF, .NRW, .RW2, .SRW, .SRW, etc.
This app also gives you preview of Adobe Indesign files (.INDD).
Expand All @@ -9,6 +9,7 @@ This app also gives you preview of Adobe Indesign files (.INDD).
* Probably **memory_limit** quite high.
* **imagick** or **gd** module. If imagick is available, it will use that for performance.
* For files with a TIFF preview (at least some DNG files), **imagick** is required
* Perl installed. A deprecated fallback is used now that will be removed in a future version.

## Installation
Install in Nextcloud App store.
Expand Down
46 changes: 2 additions & 44 deletions appinfo/app.php
Original file line number Diff line number Diff line change
@@ -1,46 +1,4 @@
<?php

use OCP\AppFramework\App;
$app = new App('camerarawpreviews');
$container = $app->getContainer();
$eventDispatcher = \OC::$server->getEventDispatcher();
$eventDispatcher->addListener('OCA\Files::loadAdditionalScripts', function() {
script('camerarawpreviews', 'register-viewer'); // adds js/script.js
});
$mimeTypeDetector = \OC::$server->getMimeTypeDetector();
$mimes = $mimeTypeDetector->getAllMappings();
$mimes_to_detect = [
'indd' => ['image/x-indesign'],
'3fr' => ['image/x-dcraw'],
'arw' => ['image/x-dcraw'],
'cr2' => ['image/x-dcraw'],
'cr3' => ['image/x-dcraw'],
'crw' => ['image/x-dcraw'],
'dng' => ['image/x-dcraw'],
'erf' => ['image/x-dcraw'],
'fff' => ['image/x-dcraw'],
'iiq' => ['image/x-dcraw'],
'kdc' => ['image/x-dcraw'],
'mrw' => ['image/x-dcraw'],
'nef' => ['image/x-dcraw'],
'nrw' => ['image/x-dcraw'],
'orf' => ['image/x-dcraw'],
'ori' => ['image/x-dcraw'],
'pef' => ['image/x-dcraw'],
'raf' => ['image/x-dcraw'],
'rw2' => ['image/x-dcraw'],
'rwl' => ['image/x-dcraw'],
'sr2' => ['image/x-dcraw'],
'srf' => ['image/x-dcraw'],
'srw' => ['image/x-dcraw'],
'tif' => ['image/x-dcraw'],
'x3f' => ['image/x-dcraw'],
];

$mimeTypeDetector->registerTypeArray($mimes_to_detect);

$previewManager = $container->getServer()->query('PreviewManager');

$previewManager->registerProvider('/^((image\/x-dcraw)|(image\/x-indesign))(;+.*)*$/', function () {
return new \OCA\CameraRawPreviews\RawPreview;
});
$app = new \OCA\CameraRawPreviews\AppInfo\Application;
$app->register();
8 changes: 4 additions & 4 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
<name>Camera RAW Previews</name>
<summary>Preview and show camera RAW files in Nextcloud/ownCloud</summary>
<description><![CDATA[This app will make previews of &quot;RAW&quot; files from cameras in Nextcloud/ownCloud.]]></description>
<version>0.7.0</version>
<version>0.7.1</version>
<licence>agpl</licence>
<author mail="[email protected]" >Ari Selseng</author>
<namespace>CameraRawPreviews</namespace>
<screenshot>https://raw.githubusercontent.com/cowai/camerarawpreviews/master/screenshots/screenshot1.png</screenshot>
<screenshot>https://raw.githubusercontent.com/ariselseng/camerarawpreviews/master/screenshots/screenshot1.png</screenshot>
<category>files</category>
<category>multimedia</category>
<bugs>https://github.com/cowai/camerarawpreviews/issues</bugs>
<bugs>https://github.com/ariselseng/camerarawpreviews/issues</bugs>
<dependencies>
<owncloud min-version="10" max-version="10" />
<nextcloud min-version="11" max-version="16" />
<nextcloud min-version="11" max-version="17" />
</dependencies>
<types><filesystem/></types>
</info>
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "cowai/camerarawpreviews",
"name": "ariselseng/camerarawpreviews",
"type": "project",
"require": {
"jmoati/exiftool-bin": "^11.26",
"intervention/image": "^2.4.2"
"intervention/image": "^2.5.0"
},
"license": "agpl",
"authors": [
Expand Down
46 changes: 25 additions & 21 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 70 additions & 0 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php

namespace OCA\CameraRawPreviews\AppInfo;

use OCA\CameraRawPreviews\RawPreview;
use OCP\AppFramework\App;

class Application extends App
{
private $appName;

public function __construct()
{
$this->appName = 'camerarawpreviews';

parent::__construct($this->appName);
}

public function register()
{
$this->registerScripts();
$container = $this->getContainer();
$mimeTypeDetector = \OC::$server->getMimeTypeDetector();
$mimes_to_detect = [
'indd' => ['image/x-indesign'],
'3fr' => ['image/x-dcraw'],
'arw' => ['image/x-dcraw'],
'cr2' => ['image/x-dcraw'],
'cr3' => ['image/x-dcraw'],
'crw' => ['image/x-dcraw'],
'dng' => ['image/x-dcraw'],
'erf' => ['image/x-dcraw'],
'fff' => ['image/x-dcraw'],
'iiq' => ['image/x-dcraw'],
'kdc' => ['image/x-dcraw'],
'mrw' => ['image/x-dcraw'],
'nef' => ['image/x-dcraw'],
'nrw' => ['image/x-dcraw'],
'orf' => ['image/x-dcraw'],
'ori' => ['image/x-dcraw'],
'pef' => ['image/x-dcraw'],
'raf' => ['image/x-dcraw'],
'rw2' => ['image/x-dcraw'],
'rwl' => ['image/x-dcraw'],
'sr2' => ['image/x-dcraw'],
'srf' => ['image/x-dcraw'],
'srw' => ['image/x-dcraw'],
'tif' => ['image/x-dcraw'],
'x3f' => ['image/x-dcraw'],
];

$mimeTypeDetector->registerTypeArray($mimes_to_detect);

$previewManager = $container->getServer()->query('PreviewManager');
$appName = $this->appName;
$previewManager->registerProvider('/^((image\/x-dcraw)|(image\/x-indesign))(;+.*)*$/', function () use($appName) {
return new RawPreview($this->getContainer()->getServer()->getLogger(), $appName);
});

}

private function registerScripts()
{
$eventDispatcher = \OC::$server->getEventDispatcher();
$eventDispatcher->addListener('OCA\Files::loadAdditionalScripts', function () {
script($this->appName, 'register-viewer'); // adds js/script.js
});
}

}
Loading

0 comments on commit 1bf0a55

Please sign in to comment.