segmenta-archiver 0.1.2__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.
@@ -0,0 +1,34 @@
1
+ name: Publish Package
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+ id-token: write
11
+
12
+ jobs:
13
+ build-and-publish:
14
+ runs-on: ubuntu-latest
15
+ environment:
16
+ name: pypi
17
+ url: https://pypi.org/p/segmenta-archiver
18
+ steps:
19
+ - name: Check out repository
20
+ uses: actions/checkout@v4
21
+
22
+ - name: Set up Python
23
+ uses: actions/setup-python@v5
24
+ with:
25
+ python-version: "3.12"
26
+
27
+ - name: Install uv
28
+ uses: astral-sh/setup-uv@v5
29
+
30
+ - name: Build distributions
31
+ run: uv build
32
+
33
+ - name: Publish to PyPI
34
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,39 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.pyo
5
+ *.pyd
6
+ *.so
7
+
8
+ # Packaging / build artifacts
9
+ build/
10
+ dist/
11
+ *.egg-info/
12
+
13
+ # Virtual environments
14
+ .venv/
15
+ venv/
16
+ env/
17
+
18
+ # Tooling caches
19
+ .ruff_cache/
20
+ .mypy_cache/
21
+ .pytest_cache/
22
+
23
+ # Editors / OS
24
+ .vscode/
25
+ .idea/
26
+ .DS_Store
27
+ Thumbs.db
28
+
29
+ # Local media files (avoid accidental commits)
30
+ *.ts
31
+ *.mp4
32
+ *.mkv
33
+ *.mov
34
+ *.avi
35
+ *.flv
36
+ *.webm
37
+
38
+ # Temporary artifacts produced by app
39
+ filelist.txt
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,10 @@
1
+ Metadata-Version: 2.4
2
+ Name: segmenta-archiver
3
+ Version: 0.1.2
4
+ Summary: Batch merge and transcode timestamped .ts recordings into organized H.265 archives
5
+ License-File: LICENSE
6
+ Requires-Python: >=3.10
7
+ Requires-Dist: av>=9.0.0
8
+ Requires-Dist: pillow>=9.2.0
9
+ Requires-Dist: pymediainfo>=4.3
10
+ Requires-Dist: typer>=0.15.0
@@ -0,0 +1,175 @@
1
+ ![Logo](logo.png)
2
+
3
+ **Segmenta** is a high-performance media utility designed to help you turn messy stream segments into a polished personal archive. It automatically groups, merges, and transcodes timestamped `.ts` files into organized H.265 (`.mp4`) libraries.
4
+
5
+ ![Python >=3.10](https://img.shields.io/badge/python-3.10%2B-blue)
6
+ ![FFmpeg required](https://img.shields.io/badge/ffmpeg-required-orange)
7
+ ![Scope local files only](https://img.shields.io/badge/scope-local%20files%20only-green)
8
+
9
+ ---
10
+
11
+ ## ✨ Why Segmenta?
12
+
13
+ If you record live sessions from platforms like **Twitch**, **YouTube**, or use **OBS** split recordings, you often end up with dozens of `.ts` chunks. **Segmenta** automates the tedious work:
14
+
15
+ - 🧵 **Smart Merging**: Groups files by source and date, then joins them in perfect chronological order.
16
+ - ⚡ **GPU Accelerated**: Prefers your NVIDIA (NVENC), Intel (QSV), or AMD (AMF) hardware for blazing-fast HEVC encoding.
17
+ - 📁 **Auto-Organization**: Creates beautifully named folders and files based on your preferences.
18
+ - 📊 **Real-time Progress**: A live ASCII progress bar keeps you updated on the transcoding status.
19
+ - 🖼️ **Preview Sheets by Default**: After each output `.mp4`, Segmenta generates a thumbnail sheet preview with a full metadata header.
20
+
21
+ ---
22
+
23
+ ## ⚖️ Disclaimer & Scope
24
+
25
+ **Segmenta is intended for legal and personal archival purposes only.**
26
+
27
+ - **Local Files Only**: This tool strictly processes files already present on your local disk.
28
+ - **No Downloading**: It does not contain functionality to record, download, or scrape streams from any platform.
29
+ - **User Responsibility**: Users are solely responsible for ensuring they have the legal right to process, transcode, and store the media files they use with this tool. Please respect the Terms of Service of the platforms you use.
30
+
31
+ ---
32
+
33
+ ## 🚀 Quick Start
34
+
35
+ ### 1. Installation
36
+
37
+ Install Segmenta as a global tool using [uv](https://github.com/astral-sh/uv):
38
+
39
+ ```bash
40
+ uv tool install .
41
+ ```
42
+
43
+ ### 2. Prepare Your Files
44
+
45
+ Ensure your input files follow this pattern: `<source>_YYYY-MM-DD_HH-MM-SS.ts`
46
+
47
+ **Example:**
48
+ - `shroud_2026-03-22_09-06-01.ts`
49
+ - `shroud_2026-03-22_12-53-01.ts`
50
+
51
+ ### 3. Run the Archiver
52
+
53
+ Simply point Segmenta to your recordings folder:
54
+
55
+ ```bash
56
+ segmenta "C:\Recordings\Twitch" --source twitch
57
+ ```
58
+
59
+ By default, each successful output also creates a preview image in the same folder:
60
+
61
+ - Output video: `.../<folder-name>.mp4`
62
+ - Preview sheet: `.../<folder-name>_preview.jpg`
63
+
64
+ ---
65
+
66
+ ## 🛠️ Advanced Customization
67
+
68
+ ### Naming Templates
69
+
70
+ Fully control your archive structure with the `--name-template` option.
71
+
72
+ **Example:**
73
+ ```bash
74
+ segmenta "E:\VODs" --name-template "[{source_label}] {source} - {date_iso} [{resolution}]"
75
+ ```
76
+
77
+ Available variables:
78
+ - `{source_label}`: The platform name (e.g., Twitch, YouTube Live).
79
+ - `{source}`: The creator or channel name parsed from the file.
80
+ - `{show}`: Custom session label (default: "Session").
81
+ - `{month_abbr}`, `{day}`, `{year}`: Date components.
82
+ - `{date_iso}`: The full date (YYYY-MM-DD).
83
+ - `{resolution}`: The detected video height (e.g., 1080p).
84
+
85
+ Run `segmenta --print-template-vars` for a full list of options.
86
+
87
+ ### Encoder Options
88
+
89
+ Segmenta automatically detects and prefers GPU encoders. You can manually override this:
90
+
91
+ ```bash
92
+ # Force CPU (high quality, slow)
93
+ segmenta "input" --encoder cpu --crf 22
94
+
95
+ # Force NVIDIA NVENC
96
+ segmenta "input" --encoder nvenc --cq 24
97
+ ```
98
+
99
+ ### Preview Sheet Generation
100
+
101
+ Preview generation is enabled by default and runs on the resulting `.mp4` file.
102
+
103
+ - Default layout: `3 x 9` tiles
104
+ - Tile width: `400px`
105
+ - Styling: black background, full technical header, per-tile timestamps
106
+ - Performance mode: fast keyframe sampling with multithreaded decode and FFmpeg scaling
107
+
108
+ Disable preview generation if needed:
109
+
110
+ ```bash
111
+ segmenta "input" --no-thumbnail
112
+ ```
113
+
114
+ ### Source File Deletion
115
+
116
+ Segmenta no longer prompts interactively to delete source `.ts` files.
117
+
118
+ - Source files are kept by default.
119
+ - To delete processed source files explicitly, use:
120
+
121
+ ```bash
122
+ segmenta "input" --delete-original
123
+ ```
124
+
125
+ - `--keep-ts` always preserves source files, even if `--delete-original` is set.
126
+
127
+ ---
128
+
129
+ ## 🌐 Supported Source Presets
130
+
131
+ Segmenta comes with built-in labels for many popular platforms:
132
+
133
+ - **General**: `platform`, `obs`, `custom`
134
+ - **Social**: `twitch`, `youtube-live`, `kick`, `tiktok-live`, `rumble`, `vimeo-livestream`
135
+ - **Archive Compatible**: `chaturbate`, `stripchat`, `camsoda`, and many more.
136
+
137
+ *Run `segmenta --help` to see the full list of supported presets. Use `--source custom --source-label "My App"` for unsupported platforms.*
138
+
139
+ ---
140
+
141
+ ## 📝 Requirements
142
+
143
+ - **Python 3.10+**
144
+ - **FFmpeg & FFprobe**: Must be installed and available in your system `PATH`.
145
+
146
+ ---
147
+
148
+ ## 📦 Publishing (PyPI + GitHub)
149
+
150
+ Segmenta is published as a standard Python package and can be installed as a `uv` tool.
151
+
152
+ ### Install after publish
153
+
154
+ ```bash
155
+ uv tool install segmenta-archiver
156
+ ```
157
+
158
+ ### Release flow
159
+
160
+ 1. Bump version in `pyproject.toml` and `src/segmenta/__init__.py`.
161
+ 2. Create and push a Git tag (for example `v0.1.2`).
162
+ 3. Create a GitHub Release from that tag.
163
+ 4. GitHub Actions will build with `uv build` and publish to PyPI automatically.
164
+
165
+ ### One-time PyPI setup (Trusted Publishing)
166
+
167
+ In PyPI project settings, add a trusted publisher with:
168
+
169
+ - **Owner**: your GitHub org/user
170
+ - **Repository**: `segmenta` repository name
171
+ - **PyPI Project Name**: `segmenta-archiver`
172
+ - **Workflow**: `.github/workflows/publish.yml`
173
+ - **Environment**: `pypi`
174
+
175
+ No PyPI API token is required when using trusted publishing.
Binary file
@@ -0,0 +1,21 @@
1
+ [project]
2
+ name = "segmenta-archiver"
3
+ version = "0.1.2"
4
+ description = "Batch merge and transcode timestamped .ts recordings into organized H.265 archives"
5
+ requires-python = ">=3.10"
6
+ dependencies = [
7
+ "typer>=0.15.0",
8
+ "av>=9.0.0",
9
+ "pymediainfo>=4.3",
10
+ "Pillow>=9.2.0",
11
+ ]
12
+
13
+ [project.scripts]
14
+ segmenta = "segmenta.cli:run"
15
+
16
+ [build-system]
17
+ requires = ["hatchling"]
18
+ build-backend = "hatchling.build"
19
+
20
+ [tool.hatch.build.targets.wheel]
21
+ packages = ["src/segmenta"]
@@ -0,0 +1 @@
1
+ __version__ = "0.1.2"