Skip to content

Commit

Permalink
36 includeshareditems (#43)
Browse files Browse the repository at this point in the history
* shared files are now able to be processed

some minor fixes and beautifications were added

* tests added

shrink the data before make the request
app icon added

* Scrutinizer Auto-Fixes (#44)

This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com

* fixed codecoverage issue.

* Scrutinizer Auto-Fixes (#45)

This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
  • Loading branch information
Janis Koehr committed Jan 21, 2017
1 parent f21795b commit e63d255
Show file tree
Hide file tree
Showing 32 changed files with 885 additions and 620 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,4 +1,8 @@
#Changelog
nextcloud-ocr (2.2.0)
* **Feature**: A new app icon has been created and new screenshots are ready.
* **Bugfix**: As of #36 the app didn't handle shared files correctly. This is fixed now.

nextcloud-ocr (2.1.0)
* **Bugfix**: Couple of bugfixes including the never ending status update bug (#35). Also deu-frak and other unusal languages are now supported (#37).

Expand Down
2 changes: 1 addition & 1 deletion README.md
@@ -1,4 +1,4 @@
# OCR (v2.1.0)
# OCR (v2.2.0)
[![Build Status](https://travis-ci.org/janis91/ocr.svg?branch=master)](https://travis-ci.org/janis91/ocr) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/janis91/ocr/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/janis91/ocr/?branch=master) [![Code Coverage](https://scrutinizer-ci.com/g/janis91/ocr/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/janis91/ocr/?branch=master) [![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](http://www.gnu.org/licenses/agpl-3.0)

Nextcloud OCR (optical character recoginition) processing for images and PDF with tesseract-ocr and OCRmyPDF brings OCR capability to your Nextcloud 10.
Expand Down
12 changes: 6 additions & 6 deletions appinfo/database.xml
Expand Up @@ -8,8 +8,8 @@
CREATE TABLE ocr_status (
id INT(8) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
status TEXT NOT NULL,
file_id INT(10) NOT NULL,
new_name TEXT NOT NULL,
source TEXT NOT NULL,
target TEXT NOT NULL,
temp_file TEXT NOT NULL,
type TEXT NOT NULL,
user_id TEXT NOT NULL,
Expand All @@ -36,14 +36,14 @@
<notnull>true</notnull>
</field>
<field>
<name>file_id</name>
<type>integer</type>
<length>10</length>
<name>source</name>
<type>text</type>
<length>255</length>
<default></default>
<notnull>true</notnull>
</field>
<field>
<name>new_name</name>
<name>target</name>
<type>text</type>
<length>255</length>
<default></default>
Expand Down
3 changes: 2 additions & 1 deletion appinfo/info.xml
Expand Up @@ -45,7 +45,7 @@
**Bitte beachten: Die App untersützt keine aktivierte Verschlüsselung der Dateien und wird es auch voraussichtlich nicht in der Zukunft. Außerdem muss ein aktiver OCRWorker Prozess gestartet sein (Details im Wiki).**
Für weiter Informationen besuchen Sie die Homepage oder lesen Sie die zutreffende Dokumentation.]]></description>
<version>2.1.0</version>
<version>2.2.0</version>
<licence>agpl</licence>
<author>Janis Koehr</author>
<namespace>Ocr</namespace>
Expand All @@ -62,6 +62,7 @@
<screenshot>https://raw.githubusercontent.com/janis91/ocr/master/screenshots/sc1.png</screenshot>
<screenshot>https://raw.githubusercontent.com/janis91/ocr/master/screenshots/sc2.png</screenshot>
<screenshot>https://raw.githubusercontent.com/janis91/ocr/master/screenshots/sc3.png</screenshot>
<screenshot>https://raw.githubusercontent.com/janis91/ocr/master/screenshots/sc4.png</screenshot>
<dependencies>
<php min-version="5.6" max-version="7.1" min-int-size="32" />
<command>ocrmypdf</command>
Expand Down
5 changes: 5 additions & 0 deletions css/ocrstyle.css
Expand Up @@ -35,6 +35,11 @@ tr:focus .action:focus,
opacity: 1;
}

.icon.icon-loading-small.ocr-row-adjustment {
padding-top: 2px;
line-height: 2em;
}

.selectedActionsOCR {
position: absolute;
top: 0;
Expand Down
163 changes: 52 additions & 111 deletions img/app.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 7 additions & 1 deletion js/ocrocr.js
Expand Up @@ -56,6 +56,7 @@
var self = this;
var deferred = $.Deferred();
if(self.checkMimeTypes(selectedFiles)){
selectedFiles = self._shrinkData(selectedFiles);
var data = {language: selectedLanguage, files: selectedFiles};
$.ajax({
url: self._baseUrl,
Expand Down Expand Up @@ -87,12 +88,17 @@
checkMimeTypes: function (selectedFiles) {
var correct = true;
selectedFiles.forEach(function(file){
if(file.type != 'file' || $.inArray(file.mimetype, OCR_ALLOWED_MIMETYPES) == -1){
if($.inArray(file.mimetype, OCR_ALLOWED_MIMETYPES) == -1){
correct = false;
}
});
return correct;
},
_shrinkData: function(files) {
return files.map(function(file){
return {id: file.id};
});
},
initialize: function () {
var self = this;
var deferred = $.Deferred();
Expand Down
4 changes: 2 additions & 2 deletions js/ocrpersonalview.js
Expand Up @@ -27,7 +27,7 @@
+ ' <tbody>'
+ ' {{#each status}}'
+ ' <tr data-id="{{ id }}">'
+ ' <td>{{ newName }}</td>'
+ ' <td>{{ target }}</td>'
+ ' <td>{{ status }}</td>'
+ ' <td class="ocr-action-delete"><div id="ocr-delete"><span>' + t('ocr', 'Delete') + '</span><span class="icon icon-delete"></span></div></td>'
+ ' </tr>'
Expand Down Expand Up @@ -96,7 +96,7 @@
});

$.when(deleting).done(function(data) {
_this._showMsg(t('ocr', 'Following file has been successfully deleted from the queue:') + ' "' + data.newName + '"');
_this._showMsg(t('ocr', 'Following file has been successfully deleted from the queue:') + ' "' + data.target + '"');
_this._loading = false;
_this._load();
});
Expand Down
20 changes: 9 additions & 11 deletions js/ocrview.js
Expand Up @@ -79,10 +79,9 @@
altText: t('ocr', 'OCR'),
iconClass: 'icon-external',
actionHandler: function (filename, context) {
var path = context.dir || context.fileList.getCurrentDirectory();
var id = context.$file.attr('data-id');
var mimetype = context.fileActions.getCurrentMimeType();
var type = context.fileActions.getCurrentType();
self.renderFileAction(filename, path, type, mimetype);
self.renderFileAction(id, filename, mimetype);
}
});
/**
Expand All @@ -97,10 +96,9 @@
altText: t('ocr', 'OCR'),
iconClass: 'icon-external',
actionHandler: function (filename, context) {
var path = context.dir || context.fileList.getCurrentDirectory();
var id = context.$file.attr('data-id');
var mimetype = context.fileActions.getCurrentMimeType();
var type = context.fileActions.getCurrentType();
self.renderFileAction(filename, path, type, mimetype);
self.renderFileAction(id, filename, mimetype);
}
});
},
Expand Down Expand Up @@ -135,11 +133,11 @@
if(languages.length > 0 && typeof languages !== undefined){ noMatches = false; }
return template({languages: languages, noMatches: noMatches});
},
renderFileAction: function (file, path, type, mimetype) {
renderFileAction: function (id, file, mimetype) {
var self = this;
var html = self.renderDropdown();
$(html).appendTo($('tr').filterAttr('data-file',file).find('td.filename'));
var files = [{name: file, path: path, type: type, mimetype: mimetype}];
var files = [{id: id, mimetype: mimetype}];
self.setSelectedFiles(files);
},
toggleSelectedActionButton: function () {
Expand Down Expand Up @@ -171,9 +169,9 @@
var html = '';
var pendingcount = self._ocr.getStatus().pending;
if(force){
html = '<span class="icon icon-loading-small"></span>&nbsp;<span>' + n('ocr','OCR started: %n new file in queue.', 'OCR started: %n new files in queue.', initialcount) + '</span>';
html = '<span class="icon icon-loading-small ocr-row-adjustment"></span>&nbsp;<span>' + n('ocr','OCR started: %n new file in queue.', 'OCR started: %n new files in queue.', initialcount) + '</span>';
}else{
html = '<span class="icon icon-loading-small"></span>&nbsp;<span>' + ' ' + n('ocr','OCR: %n currently pending file in queue.', 'OCR: %n currently pending files in queue.', pendingcount) + '</span>';
html = '<span class="icon icon-loading-small ocr-row-adjustment"></span>&nbsp;<span>' + ' ' + n('ocr','OCR: %n currently pending file in queue.', 'OCR: %n currently pending files in queue.', pendingcount) + '</span>';
}
if(pendingcount > 0 || force){
if (self._row !== undefined) { OC.Notification.hide(self._row); }
Expand All @@ -196,7 +194,7 @@
loopForStatus: function () {
var self = this;
$.when(self._ocr.checkStatus()).done(function(){
if(self._ocr.getStatus().failed > 0) { self.notifyError(n('ocr', 'OCR processing for %n file failed. For details please go to your personal settings.', 'OCR processing for %n files failed. For details please go to your personal settings.', self._ocr.getStatus().failed.length)); }
if(self._ocr.getStatus().failed > 0) { self.notifyError(n('ocr', 'OCR processing for %n file failed. For details please go to your personal settings.', 'OCR processing for %n files failed. For details please go to your personal settings.', self._ocr.getStatus().failed)); }
if(self._ocr.getStatus().pending > 0){
if(self._ocr.getStatus().processed > 0) { self.updateFileList(); }
self.togglePendingState(false);
Expand Down

0 comments on commit e63d255

Please sign in to comment.