scribe-cli 0.8.0__tar.gz → 0.9.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. {scribe_cli-0.8.0/scribe_cli.egg-info → scribe_cli-0.9.0}/PKG-INFO +10 -5
  2. {scribe_cli-0.8.0 → scribe_cli-0.9.0}/README.md +9 -4
  3. {scribe_cli-0.8.0 → scribe_cli-0.9.0}/scribe/_version.py +2 -2
  4. {scribe_cli-0.8.0 → scribe_cli-0.9.0}/scribe/app.py +5 -3
  5. {scribe_cli-0.8.0 → scribe_cli-0.9.0}/scribe/install_desktop.py +14 -3
  6. {scribe_cli-0.8.0 → scribe_cli-0.9.0}/scribe/models.py +3 -1
  7. {scribe_cli-0.8.0 → scribe_cli-0.9.0/scribe_cli.egg-info}/PKG-INFO +10 -5
  8. scribe_cli-0.9.0/scribe_data/templates/scribe.desktop +8 -0
  9. scribe_cli-0.8.0/scribe_data/templates/scribe.desktop +0 -8
  10. {scribe_cli-0.8.0 → scribe_cli-0.9.0}/.github/workflows/pypi.yml +0 -0
  11. {scribe_cli-0.8.0 → scribe_cli-0.9.0}/.gitignore +0 -0
  12. {scribe_cli-0.8.0 → scribe_cli-0.9.0}/LICENSE +0 -0
  13. {scribe_cli-0.8.0 → scribe_cli-0.9.0}/icon.xcf +0 -0
  14. {scribe_cli-0.8.0 → scribe_cli-0.9.0}/pyproject.toml +0 -0
  15. {scribe_cli-0.8.0 → scribe_cli-0.9.0}/scribe/__init__.py +0 -0
  16. {scribe_cli-0.8.0 → scribe_cli-0.9.0}/scribe/audio.py +0 -0
  17. {scribe_cli-0.8.0 → scribe_cli-0.9.0}/scribe/keyboard.py +0 -0
  18. {scribe_cli-0.8.0 → scribe_cli-0.9.0}/scribe/models.toml +0 -0
  19. {scribe_cli-0.8.0 → scribe_cli-0.9.0}/scribe/saverecording.py +0 -0
  20. {scribe_cli-0.8.0 → scribe_cli-0.9.0}/scribe/testpynput.py +0 -0
  21. {scribe_cli-0.8.0 → scribe_cli-0.9.0}/scribe/util.py +0 -0
  22. {scribe_cli-0.8.0 → scribe_cli-0.9.0}/scribe_cli.egg-info/SOURCES.txt +0 -0
  23. {scribe_cli-0.8.0 → scribe_cli-0.9.0}/scribe_cli.egg-info/dependency_links.txt +0 -0
  24. {scribe_cli-0.8.0 → scribe_cli-0.9.0}/scribe_cli.egg-info/entry_points.txt +0 -0
  25. {scribe_cli-0.8.0 → scribe_cli-0.9.0}/scribe_cli.egg-info/requires.txt +0 -0
  26. {scribe_cli-0.8.0 → scribe_cli-0.9.0}/scribe_cli.egg-info/top_level.txt +0 -0
  27. {scribe_cli-0.8.0 → scribe_cli-0.9.0}/scribe_data/__init__.py +0 -0
  28. {scribe_cli-0.8.0 → scribe_cli-0.9.0}/scribe_data/share/icon.png +0 -0
  29. {scribe_cli-0.8.0 → scribe_cli-0.9.0}/scribe_data/share/icon_recording.png +0 -0
  30. {scribe_cli-0.8.0 → scribe_cli-0.9.0}/scribe_data/share/icon_writing.png +0 -0
  31. {scribe_cli-0.8.0 → scribe_cli-0.9.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: scribe-cli
3
- Version: 0.8.0
3
+ Version: 0.9.0
4
4
  Summary: scribe is a local speech recognition tool that provides real-time transcription using vosk and whisper AI, with the goal of serving as a virtual keyboard on a computer
5
5
  Author-email: Mahé Perrette <mahe.perrette@gmail.com>
6
6
  License: MIT License
@@ -201,15 +201,20 @@ pip install PyGObject
201
201
  ## Start as an application in GNOME
202
202
 
203
203
  If you run Ubuntu (or else?) with GNOME, the script `scribe-install [...]` will create a `scribe.desktop` file and place it under `$HOME/.local/share/applications`
204
- to make it available from the quick launch menu. Any option will be passed on to `scribe`.
204
+ to make it available from the quick launch menu. Any option will be passed on to `scribe`, with the additional options `--name` and `--no-terminal`.
205
+ `--no-terminal` means no terminal will show up, and it also implies the options `--app --no-prompt`.
205
206
 
206
207
  e.g.
207
208
 
208
209
  ```bash
209
- scribe-install --backend whisper --model small --clipboard --keyboard --restart-after-silence
210
+ scribe-install
211
+ scribe-install --name "Scribe Whisper" --backend whisper --model small --clipboard --restart-after-silence --no-prompt
212
+ scribe-install --name "Scribe Vosk FR" --backend vosk --language fr --keyboard --clipboard --no-terminal
210
213
  ```
211
-
212
- After that just typing Super + scri... at any time from any where will conveniently start the app in its own terminal with the prescribed options.
214
+ This will install three separate apps:
215
+ - `Super + scribe` : will launch the default version with terminal prompt
216
+ - `Super + whisper` : will launch a present version with the `small` model from `whisper` and start recording right away. You can see what is going on in the terminal and the result is ready to paste from the clipboard
217
+ - `Super + vosk fr` : will launch a preset version for real-time transcription in French with the `vosk` backend, and throughput to the clipboard and the keyboard, not even opening a terminal.
213
218
 
214
219
 
215
220
  ## Fine tuning
@@ -138,15 +138,20 @@ pip install PyGObject
138
138
  ## Start as an application in GNOME
139
139
 
140
140
  If you run Ubuntu (or else?) with GNOME, the script `scribe-install [...]` will create a `scribe.desktop` file and place it under `$HOME/.local/share/applications`
141
- to make it available from the quick launch menu. Any option will be passed on to `scribe`.
141
+ to make it available from the quick launch menu. Any option will be passed on to `scribe`, with the additional options `--name` and `--no-terminal`.
142
+ `--no-terminal` means no terminal will show up, and it also implies the options `--app --no-prompt`.
142
143
 
143
144
  e.g.
144
145
 
145
146
  ```bash
146
- scribe-install --backend whisper --model small --clipboard --keyboard --restart-after-silence
147
+ scribe-install
148
+ scribe-install --name "Scribe Whisper" --backend whisper --model small --clipboard --restart-after-silence --no-prompt
149
+ scribe-install --name "Scribe Vosk FR" --backend vosk --language fr --keyboard --clipboard --no-terminal
147
150
  ```
148
-
149
- After that just typing Super + scri... at any time from any where will conveniently start the app in its own terminal with the prescribed options.
151
+ This will install three separate apps:
152
+ - `Super + scribe` : will launch the default version with terminal prompt
153
+ - `Super + whisper` : will launch a present version with the `small` model from `whisper` and start recording right away. You can see what is going on in the terminal and the result is ready to paste from the clipboard
154
+ - `Super + vosk fr` : will launch a preset version for real-time transcription in French with the `vosk` backend, and throughput to the clipboard and the keyboard, not even opening a terminal.
150
155
 
151
156
 
152
157
  ## Fine tuning
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.8.0'
16
- __version_tuple__ = version_tuple = (0, 8, 0)
15
+ __version__ = version = '0.9.0'
16
+ __version_tuple__ = version_tuple = (0, 9, 0)
@@ -301,7 +301,7 @@ def create_app(micro, transcriber, **kwargs):
301
301
  def callback_stop_recording(icon, item):
302
302
  # Here we need to stop the recording thread
303
303
 
304
- transcriber.recording = False
304
+ transcriber.interrupt = True
305
305
  if hasattr(icon, "_recording_thread"):
306
306
  icon._recording_thread.join()
307
307
  if hasattr(icon, "_monitoring_thread"):
@@ -362,13 +362,15 @@ def main(args=None):
362
362
  transcriber = get_transcriber(o, prompt=o.prompt)
363
363
  print(f"Model [{colored(transcriber.model_name, 'light_blue', attrs=['bold'])}] from [{colored(transcriber.backend, 'light_blue', attrs=['bold'])}] selected.")
364
364
  show_output = ["clipboard", "keyboard", "output_file"]
365
- show_options = ["ascii", "app"]
365
+ show_options = ["ascii", "restart_after_silence"]
366
366
  activated_output = [colored(option if type(getattr(o, option)) is bool else f'{option}={getattr(o, option)}', 'light_blue') for option in show_output if getattr(o, option)]
367
367
  activated_options = [colored(option if type(getattr(o, option)) is bool else f'{option}={getattr(o, option)}', 'light_blue') for option in show_options if getattr(o, option)]
368
368
  if activated_output:
369
369
  print(f"Output: {' | '.join(activated_output)}")
370
370
  else:
371
371
  print(colored(f"No output selected -> terminal only", "light_red"))
372
+ if o.app:
373
+ print(colored("App mode enabled", "light_green"))
372
374
  if activated_options:
373
375
  print(f"Options: {' | '.join(activated_options)}")
374
376
  if o.prompt:
@@ -421,7 +423,7 @@ def main(args=None):
421
423
  o.app = not o.app
422
424
  continue
423
425
  if key == "a":
424
- transcriber.restart_after_silence = not transcriber.restart_after_silence
426
+ o.restart_after_silence = transcriber.restart_after_silence = not transcriber.restart_after_silence
425
427
  continue
426
428
  if key == "t":
427
429
  ans = input(f"Enter new duration in seconds (current: {transcriber.timeout}): ")
@@ -10,9 +10,17 @@ def main():
10
10
  sys.exit(0)
11
11
 
12
12
  parser = argparse.ArgumentParser("Install the desktop file for the scribe package. Any arguments to this script will be passed on to `scribe`.")
13
+ parser.add_argument("--name", help="The title of the desktop app", default="Scribe")
14
+ parser.add_argument("--startup-wm-class")
15
+ parser.add_argument("--no-terminal", action="store_false", dest="terminal", help="Don't show the terminal (goes in --app mode)")
13
16
  o, rest = parser.parse_known_args()
14
17
  o.arguments = rest
15
18
 
19
+ if not o.terminal and "--app" not in o.arguments:
20
+ o.arguments.append("--app")
21
+ if not o.terminal and "--no-prompt" not in o.arguments:
22
+ o.arguments.append("--no-prompt")
23
+
16
24
  SOURCE_SCRIBE_DATA = os.path.dirname(scribe_data.__file__)
17
25
 
18
26
  HOME = os.environ.get('HOME',os.path.expanduser('~'))
@@ -25,15 +33,18 @@ def main():
25
33
  with open(os.path.join(SOURCE_SCRIBE_DATA, 'templates', 'scribe.desktop')) as f:
26
34
  template = f.read()
27
35
 
36
+ simple_name = o.name.lower().replace(' ','-').replace(os.path.sep, '-')
28
37
  bin_folder = sysconfig.get_path("scripts")
29
38
  icon_folder = os.path.join(SOURCE_SCRIBE_DATA, 'share')
30
- desktop_filecontent = template.format(icon_folder=icon_folder, bin_folder=bin_folder, options=' '.join(o.arguments) if o.arguments else '')
39
+ desktop_filecontent = template.format(icon_folder=icon_folder, bin_folder=bin_folder,
40
+ name=o.name, terminal=str(o.terminal).lower(),
41
+ StartupWMClass=o.startup_wm_class or f"crx_mpnasdanpmm_{simple_name}",
42
+ options=' ' + ' '.join(o.arguments) if o.arguments else '')
31
43
 
32
- desktop_filepath = os.path.join(XDG_APP_DATA, 'scribe.desktop')
44
+ desktop_filepath = os.path.join(XDG_APP_DATA, f'{simple_name}.desktop')
33
45
  print("Writing GNOME desktop file:", desktop_filepath)
34
46
  with open(desktop_filepath, "w") as f:
35
47
  f.write(desktop_filecontent)
36
48
 
37
-
38
49
  if __name__ == "__main__":
39
50
  main()
@@ -35,6 +35,7 @@ class AbstractTranscriber:
35
35
  self.recording = False
36
36
  self.busy = False
37
37
  self.waiting = False
38
+ self.interrupt = False
38
39
  self.reset()
39
40
 
40
41
  def get_elapsed(self):
@@ -59,6 +60,7 @@ class AbstractTranscriber:
59
60
  stop_message="Done transcribing."):
