Ramdisk
This commit is contained in:
parent
5d450a90da
commit
f5935177a8
32
invyt.nu
32
invyt.nu
|
@ -1,11 +1,9 @@
|
||||||
#!/usr/bin/env nu
|
#!/usr/bin/env nu
|
||||||
|
|
||||||
def main [url: string
|
def parse_url [url: string] {
|
||||||
, --return(-r) # Returns given url as YouTube url
|
|
||||||
] {
|
|
||||||
let parsed_url = $url | url parse
|
let parsed_url = $url | url parse
|
||||||
|
|
||||||
let yt_url = if ($parsed_url.path | str contains '/watch') {
|
if ($parsed_url.path | str contains '/watch') {
|
||||||
if $parsed_url.host != "youtube.com" {
|
if $parsed_url.host != "youtube.com" {
|
||||||
$url | str replace $parsed_url.host "youtube.com"
|
$url | str replace $parsed_url.host "youtube.com"
|
||||||
} else {
|
} else {
|
||||||
|
@ -20,10 +18,24 @@ def main [url: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
match $return {
|
|
||||||
true => $yt_url
|
def main [ url: string
|
||||||
false => { yt-dlp --embed-chapters --embed-metadata --embed-subs $yt_url }
|
, --copy(-c)
|
||||||
}
|
] {
|
||||||
|
|
||||||
|
let $url = parse_url $url
|
||||||
|
|
||||||
|
match $copy {
|
||||||
|
true => { $url | xclip -sel clip }
|
||||||
|
false => $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def "main download" [url: string] {
|
||||||
|
yt-dlp --embed-chapters --embed-metadata --embed-subs (parse_url $url)
|
||||||
|
}
|
||||||
|
|
||||||
|
def "main dl" [url: string] {
|
||||||
|
yt-dlp --embed-chapters --embed-metadata --embed-subs (parse_url $url)
|
||||||
}
|
}
|
||||||
|
|
5
ramdisk.nu
Executable file
5
ramdisk.nu
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/usr/bin/env nu
|
||||||
|
|
||||||
|
def main [--size(-s): string] {
|
||||||
|
sudo mount -o size=($size | default "8G") -t tmpfs none /mnt/
|
||||||
|
}
|
Loading…
Reference in a new issue