mirror of
https://github.com/onyx-and-iris/simple-recorder.git
synced 2025-08-05 18:51:46 +00:00
Compare commits
14 Commits
130bf74f27
...
eecd51e0ca
Author | SHA1 | Date | |
---|---|---|---|
eecd51e0ca | |||
57f2e9deff | |||
ca7c60f0e4 | |||
c1055408fb | |||
b22f6f6f95 | |||
d2486be29a | |||
3c837f337e | |||
1f49dd961f | |||
59de0fdc4e | |||
ac60cf0c06 | |||
479a447e52 | |||
e8bacd70b6 | |||
5cff6e268a | |||
430aaf5cc5 |
62
.github/workflows/build.yml
vendored
Normal file
62
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
name: Build PYZ
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*.*.*'
|
||||||
|
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up PDM
|
||||||
|
uses: pdm-project/setup-pdm@v4
|
||||||
|
with:
|
||||||
|
python-version: '3.11'
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
pdm sync -d -G build
|
||||||
|
|
||||||
|
- name: Build addon
|
||||||
|
run: pdm run compile
|
||||||
|
|
||||||
|
- name: Upload build artifacts
|
||||||
|
if: success()
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: pyz_build
|
||||||
|
path: ./bin/simple-recorder.pyz
|
||||||
|
|
||||||
|
upload_release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||||
|
needs: build
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Download releases files
|
||||||
|
uses: actions/download-artifact@v4.1.7
|
||||||
|
with:
|
||||||
|
name: pyz_build
|
||||||
|
|
||||||
|
- name: Display structure of downloaded files
|
||||||
|
run: tree
|
||||||
|
|
||||||
|
- name: Release
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
files: simple-recorder.pyz
|
||||||
|
fail_on_unmatched_files: true
|
||||||
|
prerelease: ${{ contains(github.ref, '-') }}
|
26
.github/workflows/release.yml
vendored
Normal file
26
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*.*.*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
pypi-publish:
|
||||||
|
name: upload release to PyPI
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment: pypi
|
||||||
|
permissions:
|
||||||
|
# This permission is needed for private repositories.
|
||||||
|
contents: read
|
||||||
|
# IMPORTANT: this permission is mandatory for trusted publishing
|
||||||
|
id-token: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: pdm-project/setup-pdm@v4
|
||||||
|
|
||||||
|
- name: Publish package distributions to PyPI
|
||||||
|
run: pdm publish
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -162,4 +162,6 @@ cython_debug/
|
|||||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||||
#.idea/
|
#.idea/
|
||||||
|
|
||||||
bin/
|
|
||||||
|
!bin/.gitkeep
|
||||||
|
bin/*
|
10
README.md
10
README.md
@ -58,6 +58,16 @@ Without passing a subcommand (start/stop) a GUI will be launched, otherwise a CL
|
|||||||
|
|
||||||
Just enter the filename and click *Start Recording*.
|
Just enter the filename and click *Start Recording*.
|
||||||
|
|
||||||
|
#### Themes
|
||||||
|
|
||||||
|
Load the GUI with different themes:
|
||||||
|
|
||||||
|
```console
|
||||||
|
simple-recorder --theme="Light Purple"
|
||||||
|
```
|
||||||
|
|
||||||
|
Available themes: Light Purple, Neutral Blue, Reds, Sandy Beach, Kayak, Light Blue 2, Dark Teal1
|
||||||
|
|
||||||
### CLI
|
### CLI
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
0
bin/.gitkeep
Normal file
0
bin/.gitkeep
Normal file
69
pdm.lock
generated
69
pdm.lock
generated
@ -2,14 +2,28 @@
|
|||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
groups = ["default"]
|
groups = ["default", "build"]
|
||||||
strategy = ["inherit_metadata"]
|
strategy = ["inherit_metadata"]
|
||||||
lock_version = "4.5.0"
|
lock_version = "4.5.0"
|
||||||
content_hash = "sha256:7d4367f16062b5a2d661a207b7b33518aaea59371e239b8cf90a5b5b583e1abc"
|
content_hash = "sha256:292c5ea319597e3539895c1ac50004c884c5d46edd5f7b195ede79156558feab"
|
||||||
|
|
||||||
[[metadata.targets]]
|
[[metadata.targets]]
|
||||||
requires_python = ">=3.11"
|
requires_python = ">=3.11"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "click"
|
||||||
|
version = "8.2.1"
|
||||||
|
requires_python = ">=3.10"
|
||||||
|
summary = "Composable command line interface toolkit"
|
||||||
|
groups = ["build"]
|
||||||
|
dependencies = [
|
||||||
|
"colorama; platform_system == \"Windows\"",
|
||||||
|
]
|
||||||
|
files = [
|
||||||
|
{file = "click-8.2.1-py3-none-any.whl", hash = "sha256:61a3265b914e850b85317d0b3109c7f8cd35a670f963866005d6ef1d5175a12b"},
|
||||||
|
{file = "click-8.2.1.tar.gz", hash = "sha256:27c491cc05d968d271d5a1db13e3b5a184636d9d930f148c50b038f0d0646202"},
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clypi"
|
name = "clypi"
|
||||||
version = "1.8.1"
|
version = "1.8.1"
|
||||||
@ -25,6 +39,18 @@ files = [
|
|||||||
{file = "clypi-1.8.1.tar.gz", hash = "sha256:9efa0a5a0e3668dd390e0d90321587dcb8eea12e28facd2ac437383f0de3dc76"},
|
{file = "clypi-1.8.1.tar.gz", hash = "sha256:9efa0a5a0e3668dd390e0d90321587dcb8eea12e28facd2ac437383f0de3dc76"},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "colorama"
|
||||||
|
version = "0.4.6"
|
||||||
|
requires_python = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
|
||||||
|
summary = "Cross-platform colored terminal text."
|
||||||
|
groups = ["build"]
|
||||||
|
marker = "platform_system == \"Windows\""
|
||||||
|
files = [
|
||||||
|
{file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
|
||||||
|
{file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "freesimplegui"
|
name = "freesimplegui"
|
||||||
version = "5.2.0.post1"
|
version = "5.2.0.post1"
|
||||||
@ -50,6 +76,17 @@ files = [
|
|||||||
{file = "obsws_python-1.7.2.tar.gz", hash = "sha256:b5cdaad30fbe1f6d4787b6530048b9882f070c3ee7830abb6dad4a47f84d7fa0"},
|
{file = "obsws_python-1.7.2.tar.gz", hash = "sha256:b5cdaad30fbe1f6d4787b6530048b9882f070c3ee7830abb6dad4a47f84d7fa0"},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pip"
|
||||||
|
version = "25.1.1"
|
||||||
|
requires_python = ">=3.9"
|
||||||
|
summary = "The PyPA recommended tool for installing Python packages."
|
||||||
|
groups = ["build"]
|
||||||
|
files = [
|
||||||
|
{file = "pip-25.1.1-py3-none-any.whl", hash = "sha256:2913a38a2abf4ea6b64ab507bd9e967f3b53dc1ede74b01b0931e1ce548751af"},
|
||||||
|
{file = "pip-25.1.1.tar.gz", hash = "sha256:3de45d411d308d5054c2168185d8da7f9a2cd753dbac8acbfa88a8909ecd9077"},
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "python-dateutil"
|
name = "python-dateutil"
|
||||||
version = "2.9.0.post0"
|
version = "2.9.0.post0"
|
||||||
@ -64,6 +101,34 @@ files = [
|
|||||||
{file = "python_dateutil-2.9.0.post0-py2.py3-none-any.whl", hash = "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427"},
|
{file = "python_dateutil-2.9.0.post0-py2.py3-none-any.whl", hash = "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427"},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "setuptools"
|
||||||
|
version = "80.9.0"
|
||||||
|
requires_python = ">=3.9"
|
||||||
|
summary = "Easily download, build, install, upgrade, and uninstall Python packages"
|
||||||
|
groups = ["build"]
|
||||||
|
files = [
|
||||||
|
{file = "setuptools-80.9.0-py3-none-any.whl", hash = "sha256:062d34222ad13e0cc312a4c02d73f059e86a4acbfbdea8f8f76b28c99f306922"},
|
||||||
|
{file = "setuptools-80.9.0.tar.gz", hash = "sha256:f36b47402ecde768dbfafc46e8e4207b4360c654f1f3bb84475f0a28628fb19c"},
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "shiv"
|
||||||
|
version = "1.0.8"
|
||||||
|
requires_python = ">=3.6"
|
||||||
|
summary = "A command line utility for building fully self contained Python zipapps."
|
||||||
|
groups = ["build"]
|
||||||
|
dependencies = [
|
||||||
|
"click!=7.0,>=6.7",
|
||||||
|
"importlib-resources; python_version < \"3.7\"",
|
||||||
|
"pip>=9.0.3",
|
||||||
|
"setuptools",
|
||||||
|
]
|
||||||
|
files = [
|
||||||
|
{file = "shiv-1.0.8-py2.py3-none-any.whl", hash = "sha256:a60e4b05a2d2f8b820d567b1d89ee59af731759771c32c282d03c4ceae6aba24"},
|
||||||
|
{file = "shiv-1.0.8.tar.gz", hash = "sha256:2a68d69e98ce81cb5b8fdafbfc1e27efa93e6d89ca14bfae33482e4176f561d6"},
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "six"
|
name = "six"
|
||||||
version = "1.17.0"
|
version = "1.17.0"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "simple-recorder"
|
name = "simple-recorder"
|
||||||
version = "0.1.0"
|
version = "0.1.3"
|
||||||
description = "A simple OBS recorder"
|
description = "A simple OBS recorder"
|
||||||
authors = [{ name = "onyx-and-iris", email = "code@onyxandiris.online" }]
|
authors = [{ name = "onyx-and-iris", email = "code@onyxandiris.online" }]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
@ -24,4 +24,10 @@ build-backend = "pdm.backend"
|
|||||||
distribution = true
|
distribution = true
|
||||||
|
|
||||||
[tool.pdm.scripts]
|
[tool.pdm.scripts]
|
||||||
compile = "uvx shiv -c simple-recorder -o bin/simple-recorder.pyz ."
|
compile = "shiv -c simple-recorder -o bin/simple-recorder.pyz ."
|
||||||
|
|
||||||
|
|
||||||
|
[dependency-groups]
|
||||||
|
build = [
|
||||||
|
"shiv>=1.0.8",
|
||||||
|
]
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import logging
|
import logging
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
import clypi
|
||||||
import FreeSimpleGUI as fsg
|
import FreeSimpleGUI as fsg
|
||||||
import obsws_python as obsws
|
import obsws_python as obsws
|
||||||
from clypi import ClypiConfig, ClypiException, Command, Positional, arg, configure
|
from clypi import ClypiConfig, ClypiException, Command, Positional, arg, configure
|
||||||
@ -13,6 +14,9 @@ config = ClypiConfig(
|
|||||||
)
|
)
|
||||||
configure(config)
|
configure(config)
|
||||||
|
|
||||||
|
highlight = clypi.Styler(fg="green")
|
||||||
|
error = clypi.Styler(fg="red", bold=True)
|
||||||
|
|
||||||
|
|
||||||
class Start(Command):
|
class Start(Command):
|
||||||
"""Start recording."""
|
"""Start recording."""
|
||||||
@ -42,12 +46,14 @@ class Start(Command):
|
|||||||
if resp.output_active:
|
if resp.output_active:
|
||||||
raise ClypiException("Recording is already active.")
|
raise ClypiException("Recording is already active.")
|
||||||
|
|
||||||
|
filename = f"{self.filename} {self.get_timestamp()}"
|
||||||
client.set_profile_parameter(
|
client.set_profile_parameter(
|
||||||
"Output",
|
"Output",
|
||||||
"FilenameFormatting",
|
"FilenameFormatting",
|
||||||
f"{self.filename} {self.get_timestamp()}",
|
filename,
|
||||||
)
|
)
|
||||||
client.start_record()
|
client.start_record()
|
||||||
|
print(f"Recording started with filename: {highlight(filename)}")
|
||||||
|
|
||||||
|
|
||||||
class Stop(Command):
|
class Stop(Command):
|
||||||
@ -67,11 +73,20 @@ class Stop(Command):
|
|||||||
raise ClypiException("Recording is not active.")
|
raise ClypiException("Recording is not active.")
|
||||||
|
|
||||||
client.stop_record()
|
client.stop_record()
|
||||||
|
print("Recording stopped successfully.")
|
||||||
|
|
||||||
|
|
||||||
def theme_parser(value: str) -> str:
|
def theme_parser(value: str) -> str:
|
||||||
"""Parse the theme argument."""
|
"""Parse the theme argument."""
|
||||||
themes = ["Light Purple", "Neutral Blue", "Reds", "Sandy Beach"]
|
themes = [
|
||||||
|
"Light Purple",
|
||||||
|
"Neutral Blue",
|
||||||
|
"Reds",
|
||||||
|
"Sandy Beach",
|
||||||
|
"Kayak",
|
||||||
|
"Light Blue 2",
|
||||||
|
"Dark Teal1",
|
||||||
|
]
|
||||||
if value not in themes:
|
if value not in themes:
|
||||||
raise ClypiException(
|
raise ClypiException(
|
||||||
f"Invalid theme: {value}. Available themes: {', '.join(themes)}"
|
f"Invalid theme: {value}. Available themes: {', '.join(themes)}"
|
||||||
@ -141,7 +156,7 @@ class SimpleRecorder(Command):
|
|||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
"""Run the CLI application."""
|
"""Run the application."""
|
||||||
SimpleRecorder.parse().start()
|
SimpleRecorder.parse().start()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user