lfp


Logs | Files | README | README | LICENSE | GitLab


1
commit f3c10e13202cd2d445bf6e9878b4b1b5eb42c430
2
Author: Connor Etherington <[email protected]>
3
Date:   Tue Apr 16 10:32:40 2024 +0200
4
5
    Auto-Commit Update - 20240416
6
---
7
 PKGBUILD                                           |   2 +-
8
 README.md                                          |   2 +-
9
 lfp-4.2.1-1-x86_64.deb                             | Bin 71028 -> 0 bytes
10
 lfp-4.2.1-1-x86_64/usr/share/lfp/lfp-functions     |  15 ------
11
 lfp-4.2.2-1-x86_64.deb                             | Bin 0 -> 71216 bytes
12
 .../DEBIAN/control                                 |   2 +-
13
 .../postinst                                       |   0
14
 .../usr/bin/lfp                                    |   0
15
 .../usr/share/doc/lfp/README.md                    |   2 +-
16
 .../usr/share/lfp/cleaner                          |   0
17
 .../usr/share/lfp/lfp                              |   0
18
 .../usr/share/lfp/lfp-icons                        |   3 +-
19
 .../usr/share/lfp/lfpcd                            |   0
20
 .../usr/share/lfp/lfprc                            |  20 +++++++-
21
 ...-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | Bin
22
 .../usr/share/lfp/ocr/ocr.js                       |  52 +++++++++++++++++----
23
 .../usr/share/lfp/ocr/package.json                 |   3 +-
24
 .../usr/share/lfp/ocr/tesseract.js                 |   0
25
 .../usr/share/lfp/scope                            |   0
26
 .../usr/share/licenses/lfp/LICENSE                 |   0
27
 .../usr/share/man/man1/lfp.1.gz                    | Bin
28
 .../lfpreviewer-1.0.1-cp311-cp311-linux_x86_64.whl | Bin 0 -> 53330 bytes
29
 ...-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | Bin 0 -> 59525 bytes
30
 usr/share/doc/lfp/README.md                        |   2 +-
31
 usr/share/lfp/lfprc                                |   1 +
32
 25 files changed, 72 insertions(+), 32 deletions(-)
33
34
diff --git a/PKGBUILD b/PKGBUILD
35
index f4d0e80..81418a3 100644
36
--- a/PKGBUILD
37
+++ b/PKGBUILD
38
@@ -1,7 +1,7 @@
39
 # Maintainer: Connor Etherington <[email protected]>
40
 # ---
41
 pkgname=lfp
42
-pkgver=4.2.1
43
+pkgver=4.2.2
44
 pkgrel=1
45
 pkgdesc='A wrapper for the lf file manager with in-terminal media previews, on-exit directory changing and much more'
46
 license=('MIT')
47
diff --git a/README.md b/README.md
48
index 0a0f4f6..32f2f84 100644
49
--- a/README.md
50
+++ b/README.md
51
@@ -4,7 +4,7 @@
52
 ### `lfp` is a simple wrapper for the `lf` file manager, with built-in file, image, and video previews, as well as on-exit directory changing.
53
 ### The program makes use of `ueberzug` to preview images, documents, and video thumbnails. Preview behavior can be altered by editing the *scope* file.
54
 
55
-**Version: 4.2.1**
56
+**Version: 4.2.2**
57
 
58
 ***
59
 
60
diff --git a/lfp-4.2.1-1-x86_64.deb b/lfp-4.2.1-1-x86_64.deb
61
deleted file mode 100644
62
index 1cb87e8..0000000
63
Binary files a/lfp-4.2.1-1-x86_64.deb and /dev/null differ
64
diff --git a/lfp-4.2.1-1-x86_64/usr/share/lfp/lfp-functions b/lfp-4.2.1-1-x86_64/usr/share/lfp/lfp-functions
65
deleted file mode 100755
66
index abbb0c2..0000000
67
--- a/lfp-4.2.1-1-x86_64/usr/share/lfp/lfp-functions
68
+++ /dev/null
69
@@ -1,15 +0,0 @@
70
-#!/usr/bin/env bash
71
-
72
-lfp-newPyEnv(){
73
-  which mamba >/dev/null 2>&1 && tool=mamba || tool=conda
74
-  $tool create -p ./.🐍 -y -c conda-forge python=3.10 pynvim && notify-send "Conda Environment Created at ./.🐍" || {
75
-    notify-send "🐍 Environment Creation Failed"
76
-    return 1
77
-  }
78
-
79
-  conda activate ./.🐍 && {
80
-    notify-send "🐍 Environment Activation Failed"
81
-    return 1
82
-   }
83
-}
84
-
85
diff --git a/lfp-4.2.2-1-x86_64.deb b/lfp-4.2.2-1-x86_64.deb
86
new file mode 100644
87
index 0000000..1d59eeb
88
Binary files /dev/null and b/lfp-4.2.2-1-x86_64.deb differ
89
diff --git a/lfp-4.2.1-1-x86_64/DEBIAN/control b/lfp-4.2.2-1-x86_64/DEBIAN/control
90
similarity index 97%
91
rename from lfp-4.2.1-1-x86_64/DEBIAN/control
92
rename to lfp-4.2.2-1-x86_64/DEBIAN/control
93
index e1ea395..597094d 100644
94
--- a/lfp-4.2.1-1-x86_64/DEBIAN/control
95
+++ b/lfp-4.2.2-1-x86_64/DEBIAN/control
96
@@ -1,5 +1,5 @@
97
 Package: lfp
