More elegant handling of playing URLs directly

Signed-off-by: Joseph Nuthalapati's avatarJoseph Nuthalapati <[email protected]>
parent a2f24b3b
Pipeline #108673727 passed with stages
in 1 minute and 40 seconds
......@@ -56,7 +56,8 @@ func sanitizeURL*(url: string): string =
proc directPlay*(searchQuery: string, player: string) =
if "watch?" in searchQuery or "videos/watch" in searchQuery or "" in searchQuery:
play(player, args=[sanitizeURL(searchQuery)])
elif searchQuery.startswith("magnet:"):
play("peerflix", args=[searchQuery, &"--{player}"])
let url = sanitizeURL(searchQuery)
if searchQuery.startswith("magnet:"):
play("peerflix", args=[url, &"--{player}"])
play(player, args=[url])
......@@ -5,7 +5,6 @@ import lib
suite "Playing direct links":
test "sanitize URL":
# give up and stop if this fails
let expected = ""
check(sanitizeURL("") == expected)
check(sanitizeURL("\\?v\\=QOEMv0S8AcA") == expected)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment