scripts

Utilitity scripts
git clone git://gtms.dev/scripts.git
Log | Files | Refs

commit 1cce3de3b2741adda40ddc8e8592b6ed7c9e53f2
parent f58787d5f4ee525cfcd209ad01e960baa0a55212
Author: Tomas Nemec <nemi@skaut.cz>
Date:   Wed, 20 Oct 2021 21:28:34 +0200

update

Diffstat:
Msfopen | 27+++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/sfopen b/sfopen @@ -1,17 +1,16 @@ -#!/bin/lua +#!/usr/bin/env zsh -local url = arg[1] -function open(format) os.execute(string.format(format, url)) end +url="$1" +[[ -z $url ]] && exit -if string.find(url, 'youtube') then - open('setsid -f mpv --ytdl-format=best %s') -elseif string.find(url, 'odysee') then - open('setsid -f mpv %s') -elseif string.find(url, 'reddit') then - url = string.gsub(url, 'www.reddit.com', 'libredd.it') - open(os.getenv('BROWSER') .. ' --new-window %s') -elseif string.find(url, 'https') then - open(os.getenv('BROWSER') .. ' --new-window %s') +if [[ $url =~ 'youtube' ]]; then + setsid -f mpv --ytdl=format=best "$url" +elif [[ $url =~ 'odysee' ]]; then + setsid -f mpv "$url" +elif [[ $url =~ 'reddit' ]]; then + $BROWSER --new-window "$url" +elif [[ $url =~ 'https' ]]; then + $BROWSER --new-window "$url" else - open('xdg-open %s') -end + xdg-open "$url" +fi