Add port flag and update README
This commit is contained in:
parent
08e7ecb446
commit
d244b46512
82
README.md
82
README.md
@ -1 +1,81 @@
|
||||
❯ : PATH=~/go/bin:$PATH go generate ./...
|
||||
Front end for youtube-dl
|
||||
------------------------
|
||||
|
||||
Bare minimum zero dependency¹ single binary web app to download youtube videos using youtube-dl. Allows multiple downloads in parallel. Shows title and live download progress. Pull requests welcome. For a more feature full nicer looking app, checkout [YoutubeDL-Material](https://github.com/Tzahi12345/YoutubeDL-Material)
|
||||
|
||||
¹ Uses `golang.org/x/net` for websockets. It is strictly not part of go standard library.
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
❯ go install gitlab.com/balki/ytui@latest
|
||||
go: downloading gitlab.com/balki/ytui v0.0.0-...
|
||||
|
||||
|
||||
❯ ~/go/bin/ytui -h
|
||||
2022/06/30 10:53:46 Youtube UI
|
||||
Usage of /home/balki/go/bin/ytui:
|
||||
-cachepath string
|
||||
Path where temporary download files are saved (default "./cache")
|
||||
-dbpath string
|
||||
Path where downloaded info is saved (default "./db.json")
|
||||
-port int
|
||||
Port to listen on (default 8080)
|
||||
-videospath string
|
||||
Path where videos are saved (default "./vids")
|
||||
-videosurl string
|
||||
Prefix of the url, i.e. https://domain.com/<this var>/<video filename> (default "/vids")
|
||||
-ytdlcmd string
|
||||
youtube-dl command seperated by spaces (default "youtube-dl")
|
||||
|
||||
My Deployment setup
|
||||
-------------------
|
||||
|
||||
## File: /usr/local/lib/systemd/system/ytui.service
|
||||
|
||||
[Unit]
|
||||
Description=Youtube UI
|
||||
|
||||
[Service]
|
||||
User=ytui
|
||||
Type=simple
|
||||
StateDirectory=ytui
|
||||
WorkingDirectory=/var/lib/ytui
|
||||
ExecStart=/path/to/ytui -ytdlcmd "youtube-dl --proxy socks5://x.x.x.x:1080"
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
## File: /usr/local/lib/sysusers.d/ytui.conf
|
||||
|
||||
# See sysusers.d(5) for details.
|
||||
|
||||
u ytui - "Youtube UI"
|
||||
|
||||
## File: /etc/caddy/conf.d/ytui.conf
|
||||
|
||||
Make sure your main caddy file includes this
|
||||
|
||||
ytui.mydomain.com {
|
||||
root * /var/lib/ytui
|
||||
|
||||
handle /vids/* {
|
||||
file_server
|
||||
}
|
||||
|
||||
handle {
|
||||
reverse_proxy 127.0.0.1:8080
|
||||
}
|
||||
}
|
||||
|
||||
## Setup Commands
|
||||
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl restart systemd-sysusers
|
||||
sudo systemctl start ytui.service
|
||||
sudo systemctl restart caddy
|
||||
|
||||
Progress Tracker
|
||||
----------------
|
||||
|
||||
Wrote a small go helper [ProgressTracker](https://gitlab.com/balki/ytui/-/blob/main/pubsub/pt.go), to watch for progress and update subscribers. Hope it is useful elsewhere too. It has full unit test coverage
|
||||
|
5
main.go
5
main.go
@ -24,14 +24,13 @@ import (
|
||||
//go:embed templates/index.html
|
||||
var page string
|
||||
|
||||
const port = 8080
|
||||
|
||||
var (
|
||||
ytdlCmd = []string{"youtube-dl"}
|
||||
videosPath = "./vids"
|
||||
videosUrl = "/vids"
|
||||
cachePath = "./cache"
|
||||
dbPath = "./db.json"
|
||||
port = 8080
|
||||
)
|
||||
|
||||
var d *db.Db
|
||||
@ -43,6 +42,8 @@ func parse() {
|
||||
flag.StringVar(&videosUrl, "videosurl", videosUrl, "Prefix of the url, i.e. https://domain.com/<this var>/<video filename>")
|
||||
flag.StringVar(&cachePath, "cachepath", cachePath, "Path where temporary download files are saved")
|
||||
flag.StringVar(&dbPath, "dbpath", dbPath, "Path where downloaded info is saved")
|
||||
flag.IntVar(&port, "port", port, "Port to listen on")
|
||||
|
||||
flag.Parse()
|
||||
if ytcmd != ytdlCmd[0] {
|
||||
ytdlCmd = strings.Fields(ytcmd)
|
||||
|
Loading…
Reference in New Issue
Block a user