98
-Version: 4.2.1
99
+Version: 4.2.2
100
 Maintainer: © Connor Etherington <[email protected]>
101
 Depends: lf, zsh, ffmpeg, graphicsmagick, openslide-tools, ghostscript, bat, fzf, dunst, dialog, xsel, lolcat, python3, python3-docopt, python3-pillow, python3-attr, libxres-dev, python3-setuptools, python3-pip, nodejs
102
 Architecture: amd64
103
diff --git a/lfp-4.2.1-1-x86_64/postinst b/lfp-4.2.2-1-x86_64/postinst
104
similarity index 100%
105
rename from lfp-4.2.1-1-x86_64/postinst
106
rename to lfp-4.2.2-1-x86_64/postinst
107
diff --git a/lfp-4.2.1-1-x86_64/usr/bin/lfp b/lfp-4.2.2-1-x86_64/usr/bin/lfp
108
similarity index 100%
109
rename from lfp-4.2.1-1-x86_64/usr/bin/lfp
110
rename to lfp-4.2.2-1-x86_64/usr/bin/lfp
111
diff --git a/lfp-4.2.1-1-x86_64/usr/share/doc/lfp/README.md b/lfp-4.2.2-1-x86_64/usr/share/doc/lfp/README.md
112
similarity index 99%
113
rename from lfp-4.2.1-1-x86_64/usr/share/doc/lfp/README.md
114
rename to lfp-4.2.2-1-x86_64/usr/share/doc/lfp/README.md
115
index ea36087..da97348 100644
116
--- a/lfp-4.2.1-1-x86_64/usr/share/doc/lfp/README.md
117
+++ b/lfp-4.2.2-1-x86_64/usr/share/doc/lfp/README.md
118
@@ -4,7 +4,7 @@
119
 ### `lfp` is a simple wrapper for the `lf` file manager, with built-in file, image, and video previews, as well as on-exit directory changing.
120
 ### The program makes use of `ueberzug` to preview images, documents, and video thumbnails. Preview behavior can be altered by editing the *scope* file.
121
 
122
-**Version: 4.1.7**
123
+**Version: 4.2.2**
124
 
125
 ***
126
 
127
diff --git a/lfp-4.2.1-1-x86_64/usr/share/lfp/cleaner b/lfp-4.2.2-1-x86_64/usr/share/lfp/cleaner
128
similarity index 100%
129
rename from lfp-4.2.1-1-x86_64/usr/share/lfp/cleaner
130
rename to lfp-4.2.2-1-x86_64/usr/share/lfp/cleaner
131
diff --git a/lfp-4.2.1-1-x86_64/usr/share/lfp/lfp b/lfp-4.2.2-1-x86_64/usr/share/lfp/lfp
132
similarity index 100%
133
rename from lfp-4.2.1-1-x86_64/usr/share/lfp/lfp
134
rename to lfp-4.2.2-1-x86_64/usr/share/lfp/lfp
135
diff --git a/lfp-4.2.1-1-x86_64/usr/share/lfp/lfp-icons b/lfp-4.2.2-1-x86_64/usr/share/lfp/lfp-icons
136
similarity index 98%
137
rename from lfp-4.2.1-1-x86_64/usr/share/lfp/lfp-icons
138
rename to lfp-4.2.2-1-x86_64/usr/share/lfp/lfp-icons
139
index a562be0..0d574ae 100644
140
--- a/lfp-4.2.1-1-x86_64/usr/share/lfp/lfp-icons
141
+++ b/lfp-4.2.2-1-x86_64/usr/share/lfp/lfp-icons
142
@@ -7,7 +7,7 @@ tw=🤝:\
143
 ow=📂:\