60
61
 
61
62
  self.reset()
63
+ self.interrupt = False
62
64
  self.recording = True
63
65
  self.waiting = True
64
66
  self.busy = True
@@ -73,7 +75,7 @@ class AbstractTranscriber:
73
75
  with microphone.open_stream():
74
76
  print(start_message)
75
77
 
76
- while self.recording:
78
+ while not self.interrupt:
77
79
  while not microphone.q.empty():
78
80
  data = microphone.q.get()
79
81
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: scribe-cli
3
- Version: 0.8.0
3
+ Version: 0.9.0
4
4
  Summary: scribe is a local speech recognition tool that provides real-time transcription using vosk and whisper AI, with the goal of serving as a virtual keyboard on a computer
5
5
  Author-email: Mahé Perrette <mahe.perrette@gmail.com>
6
6
  License: MIT License
@@ -201,15 +201,20 @@ pip install PyGObject
201
201
  ## Start as an application in GNOME
202
202
 
203
203
  If you run Ubuntu (or else?) with GNOME, the script `scribe-install [...]` will create a `scribe.desktop` file and place it under `$HOME/.local/share/applications`
204
- to make it available from the quick launch menu. Any option will be passed on to `scribe`.
204
+ to make it available from the quick launch menu. Any option will be passed on to `scribe`, with the additional options `--name` and `--no-terminal`.
205
+ `--no-terminal` means no terminal will show up, and it also implies the options `--app --no-prompt`.
205
206
 
