Skip to content

Instantly share code, notes, and snippets.

@helloqiu
Created March 31, 2018 04:40
Show Gist options
  • Save helloqiu/05e1903d977237d73899738263f5184d to your computer and use it in GitHub Desktop.
Save helloqiu/05e1903d977237d73899738263f5184d to your computer and use it in GitHub Desktop.
Decode url then execute mpv with it.
package main
import (
"fmt"
"net/url"
"os"
"os/exec"
)
func main() {
u, err := url.QueryUnescape(os.Args[1])
if err != nil {
fmt.Println("URL", os.Args[1], "error!")
os.Exit(1)
}
cmd := exec.Command("mpv", u)
cmd.Stdout = os.Stdout
cmd.Stdin = os.Stdin
cmd.Stderr = os.Stderr
cmd.Run()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment