Replace Patreon feed with public Acast feed, move transcribers to lib
No secrets needed — both HRN and Acast feeds are public.

Assisted-by: Claude Opus 4.6 via pi
change vkvwtyqrompqlvqxyxsqnyrrlwmkxkwl
commit 37f6b10b206f9e0f3fedfdae1398ef789117987a
author Alpha Chen <alpha@kejadlen.dev>
date
parent usvknoru
diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml
new file mode 100644
index 0000000..fe32523
--- /dev/null
+++ b/.github/workflows/pages.yml
@@ -0,0 +1,46 @@
+name: Deploy transcript site to GitHub Pages
+
+on:
+  push:
+    branches: ["main"]
+  workflow_dispatch:
+
+permissions:
+  contents: read
+  pages: write
+  id-token: write
+
+concurrency:
+  group: "pages"
+  cancel-in-progress: false
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v4
+
+      - name: Set up Ruby
+        uses: ruby/setup-ruby@v1
+        with:
+          bundler-cache: true
+
+      - name: Generate site
+        run: bundle exec rake site
+
+      - name: Upload artifact
+        uses: actions/upload-pages-artifact@v3
+        with:
+          path: site
+
+  deploy:
+    needs: build
+    environment:
+      name: github-pages
+      url: ${{ steps.deployment.outputs.page_url }}
+    runs-on: ubuntu-latest
+    steps:
+      - name: Deploy to GitHub Pages
+        id: deployment
+        uses: actions/deploy-pages@v5
diff --git a/Rakefile b/Rakefile
index e30d099..9a05bc1 100644
--- a/Rakefile
+++ b/Rakefile
@@ -8,7 +8,7 @@ require_relative "lib/episode_task"
 require_relative "lib/feed"
 require_relative "lib/download"
 
-load File.expand_path("lib/tasks/transcribers.rake", __dir__)
+require_relative "lib/transcribers"
 
 CONFIG = CookingIssues::Config.from_env(Transcribers)
 CONFIG.transcriber.register
@@ -28,16 +28,16 @@ file CONFIG.hrn_feed_path.to_s => CONFIG.cache_dir.to_s do
   CONFIG.hrn_feed_path.write(response.body)
 end
 
-file CONFIG.patreon_feed_path.to_s => CONFIG.cache_dir.to_s do
-  puts "Downloading Patreon feed..."
-  CookingIssues::Download.fetch(CONFIG.patreon_feed_url, CONFIG.patreon_feed_path.to_s)
+file CONFIG.acast_feed_path.to_s => CONFIG.cache_dir.to_s do
+  puts "Downloading Acast feed..."
+  CookingIssues::Download.fetch(CONFIG.acast_feed_url, CONFIG.acast_feed_path.to_s)
 end
 
 Rake::Task[CONFIG.hrn_feed_path.to_s].invoke
-Rake::Task[CONFIG.patreon_feed_path.to_s].invoke
+Rake::Task[CONFIG.acast_feed_path.to_s].invoke
 
 episodes = CookingIssues::Feed.parse(CONFIG.hrn_feed_path) +
-           CookingIssues::Feed.parse(CONFIG.patreon_feed_path)
+           CookingIssues::Feed.parse(CONFIG.acast_feed_path)
 
 EPISODE_TASKS = episodes.map.with_index do |ep, i|
   CookingIssues::EpisodeTask.new(index: i, episode: ep, config: CONFIG)
diff --git a/lib/config.rb b/lib/config.rb
index c718cca..6626ab0 100644
--- a/lib/config.rb
+++ b/lib/config.rb
@@ -7,15 +7,15 @@ module CookingIssues
     :transcripts_dir,
     :hrn_feed_path,
     :hrn_feed_url,
-    :patreon_feed_path,
-    :patreon_feed_url,
+    :acast_feed_path,
+    :acast_feed_url,
     :transcriber,
     :transcriber_cache_dir,
     :text_dir
   ) do
     def self.from_env(transcribers)
       cache_dir = Pathname("cache")
