Skip to content

Commit

Permalink
Bumping version to 1.5.10
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Aug 20, 2019
1 parent c2751bc commit 6e32a9b
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 9 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

## 1.5.8 - 2019-08-20
## 1.5.10 - 2019-08-20
* Sonos support

## 1.4.22 - 2019-08-20
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 = "1.5.8"
let Version = "1.5.10"

let IsPrerelease = false

let Notes = """
# Release Notes
## 1.5.8 - 2019-08-20
## 1.5.10 - 2019-08-20
* Sonos support
## 1.4.22 - 2019-08-20
Expand Down
27 changes: 22 additions & 5 deletions src/Server/Server.fs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ let nextFileEndpoint (userID,token) =
Description = tag.Description
Action = TagActionForBox.GetFromTagAction(tag.Action,position) }


let txt = TagForBox.Encoder tag |> Encode.toString 0
return! setBodyFromString txt next ctx
| SpeakerType.Sonos ->
Expand Down Expand Up @@ -251,9 +250,27 @@ let volumeUpEndpoint userID =
pipeline {
set_header "Content-Type" "application/json"
plug (fun next ctx -> task {
let! tags = AzureTable.getAllTagsForUser userID
let txt = TagList.Encoder { Tags = tags } |> Encode.toString 0
return! setBodyFromString txt next ctx
match! AzureTable.getUser userID with
| None ->
return! Response.notFound ctx userID
| Some user ->
let logger = ctx.GetLogger "VolumeUp"
do! Sonos.volumeUp logger user.SonosAccessToken Sonos.group
return! Response.ok ctx userID
})
}

let volumeDownEndpoint userID =
pipeline {
set_header "Content-Type" "application/json"
plug (fun next ctx -> task {
match! AzureTable.getUser userID with
| None ->
return! Response.notFound ctx userID
| Some user ->
let logger = ctx.GetLogger "VolumeDown"
do! Sonos.volumeDown logger user.SonosAccessToken Sonos.group
return! Response.ok ctx userID
})
}

Expand Down Expand Up @@ -348,7 +365,7 @@ let webApp =
getf "/api/previousfile/%s/%s" previousFileEndpoint
getf "/api/usertags/%s" userTagsEndPoint
postf "/api/volumeup/%s" volumeUpEndpoint
postf "/api/volumedown/%s" volumeUpEndpoint
postf "/api/volumedown/%s" volumeDownEndpoint
postf "/api/upload/%s" uploadEndpoint
getf "/api/history/%s" historyEndPoint
get "/api/startup" startupEndpoint
Expand Down
27 changes: 26 additions & 1 deletion src/Server/Sonos.fs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type Session =

let createOrJoinSession (log:ILogger) accessToken group = task {
let headers = ["Authorization", "Bearer " + accessToken]
let url = sprintf "https://api.ws.sonos.com/control/api/v1/groups/%s/playbackSession/create" group
let url = sprintf "https://api.ws.sonos.com/control/api/v1/groups/%s/playbackSession" group
let body = """{
"appId": "com.Forkmann.AudioHub",
"appContext": "1a2b3c",
Expand All @@ -65,6 +65,31 @@ let createOrJoinSession (log:ILogger) accessToken group = task {
| Ok session -> return session
}

let volumeUp (log:ILogger) accessToken group = task {
let headers = ["Authorization", "Bearer " + accessToken]
let url = sprintf "https://api.ws.sonos.com/control/api/v1/groups/%s/groupVolume/relative" group
let body = """{
"volumeDelta": 10
}"""

let! _result = post log url headers body

()
}

let volumeDown (log:ILogger) accessToken group = task {
let headers = ["Authorization", "Bearer " + accessToken]
let url = sprintf "https://api.ws.sonos.com/control/api/v1/groups/%s/groupVolume/relative" group
let body = """{
"volumeDelta": -10
}"""

let! _result = post log url headers body

()
}



let playStream (log:ILogger) accessToken (session:Session) (tag:Tag) = task {
let headers = ["Authorization", "Bearer " + accessToken]
Expand Down

0 comments on commit 6e32a9b

Please sign in to comment.