144
 ln=⛓:\
145
 or=❌:\
146
-ex=󰜫:\
147
+ex=⌬:\
148
 *.gitkeep=:\
149
 *.gitignore=:\
150
 *.col=🔰:\
151
@@ -23,6 +23,7 @@ ex=󰜫:\
152
 *.scss=:\
153
 *.less=:\
154
 *.vim=:\
155
+*.deb=:\
156
 *.c=🅒:\
157
 *.h=🅗:\
158
 *.cpp=🅒:\
159
diff --git a/lfp-4.2.1-1-x86_64/usr/share/lfp/lfpcd b/lfp-4.2.2-1-x86_64/usr/share/lfp/lfpcd
160
similarity index 100%
161
rename from lfp-4.2.1-1-x86_64/usr/share/lfp/lfpcd
162
rename to lfp-4.2.2-1-x86_64/usr/share/lfp/lfpcd
163
diff --git a/lfp-4.2.1-1-x86_64/usr/share/lfp/lfprc b/lfp-4.2.2-1-x86_64/usr/share/lfp/lfprc
164
old mode 100644
165
new mode 100755
166
similarity index 98%
167
rename from lfp-4.2.1-1-x86_64/usr/share/lfp/lfprc
168
rename to lfp-4.2.2-1-x86_64/usr/share/lfp/lfprc
169
index 1b36152..27f8a07
170
--- a/lfp-4.2.1-1-x86_64/usr/share/lfp/lfprc
171
+++ b/lfp-4.2.2-1-x86_64/usr/share/lfp/lfprc
172
@@ -7,7 +7,7 @@ set period 1
173
 set shell bash
174
 set scrolloff 10
175
 set drawbox true
176
-set hiddenfiles ".*:*.aux:*.bbl:*.bcf:*.blg:*.run.xml:yarn.lock:package-lock.json"
177
+set hiddenfiles ".*:*.aux:*.bbl:*.bcf:*.blg:*.run.xml:yarn.lock:package-lock.json:pnpm-lock.yaml:node_modules"
178
 set shellopts '-eu'
179
 set ifs "\n"
180
 
181
@@ -482,6 +482,7 @@ cmd ext ${{
182
       *.gz)        gunzip  ${ARG} && SUCC || FAIL ;;
183
       *.tgz)       tar xzf ${ARG} && SUCC || FAIL ;;
184
       *.zip)       unzip ${ARG} && SUCC || FAIL ;;
185
+      *.whl)       unzip ${ARG} && SUCC || FAIL ;;
186
       *.Z)         uncompress ${ARG} && SUCC || FAIL ;;
187
       *.7z)        7z x ${ARG} && SUCC || FAIL ;;
188
       *.deb)       ar x ${ARG} && SUCC || FAIL ;;
189
@@ -499,8 +500,23 @@ cmd setbg "$1"
190
 cmd bulkrename $vidir
191
 
192
 cmd ocr ${{
193
-  node /usr/share/lfp/ocr/ocr.js $fx
194
+  result=${result:-}
195
+  for x in ${fx[@]}; do
196
+    node /usr/share/lfp/ocr/ocr.js $x
197
+    result="$(cat << EOF
198
+$result
199
+
200
+
201
+
202
+$(basename $x):
203
+----------------
204
+$(xsel -bo)
205
+EOF
206
+    )"
207
+  done
208
   notify-send "🔧 OCR Complete" "Text copied to clipboard."
209
+  [[ -n $result ]] && echo -e "$result" | awk '/./,EOF' | tac | awk '/./,EOF' | tac | xsel -bi
210
+  [[ -n $result ]] && echo -e "$result" | awk '/./,EOF' | tac | awk '/./,EOF' | tac | less --use-color +%
211
 }}
212
 
213
 
