sya

split youtube audio tracks, with an optional pyqt gui
git clone git://src.gearsix.net/sya
Log | Files | Refs | Atom | README

commit a957bb0bdea14e1aa3be4a5c8fd57629a82106a0
parent 8119c02c7aa3702da3833381dce1ac2037402ce4
Author: gearsix <gearsix@tuta.io>
Date:   Sat, 12 Nov 2022 20:13:04 +0000

docs: migrated a lot of doc files to *README.md*.

Diffstat:
ABUGS.md | 29+++++++++++++++++++++++++++++
DBUGS.txt | 24------------------------
DBUILDING.txt | 32--------------------------------
AREADME.md | 145+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
DREADME.txt | 94-------------------------------------------------------------------------------
ATODO.txt | 3+++
Drequirements.txt | 41-----------------------------------------
7 files changed, 177 insertions(+), 191 deletions(-)

diff --git a/BUGS.md b/BUGS.md @@ -0,0 +1,29 @@ +# BUGS + +## Legend + +[ ] = Not started +[x] = Won't do +[~] = Doing +[*] = Done +- ... = Note about the above item + +## List + +--- + +**2021-07-31** [ ] don't apply file numbering when song names include file number already + + #regex-improvement + +--- + +**2021-06-22** [*] handle multiple timestamp regex matches + When there are multiple matches for the timestamp regex in a line, the last match is used as the timestamp. + + Discovered that the following line causes an issue because 2019 is counted as a timestamp + `58:18 C4C - Melted w_ Hazy Year (Chillhop Winter Essentials 2019).` + + #regex-improvement + +--- diff --git a/BUGS.txt b/BUGS.txt @@ -1,24 +0,0 @@ -# BUGS - -## Legend - -[ ] = Not started -[x] = Won't do -[~] = Doing -[*] = Done -- ... = Note about the above item - -## List - -**2021-07-31** [ ] don't apply file numbering when song names include file number already - - #regex-improvement - - -**2021-06-22** [*] handle multiple timestamp regex matches - When there are multiple matches for the timestamp regex in a line, the last match is used as the timestamp. - - Discovered that the following line causes an issue because 2019 is counted as a timestamp - `58:18 C4C - Melted w_ Hazy Year (Chillhop Winter Essentials 2019).` - - #regex-improvemnet diff --git a/BUILDING.txt b/BUILDING.txt @@ -1,32 +0,0 @@ -BUILDING SYA-PYQT - - Being a Python script, building a binary from it can be a pain. - - This guide is intended for anyone looking to build 'sya-pyqt.py' as the - portable, distributed 'sya-pyqt' binary. Providing a portable binary - provides the advantages of bundling all the resources used, making it - easier to distribute. - - The following guide expects you to download ffmpeg (ffmpeg.org) and - yt-dlp (github.com/yt-dlp/yt-dlp) binaries for your system, which - 'sya-pyqt' uses the bundled versions of. - - To do this, PyInstaller is used (pyinstaller.org/), which can be - installed using pip: ("pip install pyinstaller"). - - The following command will build the binary: - - pyinstaller ./sya-pyqt.py -F --windowed --add-data "folder.png:." --add-data "./file.png:." --add-data "./sya.png:." --add-data "./ffmpeg:." --add-data "./yt-dlp:." - - On Windows, you'll need to use slightly different syntax: - - pyinstaller sya-pyqt.py -F --windowed --add-data ".\folder.png;." --add-data ".\file.png;." --add-data ".\sya.png;." --add-data ".\ffmpeg.exe;." --add-data ".\yt-dlp.exe;." - - Both 'ffmpeg' and 'yt-dlp' should be the filepath of previously downloaded binaries. - - -NOTES - - I found on windows that I had to provide the following argument to bundle the PyQt5 dependency. - - --paths C:\Programs\Python311\Lib\site-packages\PyQt5\Qt5\ diff --git a/README.md b/README.md @@ -0,0 +1,145 @@ + +# sya + +**sya - split youtube audio**, download, convert & split audio from youtube videos into multiple audio tracks using 'yt-dlp' and 'ffmpeg'. + +--- + +## sya.py + +This is the base Python script, which contains all the functionality: + + sya.py [OPTIONS] TRACKLIST + +### OPTIONS + +``` + -h, --help + show this help message and exit + + -o [PATH], --output [PATH] + specify the directory to write output files to (default: ./out) + + -f [FORMAT], --format [FORMAT] + specify the --audio-format argument to pass to yt-dlp (default: mp3) + + -q [QUALITY], --quality [QUALITY] + specify the --audio-quality argument to pass to yt-dlp (default: 320K) + + --yt-dlp [PATH] + path of the "yt-dlp" binary to use + + --ffmpeg [PATH] + path of the "ffmpeg" binary to use + + -k, --keep + keep any files removed during processing (full video/audio file) +``` + +### TRACKLIST + +**TRACKLIST** should be the filepath of a UTF-8 text file that has the URL of the video to download to audio track of on line 1. +Every line after this should be the track name and timestamp of each track, note that the timestamp is *where the track starts*. + +Regex is used to parse the tracks (timestamp and name), it tries to be fairly accomodating but isn't perfect - so here are a few rules: + +- Timestamps can be before or after the track name. +- Timestamps can be wrapped in `[]` or `()`. +- Timestamps can be `MM:SS` or `HH:MM:SS`. +- Timestamps can be split using `:` or `.`. + +<details> + <summary>Example Tracklist</summary> + https://www.youtube.com/watch?v=LbjcaMAhJRQ + Sneaky Snitch (0:00) + Fluffing a Duck (2:16) + Cipher (3:24) + Scheming Weasel (7:15) + Carefree (8:44) + Thatched Villagers (12:09) + Monkeys Spinning Monkeys (16:15) + Wallpaper (18:20) + Pixel Peeker Polka (21:59) + Killing Time (25:21) + Hitman (28:46) + The Cannery (32:07) + Cut and Run (35:09) + Life of Riley (38:44) + Quirky Dog (42:39) + The Complex (45:08) + Hyperfun (49:35) + Black Vortex (53:29) + Rock on Chicago (56:19) + Volatile Reaction (57:58) + On the Ground (1:00:44) + Wagon Wheel (electronic) (1:03:23) + Call to Adventure (1:08:26) + Hustle (1:12:33) + Cupids Revenge (1:14:34) + Dirt Rhodes (1:16:20) + Rhinoceros (1:18:20) + Who Likes to Party (1:21:43) + Spazzmatica Polka (1:26:01) +</details> + +### Install + +It's a Python script, so there are many ways to install it. + +Here's one that should work on *any* system: + + python3 ./setup.py install --user --record install.txt + +To **uninstall**, just remove all files recorded to *./install.txt*. + +--- + +## sya-pyqt + +Some people don't like the cli and I wanted to play with PyQt, so sya-pyqt wraps a nice GUI around the *sya.py* runtime. + +![sya-pyqt_screenshot.png] + +### Development + +Working on or building requires *PyQt5*, this can be installed with `pip install PyQt5`. + +To run *sya-pyqt*, you don't need to build a binary everytime, you can just run `python ./sya-pyqt.py`. + +### Building + +[pyinstaller](https://pyinstaller.org) is used to build a portable binary for sya-pyqt for easy distribution. + +**POSIX (Linux, MacOS, BSD)** + + pyinstaller ./sya-pyqt.py -F --windowed --add-data "./folder.png:." --add-data "./file.png:." --add-data "./sya.png:." --add-data "FFMPEG:." --add-data "YT-DLP:." + +**Windows** + + pyinstaller ./sya-pyqt.py -F --windowed --add-data ".\folder.png;." --add-data ".\file.png;." --add-data ".\sya.png;." --add-data "FFMPEG;." --add-data "YT-DLP;." + +- Make sure you have a *yt-dlp* binary available, the filepath of this is referred to as *YT-DLP*. +- Make sure you have a *ffmpeg* binary available, the filepath of this is referred to as *FFMPEG*. +- In some cases, I've found the path of PyQt5 has had to be explicitly given to *pyinstaller*: +`--path <site-packages filepath>\PyQt5` + +--- + +## Thanks + +These two tools do all the heavy lifting: +- youtube-dl (https://ytdl-org.github.io/youtube-dl/) +- ffmpeg (https://ffmpeg.org) + +And the cool folder & file icons used in 'sya-pyqt' are from the Palemoon MicroMoon theme: +https://repo.palemoon.org/Lootyhoof/micromoon + + +## Disclaimer + +It should go without saying, don't use this for pirating music. Get nice high-quality, properly tagged audio tracks from official services (shoutout to Bandcamp). +The tool was originally written to download radio mixes and ambient soundtracks for a DnD group. + +## Authors + +- gearsix diff --git a/README.txt b/README.txt @@ -1,94 +0,0 @@ -NAME - sya - split youtube audio - - -SYNOPSIS - sya.py [OPTIONS] TRACKLIST - - -DESCRIPTION - sya downloads, converts and splits youtube videos into multiple audio - tracks using `youtube-dl` and `ffmpeg`. - - -OPTIONS - -h --help displays help message - -k, --keep - youtube-dl option, keep the full track on disk after post-processing, - the video is erased by default - -o, --output [PATH] - specify the directory to write output files to (defaults to a directory - named after the tracklist filename) - -f, --format [EXT] - specify the --audio-format argument to pass to youtube-dl (default: mp3) - -q, --quality [QUALITY] - specify the --audio-quality argument to pass (default: 320K) - --youtube-dl [PATH] - path of the youtube-dl binary to use. Not available in 'sya-pyqt' binary. - --ffmpeg [PATH] - path of the ffmpeg binary to use. Not available in 'sya-pyqt' binary. - - -TRACKLIST - TRACKLIST files should be text file that has the URL/v=code of the youtube video to - download on the first line and the starting timestamp of each section to split, followed - by the title of that section section for every line after. - - Of course, you don't have to put the timestamp first, sya will try and accomocodate - whatever syntax is used, just beware that this might cause problems. - - Here's an example: - - https://www.youtube.com/watch?v=LbjcaMAhJRQ - Sneaky Snitch (0:00) - Fluffing a Duck (2:16) - Cipher (3:24) - Scheming Weasel (7:15) - Carefree (8:44) - Thatched Villagers (12:09) - Monkeys Spinning Monkeys (16:15) - Wallpaper (18:20) - Pixel Peeker Polka (21:59) - Killing Time (25:21) - Hitman (28:46) - The Cannery (32:07) - Cut and Run (35:09) - Life of Riley (38:44) - Quirky Dog (42:39) - The Complex (45:08) - Hyperfun (49:35) - Black Vortex (53:29) - Rock on Chicago (56:19) - Volatile Reaction (57:58) - On the Ground (1:00:44) - Wagon Wheel (electronic) (1:03:23) - Call to Adventure (1:08:26) - Hustle (1:12:33) - Cupids Revenge (1:14:34) - Dirt Rhodes (1:16:20) - Rhinoceros (1:18:20) - Who Likes to Party (1:21:43) - Spazzmatica Polka (1:26:01) - - -THANKS - These two tools do all the heavy lifting: - - youtube-dl (https://ytdl-org.github.io/youtube-dl/) - - ffmpeg (https://ffmpeg.org) - - And the cool folder & file icons used are from the Palemoon MicroMoon theme: - https://repo.palemoon.org/Lootyhoof/micromoon - - -DISCLAIMER - It should go without saying, don't use this for pirating music. - If you do, you're a dick and you're working against whatever band/label you - love enough to download their product. - - Service like Bandcamp (https://bandcamp.com) are great and allow you download - audio files of the albums you've bought, properly tagged and available for - re-download whenever you need. - - -AUTHORS - - gearsix (gearsix@tuta.io) diff --git a/TODO.txt b/TODO.txt @@ -0,0 +1,2 @@ +- QSpacerItem should be dynamic, not static size +- On exit, SyaGuiLogStream gets delted (runtime error?) +\ No newline at end of file diff --git a/requirements.txt b/requirements.txt @@ -1,41 +0,0 @@ -altgraph==0.17.3 -Brotli==1.0.9 -build==0.9.0 -certifi==2022.9.24 -dbus-python==1.2.18 -distlib==0.3.6 -filelock==3.8.0 -meson==0.60.3 -MouseInfo==0.1.3 -mugshot==0.4.3 -mutagen==1.46.0 -packaging==21.3 -pep517==0.13.0 -pexpect==4.8.0 -platformdirs==2.5.2 -psutil==5.9.3 -ptyprocess==0.7.0 -PyAutoGUI==0.9.53 -pycairo==1.20.1 -pycryptodomex==3.15.0 -PyGetWindow==0.0.9 -PyGObject==3.42.2 -pyinstaller==5.6.2 -pyinstaller-hooks-contrib==2022.11 -PyMsgBox==1.0.9 -pyparsing==3.0.9 -pyperclip==1.8.2 -PyQt5==5.15.7 -PyQt5-Qt5==5.15.2 -PyQt5-sip==12.11.0 -PyRect==0.2.0 -PyScreeze==0.1.28 -python3-xlib==0.15 -pytweening==1.0.4 -tomli==2.0.1 -trash-cli==0.22.8.27 -ufw==0.36.1 -virtualenv==20.16.6 -virtualenv-clone==0.5.7 -websockets==10.4 -yt-dlp==2022.10.4