Make it a proper python module

This commit is contained in:
Jeena 2025-06-02 06:56:36 +09:00
parent 83a32712f9
commit 450de98d32
10 changed files with 160 additions and 42 deletions

View file

@ -18,17 +18,25 @@ optdepends=(
'libcanberra: play system notification sounds'
'sound-theme-freedesktop: standard system sounds like "complete.oga"'
)
makedepends=('python-setuptools')
makedepends=(
'python-setuptools'
'python-build'
'python-installer'
)
source=()
sha256sums=()
package() {
install -Dm755 "../src/app.py" "$pkgdir/usr/bin/recoder"
install -Dm644 "../src/config.py" "$pkgdir/usr/lib/recoder/config.py"
install -Dm644 "../src/models.py" "$pkgdir/usr/lib/recoder/models.py"
install -Dm644 "../src/transcoder_worker.py" "$pkgdir/usr/lib/recoder/transcoder_worker.py"
install -Dm644 "../src/ui.py" "$pkgdir/usr/lib/recoder/ui.py"
install -Dm644 "../resources/net.jeena.Recoder.desktop" "$pkgdir/usr/share/applications/net.jeena.Recoder.desktop"
install -Dm644 "../resources/net.jeena.Recoder.png" "$pkgdir/usr/share/icons/hicolor/256x256/apps/net.jeena.Recoder.png"
install -Dm644 "../src/__init__.py" "$pkgdir/usr/lib/recoder/__init__.py"
build() {
cd "$srcdir"
python -m build --wheel
}
package() {
cd "$srcdir"
python -m installer --destdir="$pkgdir" dist/*.whl
install -Dm644 resources/net.jeena.Recoder.desktop \
"$pkgdir/usr/share/applications/net.jeena.Recoder.desktop"
install -Dm644 resources/net.jeena.Recoder.png \
"$pkgdir/usr/share/icons/hicolor/256x256/apps/net.jeena.Recoder.png"
}

View file

@ -0,0 +1,97 @@
# Recoder
**Recoder** is a GTK4-based GUI application for video transcoding. It provides a clean, modern interface using Libadwaita and integrates with `ffmpeg` to convert videos with ease.
![screenshot](resources/net.jeena.Recoder.png)
---
## ✨ Features
- Simple and elegant GTK4 interface
- Built with Libadwaita for a native GNOME look
- Supports common video formats using `ffmpeg`
- Lightweight and fast
- System notifications on task completion
---
## 🛠 Requirements
- Python 3.10+
- GTK4
- Libadwaita
- `ffmpeg`
- Python bindings:
- `python-gobject`
---
## 🚀 Installation (Arch Linux)
```bash
git clone https://github.com/jeena/recoder.git
cd recoder
makepkg -si
```
This will install Recoder system-wide using Pacman, so you can later remove it cleanly:
```bash
sudo pacman -R recoder
```
---
## 🧪 Development Setup
If you're hacking on Recoder:
```bash
git clone https://github.com/jeena/recoder.git
cd recoder
python -m venv .venv
source .venv/bin/activate
pip install -e .
```
Then run:
```bash
recoder
```
---
## 📁 Project Structure
```
src/
└── recoder/
├── app.py
├── config.py
├── models.py
├── transcoder_worker.py
└── ui.py
resources/
├── net.jeena.Recoder.desktop
└── net.jeena.Recoder.png
```
---
## 📦 Packaging
Recoder follows modern Python packaging using `pyproject.toml` and `setuptools`. The Arch package installs Python modules to `site-packages` and the desktop file + icon in appropriate locations.
---
## 📄 License
Licensed under the GPLv3. See `LICENSE` for details.
---
## 👤 Author
Made by Jeena · [github.com/jeena](https://github.com/jeena)

13
pyproject.toml Normal file
View file

@ -0,0 +1,13 @@
[project]
name = "recoder"
version = "1.0.0"
description = "A GTK4 video transcoding GUI application"
authors = [{name = "Jeena", email = "hello@jeena.net"}]
license = "GPL-3.0-or-later"
[project.scripts]
recoder = "recoder.app:main" # This creates the /usr/bin/recoder entrypoint
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

View file

@ -1,30 +0,0 @@
#!/usr/bin/env python3
import sys
import gi
gi.require_version('Gtk', '4.0')
gi.require_version('Adw', '1')
from gi.repository import Adw, Gio
from ui import RecoderWindow
Adw.init()
class RecoderApp(Adw.Application):
def __init__(self):
super().__init__(application_id="net.jeena.Recoder",
flags=Gio.ApplicationFlags.FLAGS_NONE)
self.window = None
def do_activate(self):
if not self.window:
self.window = RecoderWindow(application=self)
self.window.present()
def main():
app = RecoderApp()
return app.run(sys.argv)
if __name__ == "__main__":
sys.exit(main())

30
src/recoder/app.py Executable file
View file

@ -0,0 +1,30 @@
#!/usr/bin/env python3
import sys
import gi
gi.require_version('Gtk', '4.0')
gi.require_version('Adw', '1')
from gi.repository import Adw, Gio
Adw.init()
def main():
from recoder.ui import RecoderWindow # delayed import
class RecoderApp(Adw.Application):
def __init__(self):
super().__init__(application_id="net.jeena.Recoder",
flags=Gio.ApplicationFlags.FLAGS_NONE)
self.window = None
def do_activate(self):
if not self.window:
self.window = RecoderWindow(application=self)
self.window.present()
app = RecoderApp()
return app.run(sys.argv)
if __name__ == "__main__":
sys.exit(main())

View file

@ -7,8 +7,8 @@ gi.require_version('Adw', '1')
from gi.repository import Gtk, Adw, Gio, Gdk, GLib
from functools import partial
from config import load_config, save_config
from transcoder_worker import TranscoderWorker
from recoder.config import load_config, save_config
from recoder.transcoder_worker import TranscoderWorker
class RecoderWindow(Adw.ApplicationWindow):
def __init__(self, **kwargs):