Reimplement streaming of playlists
authorJoseph Nuthalapati <njoseph@riseup.net>
Tue, 2 Jun 2020 18:44:47 +0000 (00:14 +0530)
committerJoseph Nuthalapati <njoseph@riseup.net>
Tue, 2 Jun 2020 18:44:47 +0000 (00:14 +0530)
src/lib.nim

index 67095ac9b24ec905f7e79f3e9d1ee90728cece53..4305b2cbb1c0387cee28ce38887608d744009608 100644 (file)
@@ -52,6 +52,7 @@ proc presentVideoOptions*(searchResults: SearchResults) =
     styledEcho $index, ". ", styleBright, fgMagenta, title, "\n", resetStyle, fgCyan, url, "\n"
 
 func isPlaylist(url: string): bool =
+  # Identifies if video is part of a playlist
   # Only YouTube playlists are supported for now
   "www.youtube.com" in url and "&list=" in url
 
@@ -62,7 +63,8 @@ func buildPlayerArgs(url: string, options: Table[string, bool], player: string):
   if options["fullScreen"]: args.add("--fullscreen")
   # Playlists are only supported for MPV player
   if isPlaylist(url) and player == "mpv":
-    args.add("--ytdl-raw-options=\"yes-playlist=\"")
+    let list_arg = url.split('&')[1]
+    args[0] = "https://www.youtube.com/playlist?" & list_arg
   return args
 
 proc play*(player: string, options: Table[string, bool], url: string, title: string = "") =