Skip to content

Commit

Permalink
Merge branch 'main' into skander/spectrograms
Browse files Browse the repository at this point in the history
  • Loading branch information
skanderm committed Sep 10, 2024
2 parents 23ef5a1 + 07e524c commit 15efa10
Show file tree
Hide file tree
Showing 20 changed files with 554 additions and 109 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@429e1977040da7a23b6822b13c129cd1ba93dbb2 # v3.26.2
uses: github/codeql-action/init@2c779ab0d087cd7fe7b826087247c2c81f27bfa6 # v3.26.5
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -60,7 +60,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@429e1977040da7a23b6822b13c129cd1ba93dbb2 # v3.26.2
uses: github/codeql-action/autobuild@2c779ab0d087cd7fe7b826087247c2c81f27bfa6 # v3.26.5

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -73,6 +73,6 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@429e1977040da7a23b6822b13c129cd1ba93dbb2 # v3.26.2
uses: github/codeql-action/analyze@2c779ab0d087cd7fe7b826087247c2c81f27bfa6 # v3.26.5
with:
category: "/language:${{matrix.language}}"
2 changes: 1 addition & 1 deletion .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard (optional).
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@429e1977040da7a23b6822b13c129cd1ba93dbb2 # v3.26.2
uses: github/codeql-action/upload-sarif@2c779ab0d087cd7fe7b826087247c2c81f27bfa6 # v3.26.5
with:
sarif_file: results.sarif
2 changes: 1 addition & 1 deletion server/lib/orcasite/radio/feed.ex
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,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
21 changes: 20 additions & 1 deletion server/lib/orcasite/radio/feed_stream_queue.ex
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ defmodule Orcasite.Radio.FeedStreamQueue do
end
end)
|> Enum.flat_map(fn %{"s3" => %{"object" => %{"key" => object_path}}} ->
if String.ends_with?(object_path, ".m3u8") do
if String.ends_with?(object_path, ".m3u8") and
select_recent_timestamp(object_path, ~U[2024-09-09 00:00:00Z]) do
[%{m3u8_path: object_path}]
else
[]
Expand All @@ -71,4 +72,22 @@ defmodule Orcasite.Radio.FeedStreamQueue do

messages
end

def select_recent_timestamp(object_path, after_date) do
with {:path, %{"timestamp" => timestamp}} <-
{:path,
Regex.named_captures(
~r|(?<node_name>[^/]+)/hls/(?<timestamp>[^/]+)/live.m3u8|,
object_path
)},
timestamp_time =
timestamp
|> String.to_integer()
|> DateTime.from_unix!(),
:gt <- DateTime.compare(timestamp_time, after_date) do
true
else
_ -> false
end
end
end
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
Loading

0 comments on commit 15efa10

Please sign in to comment.