Skip to content

Commit

Permalink
Bumping version to 1.0.13
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Dec 23, 2018
1 parent 1bec7a4 commit ced89ec
Show file tree
Hide file tree
Showing 9 changed files with 242 additions and 227 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.0.11 - 2018-12-22
## 1.0.13 - 2018-12-23
* Christmas edition

## 0.16.25 - 2018-12-18
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"private": true,
"dependencies": {
"@babel/polyfill": "7.0.0",
"@babel/polyfill": "7.2.5",
"@babel/runtime": "7.2.0",
"proj4": "2.5.0",
"react": "16.6.3",
"react": "16.7.0",
"react-bootstrap": "0.32.4",
"react-dom": "16.6.3",
"react-dom": "16.7.0",
"whatwg-fetch": "^3.0.0"
},
"devDependencies": {
"@babel/core": "7.2.2",
"@babel/plugin-proposal-class-properties": "7.2.1",
"@babel/plugin-proposal-class-properties": "7.2.3",
"@babel/plugin-transform-runtime": "7.2.0",
"@babel/preset-env": "7.2.0",
"@babel/preset-env": "7.2.3",
"@babel/preset-react": "7.0.0",
"babel-loader": "8.0.4",
"concurrently": "4.1.0",
Expand All @@ -24,9 +24,9 @@
"remotedev": "0.2.9",
"sass-loader": "7.1.0",
"style-loader": "0.23.1",
"terser-webpack-plugin": "1.1.0",
"webpack": "4.27.1",
"terser-webpack-plugin": "1.2.0",
"webpack": "4.28.2",
"webpack-cli": "3.1.2",
"webpack-dev-server": "3.1.10"
"webpack-dev-server": "3.1.13"
}
}
130 changes: 65 additions & 65 deletions paket.lock

Large diffs are not rendered by default.

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.0.11"
let Version = "1.0.13"

let IsPrerelease = false

