Skip to content

Commit

Permalink
Bumping version to 0.16.17
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Dec 15, 2018
1 parent f359a94 commit d804055
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 41 deletions.
2 changes: 1 addition & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Release Notes

## 0.16.16 - 2018-12-15
## 0.16.17 - 2018-12-15
* Update to ASP.NET 2.2

## 0.15.11 - 2018-11-05
Expand Down
4 changes: 2 additions & 2 deletions src/Client/ReleaseNotes.fs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module internal ReleaseNotes

let Version = "0.16.16"
let Version = "0.16.17"

let IsPrerelease = false

let Notes = """
# Release Notes
## 0.16.16 - 2018-12-15
## 0.16.17 - 2018-12-15
* Update to ASP.NET 2.2
## 0.15.11 - 2018-11-05
Expand Down
77 changes: 39 additions & 38 deletions src/Server/Server.fs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,45 @@ let mapBlobMusikTag (tag:Tag) = task {
| _ -> return tag
}


let discoverYoutubeLink (youtubeURL:string) = task {
let lines = System.Collections.Generic.List<_>()
let proc = new Process ()
let startInfo = new ProcessStartInfo()
startInfo.FileName <- "/usr/local/bin/youtube-dl"
startInfo.Arguments <- sprintf " -g \"%s\"" youtubeURL
startInfo.UseShellExecute <- false
startInfo.RedirectStandardOutput <- true
startInfo.RedirectStandardError <- true
startInfo.CreateNoWindow <- true
proc.StartInfo <- startInfo

proc.Start() |> ignore

while not proc.StandardOutput.EndOfStream do
let! line = proc.StandardOutput.ReadLineAsync()
lines.Add line

while not proc.StandardError.EndOfStream do
let! line = proc.StandardError.ReadLineAsync()
lines.Add line

let lines = Seq.toArray lines
let links =
lines
|> Array.filter (fun x -> x.Contains "&mime=audio")

return youtubeURL,links
}

let mapYoutube (tag:Tag) = task {
match tag.Action with
| TagAction.PlayYoutube url ->
let! _,links = discoverYoutubeLink url
return { tag with Action = TagAction.PlayMusik links.[0] }
| _ -> return tag
}

let uploadEndpoint (token:string) =
pipeline {
set_header "Content-Type" "application/json"
Expand Down Expand Up @@ -138,44 +177,7 @@ let firmwareEndpoint =
}


let discoverYoutubeLink (youtubeURL:string) = task {
let lines = System.Collections.Generic.List<_>()
let proc = new Process ()
let startInfo = new ProcessStartInfo()
startInfo.FileName <- "/usr/local/bin/youtube-dl"
startInfo.Arguments <- sprintf " -g \"%s\"" youtubeURL
startInfo.UseShellExecute <- false
startInfo.RedirectStandardOutput <- true
startInfo.RedirectStandardError <- true
startInfo.CreateNoWindow <- true
proc.StartInfo <- startInfo

proc.Start() |> ignore

while not proc.StandardOutput.EndOfStream do
let! line = proc.StandardOutput.ReadLineAsync()
lines.Add line

while not proc.StandardError.EndOfStream do
let! line = proc.StandardError.ReadLineAsync()
lines.Add line

let lines = Seq.toArray lines
let links =
lines
|> Array.filter (fun x -> x.Contains "&mime=audio")

return youtubeURL,links
}

let discoverEndpoint (url) =
pipeline {
set_header "Content-Type" "application/json"
plug (fun next ctx -> task {
let! tag = discoverYoutubeLink url
return! setBodyFromString (sprintf "%A" tag) next ctx
})
}

let tagHistoryBroadcaster = ConnectionManager()

Expand All @@ -193,7 +195,6 @@ let webApp =
postf "/api/upload/%s" uploadEndpoint
get "/api/startup" startupEndpoint
get "/api/firmware" firmwareEndpoint
get "/api/discover" (discoverEndpoint "https://www.youtube.com/watch?v=kfSlg3HtaSw")
get "/api/latestfirmware" getLatestFirmware
getf "/api/taghistorysocket/%s" (TagHistorySocket.openSocket tagHistoryBroadcaster)
}
Expand Down

0 comments on commit d804055

Please sign in to comment.