206
207
  e.g.
207
208
 
208
209
  ```bash
209
- scribe-install --backend whisper --model small --clipboard --keyboard --restart-after-silence
210
+ scribe-install
211
+ scribe-install --name "Scribe Whisper" --backend whisper --model small --clipboard --restart-after-silence --no-prompt
212
+ scribe-install --name "Scribe Vosk FR" --backend vosk --language fr --keyboard --clipboard --no-terminal
210
213
  ```
211
-
212
- After that just typing Super + scri... at any time from any where will conveniently start the app in its own terminal with the prescribed options.
214
+ This will install three separate apps:
215
+ - `Super + scribe` : will launch the default version with terminal prompt
216
+ - `Super + whisper` : will launch a present version with the `small` model from `whisper` and start recording right away. You can see what is going on in the terminal and the result is ready to paste from the clipboard
217
+ - `Super + vosk fr` : will launch a preset version for real-time transcription in French with the `vosk` backend, and throughput to the clipboard and the keyboard, not even opening a terminal.
213
218
 
214
219
 
215
220
  ## Fine tuning
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env xdg-open
2
+ [Desktop Entry]
3
+ Terminal={terminal}
4
+ Type=Application
5
+ Name={name}
6
+ Exec={bin_folder}/scribe{options}
7
+ Icon={icon_folder}/icon.png
8
+ StartupWMClass={StartupWMClass}
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env xdg-open
2
- [Desktop Entry]
3
- Terminal=true
4
- Type=Application
5
- Name=Scribe
6
- Exec={bin_folder}/scribe{options}
7
- Icon={icon_folder}/icon.jpg
8
- StartupWMClass=crx_mpnasdanpmmopoasdjdcgaaiekailkhb
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes