Skip to content

Commit

Permalink
Update frontend to make use of feed's bucket for HLS stream (#620)
Browse files Browse the repository at this point in the history
  • Loading branch information
skanderm committed Sep 10, 2024
1 parent 4685750 commit 6cb8ca8
Show file tree
Hide file tree
Showing 13 changed files with 427 additions and 25 deletions.
2 changes: 1 addition & 1 deletion server/lib/orcasite/radio/feed.ex
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ defmodule Orcasite.Radio.Feed do
attribute :intro_html, :string, default: "", public?: true
attribute :image_url, :string, default: "", public?: true
attribute :visible, :boolean, default: true, public?: true
attribute :bucket, :string, public?: true
attribute :bucket, :string, public?: true, allow_nil?: false
attribute :bucket_region, :string, public?: true
attribute :cloudfront_url, :string, public?: true
attribute :dataplicity_id, :string, public?: true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
defmodule Orcasite.Repo.Migrations.UpdateFeedBucketNonNull do
@moduledoc """
Updates resources based on their most recent snapshots.
This file was autogenerated with `mix ash_postgres.generate_migrations`
"""

use Ecto.Migration

def up do
alter table(:feeds) do
modify :bucket, :text, null: false
end
end

def down do
alter table(:feeds) do
modify :bucket, :text, null: true
end
end
end
317 changes: 317 additions & 0 deletions server/priv/resource_snapshots/repo/feeds/20240909214708.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,317 @@
{
"attributes": [
{
"allow_nil?": false,
"default": "fragment(\"uuid_generate_v7()\")",
"generated?": false,
"primary_key?": true,
"references": null,
"size": null,
"source": "id",
"type": "uuid"
},
{
"allow_nil?": false,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "name",
"type": "text"
},
{
"allow_nil?": false,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "node_name",
"type": "text"
},
{
"allow_nil?": false,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "slug",
"type": "text"
},
{
"allow_nil?": false,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "location_point",
"type": "geometry"
},
{
"allow_nil?": true,
"default": "\"\"",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "intro_html",
"type": "text"
},
{
"allow_nil?": true,
"default": "\"\"",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "image_url",
"type": "text"
},
{
"allow_nil?": true,
"default": "true",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "visible",
"type": "boolean"
},
{
"allow_nil?": false,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "bucket",
"type": "text"
},
{
"allow_nil?": true,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "bucket_region",
"type": "text"
},
{
"allow_nil?": true,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "cloudfront_url",
"type": "text"
},
{
"allow_nil?": true,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "dataplicity_id",
"type": "text"
},
{
"allow_nil?": true,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "orcahello_id",
"type": "text"
},
{
"allow_nil?": false,
"default": "fragment(\"(now() AT TIME ZONE 'utc')\")",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "inserted_at",
"type": "utc_datetime_usec"
},
{
"allow_nil?": false,
"default": "fragment(\"(now() AT TIME ZONE 'utc')\")",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "updated_at",
"type": "utc_datetime_usec"
}
],
"base_filter": null,
"check_constraints": [],
"custom_indexes": [
{
"all_tenants?": false,
"concurrently": false,
"error_fields": [
"name"
],
"fields": [
{
"type": "atom",
"value": "name"
}
],
"include": null,
"message": null,
"name": null,
"nulls_distinct": true,
"prefix": null,
"table": null,
"unique": false,
"using": null,
"where": null
},
{
"all_tenants?": false,
"concurrently": false,
"error_fields": [
"node_name"
],
"fields": [
{
"type": "atom",
"value": "node_name"
}
],
"include": null,
"message": null,
"name": null,
"nulls_distinct": true,
"prefix": null,
"table": null,
"unique": false,
"using": null,
"where": null
},
{
"all_tenants?": false,
"concurrently": false,
"error_fields": [
"visible"
],
"fields": [
{
"type": "atom",
"value": "visible"
}
],
"include": null,
"message": null,
"name": null,
"nulls_distinct": true,
"prefix": null,
"table": null,
"unique": false,
"using": null,
"where": null
},
{
"all_tenants?": false,
"concurrently": false,
"error_fields": [
"slug"
],
"fields": [
{
"type": "atom",
"value": "slug"
}
],
"include": null,
"message": null,
"name": null,
"nulls_distinct": true,
"prefix": null,
"table": null,
"unique": false,
"using": null,
"where": null
},
{
"all_tenants?": false,
"concurrently": false,
"error_fields": [
"dataplicity_id"
],
"fields": [
{
"type": "atom",
"value": "dataplicity_id"
}
],
"include": null,
"message": null,
"name": null,
"nulls_distinct": true,
"prefix": null,
"table": null,
"unique": false,
"using": null,
"where": null
},
{
"all_tenants?": false,
"concurrently": false,
"error_fields": [
"orcahello_id"
],
"fields": [
{
"type": "atom",
"value": "orcahello_id"
}
],
"include": null,
"message": null,
"name": null,
"nulls_distinct": true,
"prefix": null,
"table": null,
"unique": false,
"using": null,
"where": null
}
],
"custom_statements": [],
"has_create_action": true,
"hash": "7FDF1C3B2AAFBFB7E5DFBE36CD16249F0B95A8F78F8927EE095669FC0F259BB4",
"identities": [
{
"all_tenants?": false,
"base_filter": null,
"index_name": "feeds_unique_slug_index",
"keys": [
{
"type": "atom",
"value": "slug"
}
],
"name": "unique_slug",
"nils_distinct?": true,
"where": null
}
],
"multitenancy": {
"attribute": null,
"global": null,
"strategy": null
},
"repo": "Elixir.Orcasite.Repo",
"schema": null,
"table": "feeds"
}
1 change: 1 addition & 0 deletions server/test/orcasite_web/graphql/moderator_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ defmodule OrcasiteWeb.ModeratorTest do
lat_lng_string: "48.5583362, -123.1735774",
name: "Orcasound Lab (Haro Strait)",
node_name: "rpi_orcasound_lab",
bucket: "streaming-orcasound-net",
slug: "orcasound-lab"
}
)
Expand Down
1 change: 1 addition & 0 deletions server/test/orcasite_web/graphql/radio_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ defmodule OrcasiteWeb.RadioTest do
lat_lng_string: "48.5583362, -123.1735774",
name: "Orcasound Lab (Haro Strait)",
node_name: "rpi_orcasound_lab",
bucket: "streaming-orcasound-net",
slug: "orcasound-lab"
}
)
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/DetectionsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function DetectionsTable({
onDetectionUpdate,
}: {
detections: Detection[];
feed: Pick<Feed, "slug" | "nodeName">;
feed: Pick<Feed, "slug" | "nodeName" | "bucket">;
candidate: Pick<Candidate, "id" | "visible">;
onDetectionUpdate: () => void;
}) {
Expand Down
4 changes: 2 additions & 2 deletions ui/src/components/Player/DetectionsPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function DetectionsPlayer({
endOffset,
onAudioPlay,
}: {
feed: Pick<Feed, "nodeName">;
feed: Pick<Feed, "nodeName" | "bucket">;
marks: { label: string; value: number }[];
timestamp: number;
startOffset: number;
Expand All @@ -38,7 +38,7 @@ export function DetectionsPlayer({
const sliderMax = endOffset - startOffset;
const sliderValue = playerTime - startOffset;

const hlsURI = getHlsURI(feed.nodeName, timestamp);
const hlsURI = getHlsURI(feed.bucket, feed.nodeName, timestamp);

const playerOptions = useMemo(
() => ({
Expand Down
Loading

0 comments on commit 6cb8ca8

Please sign in to comment.