mirror of
https://github.com/onyx-and-iris/simple-recorder.git
synced 2026-04-21 00:33:36 +00:00
Compare commits
10 Commits
v0.3.0
...
b7c25525a1
| Author | SHA1 | Date | |
|---|---|---|---|
| b7c25525a1 | |||
| c39b909d11 | |||
| 856ab6cbec | |||
| c7baa9ffd6 | |||
| d0401d0457 | |||
| 8813c25819 | |||
| 6035e09e43 | |||
| 0fe22debb6 | |||
| d8d7fce5cc | |||
| ca7604c279 |
85
README.md
85
README.md
@@ -28,7 +28,18 @@ pipx install simple-recorder
|
||||
|
||||
*with pyz*
|
||||
|
||||
An executable pyz has been included in [Releases](https://github.com/onyx-and-iris/simple-recorder/releases) which you can run in Windows. Follow the steps in this [Setting up Windows for Zipapps](https://jhermann.github.io/blog/python/deployment/2020/02/29/python_zippapps_on_windows.html#Setting-Up-Windows-10-for-Zipapps) guide.
|
||||
- Download the pyz file in [Releases](https://github.com/onyx-and-iris/simple-recorder/releases)
|
||||
- Optional step: for automatic discovery of the pyz file follow this guide on [Setting Up Windows for Zippapps](https://jhermann.github.io/blog/python/deployment/2020/02/29/python_zippapps_on_windows.html#Setting-Up-Windows-10-for-Zipapps)
|
||||
|
||||
Finally run the pyz with python (CLI)/pythonw (GUI):
|
||||
|
||||
```console
|
||||
python simple-recorder.pyz <subcommand>
|
||||
|
||||
pythonw simple-recorder.pyz
|
||||
```
|
||||
|
||||
note, the pyz extension won't be required if you followed the optional step and made it discoverable.
|
||||
|
||||
## Configuration
|
||||
|
||||
@@ -49,12 +60,44 @@ OBS_THEME=Reds
|
||||
|
||||
## Use
|
||||
|
||||
### GUI
|
||||
### CLI
|
||||
|
||||
To launch the GUI run the root command without any subcommands:
|
||||
To launch the CLI:
|
||||
|
||||
```console
|
||||
simple-recorder
|
||||
simple-recorder start "File Name"
|
||||
|
||||
simple-recorder stop
|
||||
```
|
||||
|
||||
#### Commands:
|
||||
|
||||
```shell
|
||||
Usage: simple-recorder [OPTIONS] COMMAND
|
||||
|
||||
┏━ Subcommands ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ start Start recording ┃
|
||||
┃ stop Stop recording ┃
|
||||
┃ pause Pause recording ┃
|
||||
┃ resume Resume recording ┃
|
||||
┃ directory Get or set the recording directory ┃
|
||||
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
||||
|
||||
┏━ Options ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ --host <HOST> OBS WebSocket host ┃
|
||||
┃ --port <PORT> OBS WebSocket port ┃
|
||||
┃ --password <PASSWORD> OBS WebSocket password ┃
|
||||
┃ --theme <THEME> GUI theme (Light Purple, Neutral Blue, Reds, Sandy Beach, ┃
|
||||
┃ Kayak, Light Blue 2) ┃
|
||||
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
||||
```
|
||||
|
||||
### GUI
|
||||
|
||||
To launch the GUI:
|
||||
|
||||
```console
|
||||
simple-recorder-gui
|
||||
```
|
||||
|
||||

|
||||
@@ -66,39 +109,7 @@ Just enter the filename and click *Start*.
|
||||
You can change the colour theme with the --theme option:
|
||||
|
||||
```console
|
||||
simple-recorder --theme="Light Purple"
|
||||
simple-recorder-gui --theme="Light Purple"
|
||||
```
|
||||
|
||||
### CLI
|
||||
|
||||
```shell
|
||||
Usage: simple-recorder [OPTIONS] COMMAND
|
||||
|
||||
┏━ Subcommands ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ start Start recording ┃
|
||||
┃ stop Stop recording ┃
|
||||
┃ pause Pause recording ┃
|
||||
┃ resume Resume recording ┃
|
||||
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
||||
|
||||
┏━ Options ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃ --host <HOST> OBS WebSocket host ┃
|
||||
┃ --port <PORT> OBS WebSocket port ┃
|
||||
┃ --password <PASSWORD> OBS WebSocket password ┃
|
||||
┃ --theme <THEME> GUI theme (Light Purple, Neutral Blue, Reds, Sandy Beach, ┃
|
||||
┃ Kayak, Light Blue 2) ┃
|
||||
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
||||
```
|
||||
|
||||
To launch the CLI pass any subcommand (start/stop etc...), for example:
|
||||
|
||||
```console
|
||||
simple-recorder start "File Name"
|
||||
|
||||
simple-recorder stop
|
||||
```
|
||||
|
||||
- If no filename is passed to start then you will be prompted for one.
|
||||
- A default_name will be used if none is supplied to the prompt.
|
||||
|
||||
[obs-studio]: https://obsproject.com/
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 78 KiB |
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "simple-recorder"
|
||||
version = "0.3.0"
|
||||
version = "0.3.5"
|
||||
description = "A simple OBS recorder"
|
||||
authors = [{ name = "onyx-and-iris", email = "code@onyxandiris.online" }]
|
||||
dependencies = [
|
||||
@@ -15,6 +15,9 @@ license = { text = "MIT" }
|
||||
[project.scripts]
|
||||
simple-recorder = "simple_recorder:run"
|
||||
|
||||
[project.gui-scripts]
|
||||
simple-recorder-gui = "simple_recorder:run"
|
||||
|
||||
[build-system]
|
||||
requires = ["pdm-backend"]
|
||||
build-backend = "pdm.backend"
|
||||
@@ -28,6 +31,4 @@ compile = "shiv -c simple-recorder -o bin/simple-recorder.pyz ."
|
||||
|
||||
|
||||
[dependency-groups]
|
||||
build = [
|
||||
"shiv>=1.0.8",
|
||||
]
|
||||
build = ["shiv>=1.0.8"]
|
||||
|
||||
@@ -21,7 +21,7 @@ class Directory(Command):
|
||||
async def run(self):
|
||||
try:
|
||||
with obsws.ReqClient(
|
||||
host=self.host, port=self.port, password=self.password
|
||||
host=self.host, port=self.port, password=self.password, timeout=3
|
||||
) as client:
|
||||
if self.directory:
|
||||
client.set_record_directory(self.directory)
|
||||
@@ -32,5 +32,5 @@ class Directory(Command):
|
||||
f"Current recording directory: {highlight(resp.record_directory)}"
|
||||
)
|
||||
return resp.record_directory
|
||||
except Exception as e:
|
||||
raise SimpleRecorderError(f"Failed to get recording directory: {e}")
|
||||
except (ConnectionRefusedError, TimeoutError):
|
||||
raise SimpleRecorderError("Failed to connect to OBS. Is it running?")
|
||||
|
||||
@@ -31,6 +31,7 @@ class SimpleRecorderWindow(fsg.Window):
|
||||
current_directory = resp.record_directory
|
||||
except (ConnectionRefusedError, TimeoutError):
|
||||
status_message = "Failed to connect to OBS. Is it running?"
|
||||
current_directory = ""
|
||||
|
||||
recorder_layout = [
|
||||
[fsg.Text("Enter recording filename:", key="-PROMPT-")],
|
||||
@@ -102,6 +103,9 @@ class SimpleRecorderWindow(fsg.Window):
|
||||
self["Add Chapter"].bind("<Leave>", " || LEAVE")
|
||||
self["Add Chapter"].bind("<Button-3>", " || RIGHT_CLICK")
|
||||
|
||||
self["-GET-CURRENT-"].bind("<Return>", " || RETURN")
|
||||
self["-UPDATE-"].bind("<Return>", " || RETURN")
|
||||
|
||||
async def run(self):
|
||||
while True:
|
||||
event, values = self.read()
|
||||
@@ -185,7 +189,7 @@ class SimpleRecorderWindow(fsg.Window):
|
||||
"This feature is not implemented yet", text_color="orange"
|
||||
)
|
||||
|
||||
case ["-GET-CURRENT-"]:
|
||||
case ["-GET-CURRENT-"] | ["-GET-CURRENT-", "RETURN"]:
|
||||
try:
|
||||
current_directory = await Directory(
|
||||
host=self.host, port=self.port, password=self.password
|
||||
@@ -196,7 +200,7 @@ class SimpleRecorderWindow(fsg.Window):
|
||||
f"Error: {e.raw_message}", text_color="red"
|
||||
)
|
||||
|
||||
case ["-UPDATE-"]:
|
||||
case ["-UPDATE-"] | ["-UPDATE-", "RETURN"]:
|
||||
filepath = values["-FILEPATH-"]
|
||||
if not filepath:
|
||||
self["-OUTPUT-SETTINGS-"].update(
|
||||
|
||||
@@ -26,5 +26,5 @@ class Pause(Command):
|
||||
|
||||
client.pause_record()
|
||||
print("Recording paused successfully.")
|
||||
except TimeoutError:
|
||||
except (ConnectionRefusedError, TimeoutError):
|
||||
raise SimpleRecorderError("Failed to connect to OBS. Is it running?")
|
||||
|
||||
@@ -26,5 +26,5 @@ class Resume(Command):
|
||||
|
||||
client.resume_record()
|
||||
print("Recording resumed successfully.")
|
||||
except TimeoutError:
|
||||
except (ConnectionRefusedError, TimeoutError):
|
||||
raise SimpleRecorderError("Failed to connect to OBS. Is it running?")
|
||||
|
||||
@@ -45,5 +45,5 @@ class Start(Command):
|
||||
)
|
||||
client.start_record()
|
||||
print(f"Recording started with filename: {highlight(filename)}")
|
||||
except TimeoutError:
|
||||
except (ConnectionRefusedError, TimeoutError):
|
||||
raise SimpleRecorderError("Failed to connect to OBS. Is it running?")
|
||||
|
||||
@@ -25,5 +25,5 @@ class Stop(Command):
|
||||
|
||||
client.stop_record()
|
||||
print(highlight("Recording stopped successfully."))
|
||||
except TimeoutError:
|
||||
except (ConnectionRefusedError, TimeoutError):
|
||||
raise SimpleRecorderError("Failed to connect to OBS. Is it running?")
|
||||
|
||||
Reference in New Issue
Block a user