lfp


Logs | Files | README | README | LICENSE | GitLab


1
commit 22eebbaa30c0bdac7ace842e9dd98e52ec8f81b8
2
Author: Connor Etherington <[email protected]>
3
Date:   Mon Oct 2 09:11:52 2023 +0200
4
5
    Auto-Commit Update - 20231002
6
---
7
 BUILD/PKGBUILD                                     |  56 ------
8
 BUILD/lfp-4.1.0-1-x86_64.pkg.tar.xz                | Bin 78412 -> 0 bytes
9
 BUILD/lfp.install                                  |   9 -
10
 PKGBUILD                                           |   7 +-
11
 usr/share/lfp/ocr/ocr.js                           |   7 +-
12
 usr/share/lfp/ocr/package-lock.json                |  27 ---
13
 .../ocr/{tesseract/src/index.js => tesseract.js}   |   0
14
 usr/share/lfp/ocr/tesseract/LICENSE                |  21 ---
15
 usr/share/lfp/ocr/tesseract/package.json           |  37 ----
16
 usr/share/lfp/ocr/tesseract/readme.md              |  96 ----------
17
 usr/share/lfp/ocr/tesseract/src/index.d.ts         | 195 ---------------------
18
 usr/share/lfp/ocr/yarn.lock                        |   8 -
19
 12 files changed, 6 insertions(+), 457 deletions(-)