214
diff --git a/lfp-4.2.1-1-x86_64/usr/share/lfp/lfpreviewer-1.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl b/lfp-4.2.2-1-x86_64/usr/share/lfp/lfpreviewer-1.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
215
similarity index 100%
216
rename from lfp-4.2.1-1-x86_64/usr/share/lfp/lfpreviewer-1.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
217
rename to lfp-4.2.2-1-x86_64/usr/share/lfp/lfpreviewer-1.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
218
diff --git a/lfp-4.2.1-1-x86_64/usr/share/lfp/ocr/ocr.js b/lfp-4.2.2-1-x86_64/usr/share/lfp/ocr/ocr.js
219
similarity index 61%
220
rename from lfp-4.2.1-1-x86_64/usr/share/lfp/ocr/ocr.js
221
rename to lfp-4.2.2-1-x86_64/usr/share/lfp/ocr/ocr.js
222
index 4604522..bef2825 100755
223
--- a/lfp-4.2.1-1-x86_64/usr/share/lfp/ocr/ocr.js
224
+++ b/lfp-4.2.2-1-x86_64/usr/share/lfp/ocr/ocr.js
225
@@ -3,7 +3,8 @@
226
 const fs = require('fs');
227
 const fsp = require('fs').promises;
228
 const path = require('path');
229
-const tesseract = require('./tesseract');
230
+const scriptDir = path.dirname(require.main.filename);
231
+const tesseract = require(path.join(scriptDir, 'tesseract.js'));
232
 const { spawn } = require('child_process');
233
 
234
 const green = '\x1b[32m';
235
@@ -26,19 +27,54 @@ let fail = false;
236
 
