Ramdisk
This commit is contained in:
parent
5d450a90da
commit
f5935177a8
28
invyt.nu
28
invyt.nu
|
@ -1,11 +1,9 @@
|
|||
#!/usr/bin/env nu
|
||||
|
||||
def main [url: string
|
||||
, --return(-r) # Returns given url as YouTube url
|
||||
] {
|
||||
def parse_url [url: string] {
|
||||
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" {
|
||||
$url | str replace $parsed_url.host "youtube.com"
|
||||
} else {
|
||||
|
@ -20,10 +18,24 @@ def main [url: string
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
match $return {
|
||||
true => $yt_url
|
||||
false => { yt-dlp --embed-chapters --embed-metadata --embed-subs $yt_url }
|
||||
}
|
||||
|
||||
def main [ url: string
|
||||
, --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