let Notes = """
# Release Notes
## 1.0.11 - 2018-12-22
## 1.0.13 - 2018-12-23
* Christmas edition
## 0.16.25 - 2018-12-18
Expand Down
20 changes: 10 additions & 10 deletions src/PiServer/PiServer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,20 @@ let rfidLoop (dispatch,nodeServices:INodeServices) = task {
waiting <- false
}

let getMACAddress() =
let firstMacAddress =
NetworkInterface.GetAllNetworkInterfaces()
|> Seq.filter (fun nic -> nic.OperationalStatus = OperationalStatus.Up && nic.NetworkInterfaceType <> NetworkInterfaceType.Loopback)
|> Seq.map (fun nic -> nic.GetPhysicalAddress().ToString())
|> Seq.tryHead
firstMacAddress
|> Option.defaultValue "9bb2b109-bf08-4342-9e09-f4ce3fb01c0f" // TODO: load from some config
let getMACAddress() =
NetworkInterface.GetAllNetworkInterfaces()
|> Seq.filter (fun nic ->
nic.OperationalStatus = OperationalStatus.Up &&
nic.NetworkInterfaceType <> NetworkInterfaceType.Loopback)
|> Seq.map (fun nic -> nic.GetPhysicalAddress().ToString())
|> Seq.tryHead

let init nodeServices : Model * Cmd<Msg> =
{ PlayList = None
FirmwareUpdateInterval = TimeSpan.FromHours 1.
UserID = getMACAddress()
UserID =
getMACAddress()
|> Option.defaultValue "9bb2b109-bf08-4342-9e09-f4ce3fb01c0f" // TODO: load from some config
TagServer = "https://audio-hub.azurewebsites.net" // TODO: load from some config
Volume = 0.5 // TODO: load from webserver
RFID = None
Expand Down Expand Up @@ -281,7 +282,6 @@ let update (msg:Msg) (model:Model) =
model,
Cmd.batch [
Cmd.ofMsg DiscoverStartup
// [fun dispatch -> discoverAllYoutubeLinks (dispatch,model) |> Async.AwaitTask |> Async.StartImmediate ]
[fun dispatch -> rfidLoop (dispatch,model.NodeServices) |> Async.AwaitTask |> Async.StartImmediate ]
]

Expand Down
7 changes: 4 additions & 3 deletions src/Server/AzureTable.fs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ let mapLink (entity: DynamicTableEntity) : Link =
Url = getStringProperty "Url" entity }

let mapTag (entity: DynamicTableEntity) : Tag =
{ Token = entity.RowKey
{ UserID = entity.PartitionKey
Token = entity.RowKey
Description = getStringProperty "Description" entity
Object = getStringProperty "Object" entity
LastVerified = getOptionalDateTimeOffsetProperty "LastVerified" entity |> Option.defaultValue DateTimeOffset.MinValue
Expand All @@ -149,9 +150,9 @@ let mapTag (entity: DynamicTableEntity) : Tag =
| Ok action -> action }


let saveTag (userID:string) (tag:Tag) =
let saveTag (tag:Tag) =
let entity = DynamicTableEntity()
entity.PartitionKey <- userID
entity.PartitionKey <- tag.UserID
entity.RowKey <- tag.Token
entity.Properties.["Action"] <- EntityProperty.GeneratePropertyForString (TagAction.Encoder tag.Action |> Encode.toString 0)
entity.Properties.["Description"] <- EntityProperty.GeneratePropertyForString tag.Description
Expand Down
41 changes: 21 additions & 20 deletions src/Server/Server.fs
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ let uploadEndpoint (token:string) =
Action = tagAction
Description = ""
LastVerified = DateTimeOffset.UtcNow
UserID = "temp"
Object = "" }
let! _saved = AzureTable.saveTag token tag
let! _saved = AzureTable.saveTag tag
let! tag = mapBlobMusikTag tag
let txt = Tag.Encoder tag |> Encode.toString 0
return! setBodyFromString txt next ctx
Expand All @@ -134,6 +135,7 @@ let tagEndpoint (userID,token) =
| _ ->
let t = {
Token = token
UserID = userID
Action = TagAction.UnknownTag
LastVerified = DateTimeOffset.MinValue
Description = ""
Expand Down Expand Up @@ -195,22 +197,32 @@ let firmwareEndpoint =
})
}

let youtubeEndpoint =
pipeline {
set_header "Content-Type" "application/json"
plug (fun next ctx -> task {

let! tags = getAllTags()
for tag in tags do
let discoverYoutube() = task {
try
let! tags = getAllTags()
for tag in tags do
try
match tag.Action with
| TagAction.PlayYoutube url ->
let! _,urls = discoverYoutubeLink url
let urls =
urls
|> Array.filter (fun x -> x.Contains "&mime=audio")
let! _ = saveLinks tag urls
let! _ = saveTag { tag with LastVerified = DateTimeOffset.UtcNow }
()
| _ -> ()
with
| _ -> ()
with
| _ -> ()
}

let youtubeEndpoint =
pipeline {
set_header "Content-Type" "application/json"
plug (fun next ctx -> task {
do! discoverYoutube()
let! _,urls = discoverYoutubeLink "https://www.youtube.com/watch?v=DeTePthFfDY"
let txt = sprintf "%A" urls
return! setBodyFromString txt next ctx
Expand Down Expand Up @@ -242,7 +254,6 @@ let configureSerialization (services:IServiceCollection) =
services



let configureApp (app : IApplicationBuilder) =
app.UseWebSockets(Giraffe.WebSocket.DefaultWebSocketOptions)

Expand All @@ -258,17 +269,7 @@ let app = application {

let discoverTask = task {
while true do
let! tags = getAllTags()
for tag in tags do
match tag.Action with
| TagAction.PlayYoutube url ->
let! _,urls = discoverYoutubeLink url
let urls =
urls
|> Array.filter (fun x -> x.Contains "&mime=audio")
let! _ = saveLinks tag urls
()
| _ -> ()
do! discoverYoutube()
do! Task.Delay (1000 * 60 * 20)
return ()
}
Expand Down
3 changes: 3 additions & 0 deletions src/Shared/Shared.fs
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,14 @@ type Tag =
Object : string
Description : string
LastVerified : DateTimeOffset
UserID : string
Action : TagAction }

static member Encoder (tag : Tag) =
Encode.object [
"Token", Encode.string tag.Token
"Description", Encode.string tag.Description
"UserID", Encode.string tag.UserID
"Object", Encode.string tag.Object
"LastVerified", Encode.datetimeOffset tag.LastVerified
"Action", TagAction.Encoder tag.Action
Expand All @@ -132,6 +134,7 @@ type Tag =
{ Token = get.Required.Field "Token" Decode.string
Object = get.Required.Field "Object" Decode.string
Description = get.Required.Field "Description" Decode.string
UserID = get.Required.Field "UserID" Decode.string
LastVerified =
get.Optional.Field "LastVerified" Decode.datetimeOffset
|> Option.defaultValue DateTimeOffset.MinValue
Expand Down
Loading

0 comments on commit ced89ec

Please sign in to comment.