237
 const ocr = async (imagePath) => {
238
   const Type = await sh(`file -b --mime-type ${imagePath}`);
239
-  if (await sh(`file -bL --mime-encoding ${imagePath}`) === 'utf-8') {
240
-    return await fsp.readFile(imagePath, 'utf8');
241
+  if(Type === 'PNG image data' || Type === 'JPEG image data' || Type === 'TIFF image data' || Type === 'image/x-portable-bitmap' || Type === 'image/png' || Type === 'image/jpeg' || Type === 'image/tiff' || Type === 'PC bitmap') {
242
+
243
+    let binary = require('child_process').exec('which tesseract', (err, stdout, stderr) => {
244
+      if (err) {
245
+        console.error('\n\x1b[31m[-]\x1b[0m Fatal Error: Tesseract not found...');
246
+        process.exit(1);
247
+      }
248
+      if (stdout === '') {
249
+        console.error('\n\x1b[31m[-]\x1b[0m Fatal Error: Tesseract not found...');
250
+        process.exit(1);
251
+      }
252
+      if (stderr) {
253
+        console.error(stderr);
254
+        process.exit(1);
255
+      }
256
+    });
257
+
258
+    const image = await fsp.readFile(imagePath);
259
+    return await tesseract.recognize(image, config);
260
+
261
   } else if (Type === 'PDF document') {
262
+
263
+    let binary = require('child_process').exec('which tesseract', (err, stdout, stderr) => {
264
+      if (err) {
265
+        console.error('\n\x1b[31m[-]\x1b[0m Fatal Error: Tesseract not found...');
266
+        process.exit(1);
267
+      }
268
+      if (stdout === '') {
269
+        console.error('\n\x1b[31m[-]\x1b[0m Fatal Error: Tesseract not found...');
270
+        process.exit(1);
271
+      }
272
+      if (stderr) {
273
+        console.error(stderr);
274
+        process.exit(1);
275
+      }
276
+    });
277
+
278
     await sh(`convert ${imagePath} -background white ${imagePath}.png`);
279
     const res = await tesseract.recognize(`${imagePath}.png`, config);
280
     await fs.unlinkSync(`${imagePath}.png`);
281
     return res;
282
-  } else if(Type === 'PNG image data' || Type === 'JPEG image data' || Type === 'TIFF image data' || Type === 'image/x-portable-bitmap' || Type === 'image/png' || Type === 'image/jpeg' || Type === 'image/tiff' || Type === 'PC bitmap') {
283
-    const image = await fsp.readFile(imagePath);
284
-    return await tesseract.recognize(image, config);
285
   } else {
286
-    fail = true;
287
-    throw new Error('Unknown image type');
288
+    try {
289
+      return await fsp.readFile(imagePath, 'utf8');
290
+    } catch (err) {
291
+      fail = true;
292
+      throw new Error('Unknown image type');
293
+    }
294
   }
295
 }
296
 
297
diff --git a/lfp-4.2.1-1-x86_64/usr/share/lfp/ocr/package.json b/lfp-4.2.2-1-x86_64/usr/share/lfp/ocr/package.json
298
similarity index 85%
299
rename from lfp-4.2.1-1-x86_64/usr/share/lfp/ocr/package.json
300
rename to lfp-4.2.2-1-x86_64/usr/share/lfp/ocr/package.json
301
index 0b24c3c..bbbb8cd 100644
302
--- a/lfp-4.2.1-1-x86_64/usr/share/lfp/ocr/package.json
303
+++ b/lfp-4.2.2-1-x86_64/usr/share/lfp/ocr/package.json
304
@@ -1,6 +1,6 @@
305
 {
306
   "name": "lfp-ocr",
307
-  "version": "0.2.0",
308
+  "version": "0.2.1",
309
   "description": "",
310
   "main": "ocr.js",
311
   "scripts": {
312
@@ -17,6 +17,7 @@
313
   "author": "Connor Etherington <[email protected]",
314
   "license": "MIT",
315
   "dependencies": {
316
+    "node-tesseract-ocr": "^2.2.1",
317
     "shx": "^0.3.4"
318
   }
319
 }
320
diff --git a/lfp-4.2.1-1-x86_64/usr/share/lfp/ocr/tesseract.js b/lfp-4.2.2-1-x86_64/usr/share/lfp/ocr/tesseract.js
321
similarity index 100%
322
rename from lfp-4.2.1-1-x86_64/usr/share/lfp/ocr/tesseract.js
323
rename to lfp-4.2.2-1-x86_64/usr/share/lfp/ocr/tesseract.js
324
diff --git a/lfp-4.2.1-1-x86_64/usr/share/lfp/scope b/lfp-4.2.2-1-x86_64/usr/share/lfp/scope
325
similarity index 100%
326
rename from lfp-4.2.1-1-x86_64/usr/share/lfp/scope
327
rename to lfp-4.2.2-1-x86_64/usr/share/lfp/scope
328
diff --git a/lfp-4.2.1-1-x86_64/usr/share/licenses/lfp/LICENSE b/lfp-4.2.2-1-x86_64/usr/share/licenses/lfp/LICENSE
329
similarity index 100%
330
rename from lfp-4.2.1-1-x86_64/usr/share/licenses/lfp/LICENSE
331
rename to lfp-4.2.2-1-x86_64/usr/share/licenses/lfp/LICENSE
332
diff --git a/lfp-4.2.1-1-x86_64/usr/share/man/man1/lfp.1.gz b/lfp-4.2.2-1-x86_64/usr/share/man/man1/lfp.1.gz
333
similarity index 100%
334
rename from lfp-4.2.1-1-x86_64/usr/share/man/man1/lfp.1.gz
335
rename to lfp-4.2.2-1-x86_64/usr/share/man/man1/lfp.1.gz
336
diff --git a/lfpreviewer/dist/lfpreviewer-1.0.1-cp311-cp311-linux_x86_64.whl b/lfpreviewer/dist/lfpreviewer-1.0.1-cp311-cp311-linux_x86_64.whl
337
new file mode 100644
338
index 0000000..92e4cd2
339
Binary files /dev/null and b/lfpreviewer/dist/lfpreviewer-1.0.1-cp311-cp311-linux_x86_64.whl differ
340
diff --git a/lfpreviewer/dist/lfpreviewer-1.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl b/lfpreviewer/dist/lfpreviewer-1.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
341
new file mode 100644
342
index 0000000..7408f51
343
Binary files /dev/null and b/lfpreviewer/dist/lfpreviewer-1.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl differ
344
diff --git a/usr/share/doc/lfp/README.md b/usr/share/doc/lfp/README.md
345
index 0c3dae2..da97348 100644
346
--- a/usr/share/doc/lfp/README.md
347
+++ b/usr/share/doc/lfp/README.md
348
@@ -4,7 +4,7 @@
349
 ### `lfp` is a simple wrapper for the `lf` file manager, with built-in file, image, and video previews, as well as on-exit directory changing.
350
 ### The program makes use of `ueberzug` to preview images, documents, and video thumbnails. Preview behavior can be altered by editing the *scope* file.
351
 
352
-**Version: 4.2.1**
353
+**Version: 4.2.2**
354
 
355
 ***
356
 
357
diff --git a/usr/share/lfp/lfprc b/usr/share/lfp/lfprc
358
index e98b236..27f8a07 100755
359
--- a/usr/share/lfp/lfprc
360
+++ b/usr/share/lfp/lfprc
361
@@ -515,6 +515,7 @@ EOF
362
     )"
363
   done
364
   notify-send "🔧 OCR Complete" "Text copied to clipboard."
365
+  [[ -n $result ]] && echo -e "$result" | awk '/./,EOF' | tac | awk '/./,EOF' | tac | xsel -bi
366
   [[ -n $result ]] && echo -e "$result" | awk '/./,EOF' | tac | awk '/./,EOF' | tac | less --use-color +%
367
 }}
368