20
21
diff --git a/BUILD/PKGBUILD b/BUILD/PKGBUILD
22
deleted file mode 100644
23
index 9947b1b..0000000
24
--- a/BUILD/PKGBUILD
25
+++ /dev/null
26
@@ -1,56 +0,0 @@
27
-# Maintainer: Connor Etherington <[email protected]>
28
-# ---
29
-pkgname=lfp
30
-pkgver=4.1.0
31
-pkgrel=1
32
-pkgdesc='A wrapper for the lf file manager with in-terminal media previews, on-exit directory changing and much more'
33
-license=('MIT')
34
-arch=('x86_64')
35
-install="lfp.install"
36
-url="https://gitlab.com/a4to/lfp"
37
-depends=(lf zsh ffmpeg graphicsmagick openslide ghostscript bat fzf dunst dialog xsel lolcat python3 python-docopt python-pillow python-attrs libxres python-setuptools)
38
-conflicts=(lfp-git)
39
-optdepends=(
40
-  'nodejs: to make use of lfps built in node actions manager'
41
-  'python3: to make use of lfps built in python actions manager'
42
-  )
43
-source=(
44
-  "https://software.concise.cc/x86_64/${pkgname}-${pkgver}-${pkgrel}-$arch.pkg.tar.xz"
45
-)
46
-sha512sums=(
47
-  '6950370392bd0f1fde9270e570600898eb3d710260a11cf3fa27772f0bb0ac1147d98166b77b67b39f79289b50e3c86cd70b79926b05b143e72b619396f6e4c2'
48
-)
49
-md5sums=(
50
-  '24a3424ffbf0d0e406bb6f2f8b95b764'
51
-)
52
-validpgpkeys=(
53
-  '81BACEEBC3EA26E127166E4A819BB92A9A48160E'
54
-)
55
-
56
-package() {
57
-
58
-  cd "$srcdir/${pkgname}-${pkgver}-${pkgrel}-${arch}/lfpreviewer" ||
59
-  cd "$srcdir/${pkgname}/lfpreviewer"
60
-
61
-  pip3 install --user --upgrade --force-reinstall --no-deps setuptools wheel
62
-  python3 ./setup.py install --root="$pkgdir" --prefix=/usr --optimize=1
63
-
64
-  cd "$srcdir/${pkgname}-${pkgver}-${pkgrel}-${arch}" >/dev/null 2>&1 ||
65
-  cd "$srcdir/${pkgname}"
66
-
67
-  install -Dm755 usr/bin/* -t "${pkgdir}/usr/bin"
68
-  install -Dm755 usr/share/${pkgname}/{lfp,lfpcd,cleaner,scope} -t "${pkgdir}/usr/share/${pkgname}"
69
-  install -Dm644 usr/share/${pkgname}/{lfp-icons,lfprc} -t "${pkgdir}/usr/share/${pkgname}"
70
-  install -Dm644 usr/share/licenses/${pkgname}/LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
71
-  install -Dm644 usr/share/doc/${pkgname}/README.md "${pkgdir}/usr/share/doc/${pkgname}/README.md"
72
-  install -Dm644 usr/share/man/man1/${pkgname}.1.gz "${pkgdir}/usr/share/man/man1/${pkgname}.1.gz"
73
-  install -Dm755 usr/share/${pkgname}/ocr/ocr.js -t "${pkgdir}/usr/share/${pkgname}/ocr"
74
-  install -Dm644 usr/share/${pkgname}/ocr/package.json -t "${pkgdir}/usr/share/${pkgname}/ocr"
75
-
76
-  mkdir -p "${pkgdir}/usr/share/${pkgname}/ocr/tesseract"
77
-
78
-  while read -r file; do
79
-    install -Dm644 "$file" -t "${pkgdir}/usr/share/${pkgname}/ocr/tesseract"
80
-  done < <(find . -type f ${pkgdir}/usr/share/${pkgname}/ocr/tesseract)
81
-
82
-}
83
diff --git a/BUILD/lfp-4.1.0-1-x86_64.pkg.tar.xz b/BUILD/lfp-4.1.0-1-x86_64.pkg.tar.xz
84
deleted file mode 100644
85
index 9fd192e..0000000
86
Binary files a/BUILD/lfp-4.1.0-1-x86_64.pkg.tar.xz and /dev/null differ
87
diff --git a/BUILD/lfp.install b/BUILD/lfp.install
88
deleted file mode 100644
89
index 6c915df..0000000
90
--- a/BUILD/lfp.install
91
+++ /dev/null
92
@@ -1,9 +0,0 @@
93
-post_install() {
94
-  echo -e "\n \033[1;33m[+]\e[0;1;32m For on-exit directory changing, add the following line to your bash/zshrc\e[0m :\e[36m\n\n     source '/usr/share/lfp/lfpcd'\n\n\n\e[0m"
95
-}
96
-
97
-post_upgrade() {
98
-  which yarn >/dev/null 2>&1 && yarn install /usr/share/lfp/ocr ||
99
-    which npm >/dev/null 2>&1 && npm install /usr/share/lfp/ocr ||
100
-    true
101
-}
102
diff --git a/PKGBUILD b/PKGBUILD
103
index 9947b1b..b19590b 100644
104
--- a/PKGBUILD
105
+++ b/PKGBUILD
106
@@ -46,11 +46,6 @@ package() {
107
   install -Dm644 usr/share/man/man1/${pkgname}.1.gz "${pkgdir}/usr/share/man/man1/${pkgname}.1.gz"
108
   install -Dm755 usr/share/${pkgname}/ocr/ocr.js -t "${pkgdir}/usr/share/${pkgname}/ocr"
109
   install -Dm644 usr/share/${pkgname}/ocr/package.json -t "${pkgdir}/usr/share/${pkgname}/ocr"
110
-
111
-  mkdir -p "${pkgdir}/usr/share/${pkgname}/ocr/tesseract"
112
-
113
-  while read -r file; do
114
-    install -Dm644 "$file" -t "${pkgdir}/usr/share/${pkgname}/ocr/tesseract"
115
-  done < <(find . -type f ${pkgdir}/usr/share/${pkgname}/ocr/tesseract)
116
+  install -Dm644 usr/share/${pkgname}/ocr/tesseract.js -t "${pkgdir}/usr/share/${pkgname}/ocr"
117
 
118
 }
119
diff --git a/usr/share/lfp/ocr/ocr.js b/usr/share/lfp/ocr/ocr.js
120
index 1760ff9..01289b8 100755
121
--- a/usr/share/lfp/ocr/ocr.js
122
+++ b/usr/share/lfp/ocr/ocr.js
123
@@ -3,9 +3,12 @@
124
 const fs = require('fs');
125
 const fsp = require('fs').promises;
126
 const path = require('path');
127
-const tesseract = require('/usr/share/lfp/ocr/tesseract');
128
+const tesseract = require('./tesseract');
129
 const { spawn } = require('child_process');
130
 
131
+const green = '\x1b[32m';
132
+const reset = '\x1b[0m';
133
+
134
 const config = { lang: 'eng', oem: 1, psm: 3 };
135
 
136
 const ocr = async (imagePath) => {
137
@@ -42,7 +45,7 @@ const extractsDir = '/home/nvx1/.local/share/logs/ocrListener/extracts';
138
     resolve(writeFile(path.join(extractsDir, `${timestamp().replace(/:/g, '-').replace(/ /g, '_')}.txt`), combinedText));
139
   }).then(() => {
140
 
141
-    console.log('Extract saved')
142
+    console.log(`\n${green}[+] ${reset}LFP OCR:\n`);
143
 
144
     echo.stdout.pipe(xclip.stdin);
145
 
146
diff --git a/usr/share/lfp/ocr/package-lock.json b/usr/share/lfp/ocr/package-lock.json
147
deleted file mode 100644
148
index 3aaddcf..0000000
149
--- a/usr/share/lfp/ocr/package-lock.json
150
+++ /dev/null
151
@@ -1,27 +0,0 @@
152
-{
153
-  "name": "lfp-ocr",
154
-  "version": "0.1.0",
155
-  "lockfileVersion": 3,
156
-  "requires": true,
157
-  "packages": {
158
-    "": {
159
-      "name": "lfp-ocr",
160
-      "version": "0.1.0",
161
-      "license": "MIT",
162
-      "dependencies": {
163
-        "node-tesseract-ocr": "^2.2.1"
164
-      },
165
-      "bin": {
166
-        "lfp-ocr": "ocr.js"
167
-      }
168
-    },
169
-    "node_modules/node-tesseract-ocr": {
170
-      "version": "2.2.1",
171
-      "resolved": "https://registry.npmjs.org/node-tesseract-ocr/-/node-tesseract-ocr-2.2.1.tgz",
172
-      "integrity": "sha512-Q9cD79JGpPNQBxbi1fV+OAsTxYKLpx22sagsxSyKbu1u+t6UarApf5m32uVc8a5QAP1Wk7fIPN0aJFGGEE9DyQ==",
173
-      "engines": {
174
-        "node": ">=10"
175
-      }
176
-    }
177
-  }
178
-}
179
diff --git a/usr/share/lfp/ocr/tesseract/src/index.js b/usr/share/lfp/ocr/tesseract.js
180
old mode 100755
181
new mode 100644
182
similarity index 100%
183
rename from usr/share/lfp/ocr/tesseract/src/index.js
184
rename to usr/share/lfp/ocr/tesseract.js
185
diff --git a/usr/share/lfp/ocr/tesseract/LICENSE b/usr/share/lfp/ocr/tesseract/LICENSE
186
deleted file mode 100644
187
index f14f7b7..0000000
188
--- a/usr/share/lfp/ocr/tesseract/LICENSE
189
+++ /dev/null
190
@@ -1,21 +0,0 @@
191
-MIT License
192
-
193
-Copyright (c) 2019 zapolnoch
194
-
195
-Permission is hereby granted, free of charge, to any person obtaining a copy
196
-of this software and associated documentation files (the "Software"), to deal
197
-in the Software without restriction, including without limitation the rights
198
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
199
-copies of the Software, and to permit persons to whom the Software is
200
-furnished to do so, subject to the following conditions:
201
-
202
-The above copyright notice and this permission notice shall be included in all
203
-copies or substantial portions of the Software.
204
-
205
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
206
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
207
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
208
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
209
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
210
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
211
-SOFTWARE.
212
diff --git a/usr/share/lfp/ocr/tesseract/package.json b/usr/share/lfp/ocr/tesseract/package.json
213
deleted file mode 100755
214
index 02521a9..0000000
215
--- a/usr/share/lfp/ocr/tesseract/package.json
216
+++ /dev/null
217
@@ -1,37 +0,0 @@
218
-{
219
-  "name": "node-tesseract-ocr",
220
-  "version": "2.2.1",
221
-  "description": "A Node.js wrapper for the Tesseract OCR API",
222
-  "keywords": [
223
-    "ocr",
224
-    "tesseract",
225
-    "text recognition",
226
-    "optical character recognition",
227
-    "image to text"
228
-  ],
229
-  "license": "MIT",
230
-  "main": "src/index.js",
231
-  "types": "src/index.d.ts",
232
-  "repository": {
233
-    "type": "git",
234
-    "url": "git://github.com/zapolnoch/node-tesseract-ocr.git"
235
-  },
236
-  "engines": {
237
-    "node": ">=10"
238
-  },
239
-  "scripts": {
240
-    "test": "npm-run-all test:*",
241
-    "test:lint": "eslint .",
242
-    "test:tape": "tape test/**/*.js",
243
-    "test:audit": "npm audit --audit-level=high"
244
-  },
245
-  "devDependencies": {
246
-    "eslint": "^7.25.0",
247
-    "eslint-config-silence": "^0.7.1",
248
-    "eslint-plugin-prettier": "^3.4.0",
249
-    "npm-run-all": "^4.1.5",
250
-    "prettier": "^2.2.1",
251
-    "rewire": "^5.0.0",
252
-    "tape": "^5.2.2"
253
-  }
254
-}
255
diff --git a/usr/share/lfp/ocr/tesseract/readme.md b/usr/share/lfp/ocr/tesseract/readme.md
256
deleted file mode 100755
257
index 486cab3..0000000
258
--- a/usr/share/lfp/ocr/tesseract/readme.md
259
+++ /dev/null
260
@@ -1,96 +0,0 @@
261
-# Tesseract OCR for Node.js
262
-
263
-[![Build Status](https://img.shields.io/travis/zapolnoch/node-tesseract-ocr/master.svg?style=flat-square)](https://travis-ci.org/zapolnoch/node-tesseract-ocr)
264
-[![npm](https://img.shields.io/npm/v/node-tesseract-ocr.svg?style=flat-square)](https://www.npmjs.com/package/node-tesseract-ocr)
265
-[![npm](https://img.shields.io/npm/dm/node-tesseract-ocr.svg?style=flat-square)](https://www.npmjs.com/package/node-tesseract-ocr)
266
-[![Known Vulnerabilities](https://snyk.io/test/github/zapolnoch/node-tesseract-ocr/badge.svg)](https://snyk.io/test/github/zapolnoch/node-tesseract-ocr)
267
-
268
-## Installation
269
-
270
-First, you need to install the Tesseract project. Instructions for installing Tesseract for all platforms can be found on [the project site](https://github.com/tesseract-ocr/tessdoc/blob/master/Installation.md). On Debian/Ubuntu:
271
-
272
-```bash
273
-apt-get install tesseract-ocr
274
-```
275
-
276
-After you've installed Tesseract, you can go installing the npm-package:
277
-
278
-```bash
279
-npm install node-tesseract-ocr
280
-```
281
-
282
-## Usage
283
-
284
-```js
285
-const tesseract = require("node-tesseract-ocr")
286
-
287
-const config = {
288
-  lang: "eng",
289
-  oem: 1,
290
-  psm: 3,
291
-}
292
-
293
-tesseract
294
-  .recognize("image.jpg", config)
295
-  .then((text) => {
296
-    console.log("Result:", text)
297
-  })
298
-  .catch((error) => {
299
-    console.log(error.message)
300
-  })
301
-```
302
-
303
-Also you can pass Buffer:
304
-
305
-```js
306
-const img = fs.readFileSync("image.jpg")
307
-
308
-tesseract
309
-  .recognize(img, config)
310
-  .then((text) => {
311
-    console.log("Result:", text)
312
-  })
313
-  .catch((error) => {
314
-    console.log(error.message)
315
-  })
316
-```
317
-
318
-or URL:
319
-
320
-```js
321
-const img = "https://tesseract.projectnaptha.com/img/eng_bw.png"
322
-
323
-tesseract
324
-  .recognize(img, config)
325
-  .then((text) => {
326
-    console.log("Result:", text)
327
-  })
328
-  .catch((error) => {
329
-    console.log(error.message)
330
-  })
331
-```
332
-
333
-If you want to process multiple images in a single run, then pass an array:
334
-
335
-```js
336
-const images = ["./test/samples/file1.png", "./test/samples/file2.png"]
337
-
338
-tesseract
339
-  .recognize(images, config)
340
-  .then((text) => {
341
-    console.log("Result:", text)
342
-  })
343
-  .catch((error) => {
344
-    console.log(error.message)
345
-  })
346
-```
347
-
348
-In the config object you can pass any [OCR options](https://github.com/tesseract-ocr/tesseract/blob/master/doc/tesseract.1.asc#options). Also you can pass here any [control parameters](https://tesseract-ocr.github.io/tessdoc/tess3/ControlParams) or use ready-made sets of [config files](https://github.com/tesseract-ocr/tesseract/tree/master/tessdata/configs) (like hocr):
349
-
350
-```js
351
-const result = await tesseract.recognize("image.jpg", {
352
-  load_system_dawg: 0,
353
-  tessedit_char_whitelist: "0123456789",
354
-  presets: ["tsv"],
355
-})
356
-```
357
diff --git a/usr/share/lfp/ocr/tesseract/src/index.d.ts b/usr/share/lfp/ocr/tesseract/src/index.d.ts
358
deleted file mode 100644
359
index 3563e4d..0000000
360
--- a/usr/share/lfp/ocr/tesseract/src/index.d.ts
361
+++ /dev/null
362
@@ -1,195 +0,0 @@
363
-export type Input = string | string[] | Buffer
364
-
365
-// #region Preset
366
-// https://github.com/tesseract-ocr/tesseract/tree/master/tessdata/configs
367
-// https://github.com/tesseract-ocr/tesseract/tree/master/tessdata/tessconfigs
368
-export type Preset =
369
-  | "alto"
370
-  | "ambigs.train"
371
-  | "api_config"
372
-  | "bazaar"
373
-  | "bigram"
374
-  | "box.train"
375
-  | "box.train.stderr"
376
-  | "digits"
377
-  | "get.images"
378
-  | "hocr"
379
-  | "inter"
380
-  | "kannada"
381
-  | "linebox"
382
-  | "logfile"
383
-  | "lstm.train"
384
-  | "lstmbox"
385
-  | "lstmdebug"
386
-  | "makebox"
387
-  | "pdf"
388
-  | "quiet"
389
-  | "rebox"
390
-  | "strokewidth"
391
-  | "tsv"
392
-  | "txt"
393
-  | "unlv"
394
-  | "wordstrbox"
395
-  | "batch"
396
-  | "batch.nochop"
397
-  | "matdemo"
398
-  | "msdemo"
399
-  | "nobatch"
400
-  | "segdemo"
401
-// #endregion
402
-
403
-// #region Language
404
-// https://github.com/tesseract-ocr/tesseract/blob/master/doc/tesseract.1.asc#LANGUAGES
405
-// https://github.com/tesseract-ocr/tessdoc/blob/master/Data-Files-in-different-versions.md
406
-export type Language =
407
-  | "afr"
408
-  | "amh"
409
-  | "ara"
410
-  | "asm"
411
-  | "aze"
412
-  | "aze_cyrl"
413
-  | "bel"
414
-  | "ben"
415
-  | "bod"
416
-  | "bos"
417
-  | "bre"
418
-  | "bul"
419
-  | "cat"
420
-  | "ceb"
421
-  | "ces"
422
-  | "chi_sim"
423
-  | "chi_tra"
424
-  | "chr"
425
-  | "cos"
426
-  | "cym"
427
-  | "dan"
428
-  | "deu"
429
-  | "div"
430
-  | "dzo"
431
-  | "ell"
432
-  | "eng"
433
-  | "enm"
434
-  | "epo"
435
-  | "equ"
436
-  | "est"
437
-  | "eus"
438
-  | "fas"
439
-  | "fao"
440
-  | "fil"
441
-  | "fin"
442
-  | "fra"
443
-  | "frk"
444
-  | "frm"
445
-  | "fry"
446
-  | "gla"
447
-  | "gle"
448
-  | "glg"
449
-  | "grc"
450
-  | "guj"
451
-  | "hat"
452
-  | "heb"
453
-  | "hin"
454
-  | "hrv"
455
-  | "hun"
456
-  | "hye"
457
-  | "iku"
458
-  | "ind"
459
-  | "isl"
460
-  | "ita"
461
-  | "ita_old"
462
-  | "jav"
463
-  | "jpn"
464
-  | "kan"
465
-  | "kat"
466
-  | "kat_old"
467
-  | "kaz"
468
-  | "khm"
469
-  | "kir"
470
-  | "kmr"
471
-  | "kor"
472
-  | "kor_vert"
473
-  | "lao"
474
-  | "lat"
475
-  | "lav"
476
-  | "lit"
477
-  | "ltz"
478
-  | "mal"
479
-  | "mar"
480
-  | "mkd"
481
-  | "mlt"
482
-  | "mon"
483
-  | "mri"
484
-  | "msa"
485
-  | "mya"
486
-  | "nep"
487
-  | "nld"
488
-  | "nor"
489
-  | "oci"
490
-  | "ori"
491
-  | "osd"
492
-  | "pan"
493
-  | "pol"
494
-  | "por"
495
-  | "pus"
496
-  | "que"
497
-  | "ron"
498
-  | "rus"
499
-  | "san"
500
-  | "sin"
501
-  | "slk"
502
-  | "slv"
503
-  | "snd"
504
-  | "spa"
505
-  | "spa_old"
506
-  | "sqi"
507
-  | "srp"
508
-  | "srp_latn"
509
-  | "sun"
510
-  | "swa"
511
-  | "swe"
512
-  | "syr"
513
-  | "tam"
514
-  | "tat"
515
-  | "tel"
516
-  | "tgk"
517
-  | "tha"
518
-  | "tir"
519
-  | "ton"
520
-  | "tur"
521
-  | "uig"
522
-  | "ukr"
523
-  | "urd"
524
-  | "uzb"
525
-  | "uzb_cyrl"
526
-  | "vie"
527
-  | "yid"
528
-  | "yor"
529
-// #endregion
530
-
531
-export type Config = Partial<{
532
-  // own options
533
-  binary: string
534
-  debug: boolean
535
-  presets: Preset[] | string[]
536
-  lang: Language | string // alias
537
-
538
-  // CLI options
539
-  // https://github.com/tesseract-ocr/tesseract/blob/master/doc/tesseract.1.asc
540
-  dpi: number
541
-  l: Language | string
542
-  psm: number
543
-  oem: number
544
-  "tessdata-dir": string
545
-  "user-patterns": string
546
-  "user-words": string
547
-
548
-  // any ControlParams
549
-  [key: string]: any
550
-}>
551
-
552
-/**
553
- * @param input - URL, local image path or Buffer
554
- * @param config - any OCR options and control parameters
555
- * @returns default output format is text
556
- */
557
-export function recognize(input: Input, config?: Config): Promise<string>
558
diff --git a/usr/share/lfp/ocr/yarn.lock b/usr/share/lfp/ocr/yarn.lock
559
deleted file mode 100644
560
index 69f4a22..0000000
561
--- a/usr/share/lfp/ocr/yarn.lock
562
+++ /dev/null
563
@@ -1,8 +0,0 @@
564
-# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
565
-# yarn lockfile v1
566
-
567
-
568
-node-tesseract-ocr@^2.2.1:
569
-  version "2.2.1"
570
-  resolved "https://registry.npmjs.org/node-tesseract-ocr/-/node-tesseract-ocr-2.2.1.tgz"
571
-  integrity sha512-Q9cD79JGpPNQBxbi1fV+OAsTxYKLpx22sagsxSyKbu1u+t6UarApf5m32uVc8a5QAP1Wk7fIPN0aJFGGEE9DyQ==