-      transcriber = transcribers.resolve(ENV.fetch("TRANSCRIBER", "sous_chef"))
+      transcriber = transcribers.resolve(ENV.fetch("TRANSCRIBER", "sous_chef"), cache_dir: cache_dir)
 
       new(
         cache_dir: cache_dir,
@@ -23,8 +23,8 @@ module CookingIssues
         transcripts_dir: Pathname("transcripts"),
         hrn_feed_path: cache_dir / "hrn_feed.xml",
         hrn_feed_url: "https://rss.art19.com/cooking-issues",
-        patreon_feed_path: cache_dir / "patreon_feed.xml",
-        patreon_feed_url: ENV.fetch("PATREON_FEED_URL"),
+        acast_feed_path: cache_dir / "acast_feed.xml",
+        acast_feed_url: "https://feeds.acast.com/public/shows/cooking-issues-with-dave-arnold",
         transcriber: transcriber,
         transcriber_cache_dir: cache_dir / transcriber.name,
         text_dir: Pathname("transcripts") / transcriber.name
diff --git a/lib/tasks/transcribers.rake b/lib/transcribers.rb
similarity index 91%
rename from lib/tasks/transcribers.rake
rename to lib/transcribers.rb
index c76b38c..bbe248c 100644
--- a/lib/tasks/transcribers.rake
+++ b/lib/transcribers.rb
@@ -1,13 +1,11 @@
 module Transcribers
-  MODELS_DIR = CACHE_DIR / "models"
-  DOWNLOAD_SCRIPT = CACHE_DIR / "download-ggml-model.sh"
   DOWNLOAD_SCRIPT_URL = "https://raw.githubusercontent.com/ggml-org/whisper.cpp/master/models/download-ggml-model.sh"
 
-  def self.resolve(name)
+  def self.resolve(name, cache_dir:)
     case name
     when "whisperx" then Whisperx.new
-    when "whisper-cpp-large" then WhisperCppLarge.new
-    when "whisper-cpp-tdrz" then WhisperCppTdrz.new
+    when "whisper-cpp-large" then WhisperCppLarge.new(cache_dir)
+    when "whisper-cpp-tdrz" then WhisperCppTdrz.new(cache_dir)
     when "sous_chef" then SousChef.new
     when "mlx" then Mlx.new
     when "mlx-diarize" then MlxDiarize.new
@@ -17,10 +15,6 @@ module Transcribers
     end
   end
 
-  def self.model_path(name)
-    MODELS_DIR / "ggml-#{name}.bin"
-  end
-
   class Base
     include Rake::DSL
 
@@ -55,6 +49,12 @@ module Transcribers
     # Milliseconds of silence between segments that triggers a paragraph break.
     PARAGRAPH_GAP_MS = 500
 
+    def initialize(cache_dir)
+      @models_dir = cache_dir / "models"
+      @download_script = cache_dir / "download-ggml-model.sh"
+      @cache_dir = cache_dir
+    end
+
     def render(json_path, txt_path)
       data = JSON.parse(File.read(json_path))
       segments = data["transcription"]
@@ -79,6 +79,10 @@ module Transcribers
 
     private
 
+    def model_path(name)
+      @models_dir / "ggml-#{name}.bin"
+    end
+
     def flush_paragraph(segments)
       timestamp = segments.first["timestamps"]["from"].sub(/^00:/, "")
       text = segments.map { |s| s["text"].strip }.join(" ")
@@ -86,18 +90,18 @@ module Transcribers
     end
 
     def register_model(name)
-      models_dir = MODELS_DIR
-      script = DOWNLOAD_SCRIPT
+      models_dir = @models_dir
+      script = @download_script
 
       directory models_dir.to_s
 
-      file script.to_s => CACHE_DIR.to_s do
+      file script.to_s => @cache_dir.to_s do
         puts "Downloading whisper model script..."
         CookingIssues::Download.fetch(DOWNLOAD_SCRIPT_URL, script.to_s)
         script.chmod(0o755)
       end
 
-      file Transcribers.model_path(name).to_s => [script.to_s, models_dir.to_s] do
+      file model_path(name).to_s => [script.to_s, models_dir.to_s] do
         sh script.to_s, name, models_dir.to_s
       end
     end
@@ -107,7 +111,7 @@ module Transcribers
     MODEL = "large-v3-turbo"
 
     def name = "whisper-cpp-large"
-    def prereqs = [Transcribers.model_path(MODEL).to_s]
+    def prereqs = [model_path(MODEL).to_s]
 
     def register
       register_model(MODEL)
@@ -115,7 +119,7 @@ module Transcribers
 
     def call(audio_path, transcript_path)
       sh "whisper-cli",
-        "--model", Transcribers.model_path(MODEL).to_s,
+        "--model", model_path(MODEL).to_s,
         "--output-json",
         "--output-file", transcript_path.delete_suffix(".json"),
         audio_path
@@ -126,7 +130,7 @@ module Transcribers
     MODEL = "small.en-tdrz"
 
     def name = "whisper-cpp-tdrz"
-    def prereqs = [Transcribers.model_path(MODEL).to_s]
+    def prereqs = [model_path(MODEL).to_s]
 
     def register
       register_model(MODEL)
@@ -134,7 +138,7 @@ module Transcribers
 
     def call(audio_path, transcript_path)
       sh "whisper-cli",
-        "--model", Transcribers.model_path(MODEL).to_s,
+        "--model", model_path(MODEL).to_s,
         "-tdrz",
         "--output-json",
         "--output-file", transcript_path.delete_suffix(".json"),