source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
jcraigk/phishin
https://github.com/jcraigk/phishin
db/migrate/20240926034415_add_duration_to_playlist_tracks.rb
Ruby
mit
92
main
654
class AddDurationToPlaylistTracks < ActiveRecord::Migration[7.2] def change add_column :playlist_tracks, :duration, :integer add_index :playlist_tracks, :duration add_index :playlist_tracks, :position reversible do |dir| dir.up do # Destroy invalid playlist_tracks PlaylistTrack...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
db/migrate/20250716051621_add_day_of_year_indexes.rb
Ruby
mit
92
main
572
class AddDayOfYearIndexes < ActiveRecord::Migration[8.0] def change # Add index for month extraction - used in day_of_year queries add_index :shows, "extract(month from date)", name: 'index_shows_on_month_extracted' # Add index for day extraction - used in day_of_year queries add_index :shows, "extra...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
db/migrate/20130331022600_create_track_request.rb
Ruby
mit
92
main
239
class CreateTrackRequest < ActiveRecord::Migration def change create_table :track_requests do |t| t.integer :track_id t.integer :user_id t.string :kind t.datetime :created_at end end end
github
jcraigk/phishin
https://github.com/jcraigk/phishin
db/migrate/20240924232957_add_excerpt_cols_to_playlist_tracks.rb
Ruby
mit
92
main
211
class AddExcerptColsToPlaylistTracks < ActiveRecord::Migration[7.2] def change add_column :playlist_tracks, :starts_at_second, :integer add_column :playlist_tracks, :ends_at_second, :integer end end
github
jcraigk/phishin
https://github.com/jcraigk/phishin
db/migrate/20120816185625_create_songs_tracks.rb
Ruby
mit
92
main
250
class CreateSongsTracks < ActiveRecord::Migration def change create_table :songs_tracks do |t| t.references :song t.references :track end add_index :songs_tracks, :song_id add_index :songs_tracks, :track_id end end
github
jcraigk/phishin
https://github.com/jcraigk/phishin
db/migrate/20241002181911_add_cover_art_to_shows.rb
Ruby
mit
92
main
282
class AddCoverArtToShows < ActiveRecord::Migration[7.2] def change add_column :shows, :cover_art_style, :string add_column :shows, :cover_art_hue, :string add_column :shows, :cover_art_prompt, :text add_column :shows, :cover_art_parent_show_id, :integer end end
github
jcraigk/phishin
https://github.com/jcraigk/phishin
db/migrate/20130330035726_add_slug_to_tracks.rb
Ruby
mit
92
main
257
class AddSlugToTracks < ActiveRecord::Migration def change add_column :tracks, :slug, :string # Add indexes for all slugs add_index :tracks, :slug add_index :venues, :slug, unique: true add_index :tours, :slug, unique: true end end
github
jcraigk/phishin
https://github.com/jcraigk/phishin
db/migrate/20250715021565_add_gap_service_optimization_indexes.rb
Ruby
mit
92
main
1,635
class AddGapServiceOptimizationIndexes < ActiveRecord::Migration[8.0] def change # Optimizes: Show.where(date: range).where("performance_gap_value > 0").with_audio add_index :shows, [ :date, :performance_gap_value, :audio_status ], name: 'index_shows_on_date_performance_gap_audio' # Optimiz...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
db/migrate/20120816185619_create_tracks.rb
Ruby
mit
92
main
273
class CreateTracks < ActiveRecord::Migration def change create_table :tracks do |t| t.references :show t.string :title t.integer :position t.integer :duration t.timestamps end add_index :tracks, :show_id end end
github
jcraigk/phishin
https://github.com/jcraigk/phishin
db/migrate/20181028213134_add_slug_to_tags.rb
Ruby
mit
92
main
203
class AddSlugToTags < ActiveRecord::Migration[5.2] def change add_column :tags, :slug, :string add_index :tags, :slug add_index :tags, :priority add_index :tags, :description end end
github
jcraigk/phishin
https://github.com/jcraigk/phishin
db/migrate/20181218030404_more_indexes.rb
Ruby
mit
92
main
283
class MoreIndexes < ActiveRecord::Migration[5.2] def change remove_index :playlist_tracks, name: 'index_playlist_tracks_on_position' add_index :playlist_tracks, %i[position playlist_id], unique: true remove_index :show_tags, name: 'index_show_tags_on_tag_id' end end
github
jcraigk/phishin
https://github.com/jcraigk/phishin
db/migrate/20120816185618_create_songs.rb
Ruby
mit
92
main
293
class CreateSongs < ActiveRecord::Migration def change create_table :songs do |t| t.string :title t.string :slug t.integer :tracks_count, default: 0 t.integer :alias_for t.timestamps end add_index :songs, :title end end
github
jcraigk/phishin
https://github.com/jcraigk/phishin
db/migrate/20130331022752_create_album_requests.rb
Ruby
mit
92
main
291
class CreateAlbumRequests < ActiveRecord::Migration def change create_table :album_requests do |t| t.integer :album_id t.integer :user_id t.string :name t.string :md5 t.string :kind t.datetime :created_at end end end
github
jcraigk/phishin
https://github.com/jcraigk/phishin
db/migrate/20151011195314_populate_tags_counts.rb
Ruby
mit
92
main
287
class PopulateTagsCounts < ActiveRecord::Migration def up execute 'update shows set tags_count=(select count(*) from show_tags where show_id=shows.id)' execute 'update tracks set tags_count=(select count(*) from track_tags where track_id=tracks.id)' end def down; end end
github
jcraigk/phishin
https://github.com/jcraigk/phishin
db/migrate/20181214055931_add_missing_unique_indexes.rb
Ruby
mit
92
main
1,040
class AddMissingUniqueIndexes < ActiveRecord::Migration[5.2] disable_ddl_transaction! def change add_index :users, :username, unique: true, algorithm: :concurrently remove_index :playsts, name: 'index_playlists_on_name' add_index :playlists, :name, unique: true, algorithm: :concurrently remove_ind...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
db/migrate/20250715021900_add_indexes_for_years_api_optimization.rb
Ruby
mit
92
main
268
class AddIndexesForYearsApiOptimization < ActiveRecord::Migration[8.0] def change add_index :shows, [ :audio_status, :venue_id ], name: 'index_shows_on_audio_venue' add_index :shows, "date_part('year', date)", name: 'index_shows_on_year_extracted' end end
github
jcraigk/phishin
https://github.com/jcraigk/phishin
db/migrate/20181217082339_more_indexes_and_cleanup.rb
Ruby
mit
92
main
1,261
class MoreIndexesAndCleanup < ActiveRecord::Migration[5.2] def change remove_column :songs, :alt_title, :string add_index :songs, :slug, unique: true add_index :songs, :title, unique: true remove_index :tags, name: 'index_tags_on_slug' add_index :tags, :slug, unique: true remove_index :track...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
db/migrate/20130525010829_playlist_bookmark.rb
Ruby
mit
92
main
271
class PlaylistBookmark < ActiveRecord::Migration def change create_table :playlist_bookmarks do |t| t.integer :user_id t.integer :playlist_id end add_index :playlist_bookmarks, :user_id add_index :playlist_bookmarks, :playlist_id end end
github
jcraigk/phishin
https://github.com/jcraigk/phishin
db/migrate/20130415030315_add_duration_to_shows.rb
Ruby
mit
92
main
203
class AddDurationToShows < ActiveRecord::Migration def change add_column :shows, :duration, :integer, null: false, default: 0 add_index :shows, :duration add_index :shows, :date end end
github
jcraigk/phishin
https://github.com/jcraigk/phishin
db/migrate/20210411223309_create_active_storage_tables_as_test.active_storage.rb
Ruby
mit
92
main
1,368
# This migration comes from active_storage (originally 20170806125915) class CreateActiveStorageTablesAsTest < ActiveRecord::Migration[5.2] def change create_table :active_storage_blobs do |t| t.string :key, null: false t.string :filename, null: false t.string :content_type ...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
db/migrate/20240712163755_remove_remastered_and_sbd_from_shows.rb
Ruby
mit
92
main
213
class RemoveRemasteredAndSbdFromShows < ActiveRecord::Migration[7.1] def change remove_column :shows, :remastered, :boolean, default: false remove_column :shows, :sbd, :boolean, default: false end end
github
jcraigk/phishin
https://github.com/jcraigk/phishin
config/routes.rb
Ruby
mit
92
main
3,018
require "sidekiq/web" Rails.application.routes.draw do # Health check get "/health", to: proc { [ 200, {}, [ "OK" ] ] } # Agent / bot discovery endpoints get "/sitemap.xml", to: "sitemap#show", as: :sitemap_xml, format: false get "/.well-known/mcp/server-card.json", to: "well_known#mcp_server_card" get "/...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
config/application.rb
Ruby
mit
92
main
2,601
require_relative "boot" require "rails" require "action_controller/railtie" require "action_mailer/railtie" require "action_view/railtie" require "active_record/railtie" require "active_storage/engine" Bundler.require(*Rails.groups) module Phishin class Application < Rails::Application # Custom app config ...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
config/puma.rb
Ruby
mit
92
main
202
require "puma" threads_count = ENV.fetch("RAILS_MAX_THREADS", 5) threads threads_count, threads_count port ENV.fetch("PORT", 3000) environment ENV.fetch("RAILS_ENV", "development") plugin :tmp_restart
github
jcraigk/phishin
https://github.com/jcraigk/phishin
config/sitemap.rb
Ruby
mit
92
main
1,536
SitemapGenerator::Sitemap.default_host = App.base_url SitemapGenerator::Sitemap.sitemaps_path = "sitemap/" SitemapGenerator::Sitemap.create do # rubocop:disable Metrics/BlockLength # Static pages add "/api-docs" add "/contact-info" add "/faq" add "/privacy" add "/tagin-project" add "/terms" # Auth ad...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
config/environments/production.rb
Ruby
mit
92
main
749
Rails.application.configure do config.action_controller.asset_host = App.base_url config.cache_store = :mem_cache_store, ENV.fetch("MEMCACHED_URL"), { expires_in: 10.minutes, pool: false } config.action_controller.perform_caching = true config.action_mailer.smtp_settings = { user_name: ENV.fetch("SMTP_USERN...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
config/environments/test.rb
Ruby
mit
92
main
554
Rails.application.configure do config.action_controller.allow_forgery_protection = false config.action_controller.perform_caching = false config.action_dispatch.show_exceptions = false config.action_mailer.delivery_method = :test config.active_support.deprecation = :silence config.cache_store = :null_store ...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
config/environments/development.rb
Ruby
mit
92
main
824
Rails.application.configure do config.action_controller.asset_host = App.base_url config.action_controller.perform_caching = false config.action_mailer.perform_deliveries = true config.action_mailer.raise_delivery_errors = true config.action_mailer.smtp_settings = { user_name: ENV.fetch("SMTP_USERNAME", n...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
config/initializers/sidekiq.rb
Ruby
mit
92
main
1,081
Sidekiq.default_job_options = { backtrace: true } redis_url = "redis://#{ENV.fetch('IN_DOCKER', false) ? 'redis' : 'localhost'}:6379" redis_config = { url: ENV.fetch("REDIS_URL", redis_url) } Sidekiq.configure_server do |config| config.redis = redis_config config.death_handlers << ->(job, ex) do Sentry.captu...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
config/initializers/attachment_backup.rb
Ruby
mit
92
main
301
Rails.application.configure do config.attachment_backup = { attachments: [ { model: "Show", attachment: "album_cover" }, { model: "Show", attachment: "cover_art" }, { model: "Track", attachment: "mp3_audio" }, { model: "Track", attachment: "png_waveform" } ] } end
github
jcraigk/phishin
https://github.com/jcraigk/phishin
config/initializers/react_on_rails.rb
Ruby
mit
92
main
326
# https://github.com/shakacode/react_on_rails/blob/master/docs/guides/configuration.md ReactOnRails.configure do |config| config.build_test_command = "RAILS_ENV=test bin/shakapacker" config.server_bundle_js_file = "server-bundle.js" config.auto_load_bundle = false config.same_bundle_for_client_and_server = tru...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
config/initializers/sorcery.rb
Ruby
mit
92
main
926
Rails.application.config.sorcery.submodules = %i[ external remember_me reset_password ] Rails.application.config.sorcery.configure do |config| config.cookie_domain = App.web_host config.external_providers = %i[ google ] # Google OAuth config.google.key = App.oauth_google_key config.google.secret = App...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
config/initializers/cors.rb
Ruby
mit
92
main
244
Rails.application.config.middleware.insert_before 0, Rack::Cors do allow do origins "*" resource "*", headers: :any, methods: %i[ get post patch put delete options head ], max_age: 600 end end
github
jcraigk/phishin
https://github.com/jcraigk/phishin
config/initializers/0_react_on_rails_patch.rb
Ruby
mit
92
main
728
# Patch react_on_rails for connection_pool 3.0+ compatibility # TODO: Remove when react_on_rails supports connection_pool 3.0+ require "react_on_rails/server_rendering_pool/ruby_embedded_java_script" if defined?(ConnectionPool::VERSION) && Gem::Version.new(ConnectionPool::VERSION) >= Gem::Version.new("3.0") modul...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/bustout_tag_service.rb
Ruby
mit
92
main
892
class BustoutTagService < ApplicationService include ActiveSupport::NumberHelper MIN_GAP = 100 param :show def call show.tracks.where.not(set: "S").each do |track| track.songs_tracks.each do |songs_track| prev_perf_gap = songs_track.previous_performance_gap next unless prev_perf_gap...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/id3_tag_service.rb
Ruby
mit
92
main
2,322
require "mp3info" class Id3TagService < ApplicationService param :track def call apply_default_tags reattach_modified_audio_file rescue ActiveStorage::FileNotFoundError => e Rails.logger.error "File not found: #{e.message}" ensure @temp_audio_file&.close! end private def apply_default_...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/track_slug_generator.rb
Ruby
mit
92
main
1,194
class TrackSlugGenerator < ApplicationService param :track def call unique_slug_scoped_to_show end private def unique_slug_scoped_to_show "#{base_slug}#{suffix}" end def suffix return if num_dupe_titles_before.zero? "-#{num_dupe_titles_before + 1}" end def num_dupe_titles_before ...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/lore_sync_service.rb
Ruby
mit
92
main
30,111
class LoreSyncService < ApplicationService # TODO: Remove when phish.net corrects 1989-10-13 setlist SKIP_DATES = %w[1989-10-13].freeze option :date, default: -> { nil } option :dates, default: -> { nil } option :start_date, default: -> { nil } option :end_date, default: -> { nil } option :all, default: ...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/search_service.rb
Ruby
mit
92
main
5,610
class SearchService < ApplicationService option :term option :scope, default: proc { "all" } option :audio_status, default: proc { "any" } LIMIT = 50 SCOPES = %w[all playlists shows songs tags tours tracks venues] def call return if term_too_short? results = search_results merge_tag_matches(re...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/waveform_image_service.rb
Ruby
mit
92
main
1,363
class WaveformImageService < ApplicationService param :track def call create_temp_mp3_file convert_mp3_to_wav generate_waveform_image attach_waveform_image remove_temp_files end private def create_temp_mp3_file @temp_mp3 = Tempfile.new([ "track_#{track.id}", ".mp3" ]) @temp_mp3....
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/track_tag_sync_service.rb
Ruby
mit
92
main
2,451
require "csv" class TrackTagSyncService < ApplicationService include ActionView::Helpers::SanitizeHelper attr_reader :track, :created_ids, :updated_ids, :missing_tracks param :tag_name param :data def call @track = nil @missing_tracks = [] @created_ids = [] @updated_ids = [] sync_trac...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/cover_art_prompt_service.rb
Ruby
mit
92
main
8,530
class CoverArtPromptService < ApplicationService param :show HUES = %w[ Red Orange Yellow Green Blue Purple Red-Orange Yellow-Orange Yellow-Green Pink Magenta Vermilion Blue-Green Cerulean Scarlet Cyan Teal Turquoise Indigo Lavender Amethyst Lime Mint Crimson Maroon Beige Peach Coral Amber ...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/cover_art_image_service.rb
Ruby
mit
92
main
1,268
class CoverArtImageService < ApplicationService param :show option :dry_run, default: -> { false } def call generate_and_save_cover_art end private def generate_and_save_cover_art # Use the parent show's cover art if part of a run if show.cover_art_parent_show_id parent_show = Show.find...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/meta_tag_service.rb
Ruby
mit
92
main
6,430
class MetaTagService < ApplicationService param :path TITLE_SUFFIX = " - #{App.app_name}" BASE_TITLE = App.app_name RESOURCES = { "play" => Playlist, "songs" => Song, "tags" => Tag, "venues" => Venue } TITLES = { "/api-docs" => "API Docs", "/contact-info" => "Contact Info", "/...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/chronological_track_navigator.rb
Ruby
mit
92
main
3,434
class ChronologicalTrackNavigator < ApplicationService EXCLUDED_SETS = %w[S P].freeze param :track option :direction, default: -> { :next } def call case direction.to_sym when :next find_next_track when :prev, :previous find_previous_track else raise ArgumentError, "Invalid d...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/gap_investigation_service.rb
Ruby
mit
92
main
15,017
class GapInvestigationService < ApplicationService param :show_date param :track_title def call @show = Show.find_by(date: show_date) return { error: "Show not found for date: #{show_date}" } unless @show @track = find_track_by_title(track_title) return { error: "Track '#{track_title}' not found...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/user_jwt_service.rb
Ruby
mit
92
main
286
class UserJwtService < ApplicationService param :user def call jwt_for_user end private def jwt_for_user JWT.encode( { sub: user.id, exp: (Time.now + 1.year).to_i }, Rails.application.secret_key_base, "HS256" ) end end
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/track_inserter.rb
Ruby
mit
92
main
1,434
class TrackInserter attr_reader :date, :position, :file, :title, :song_id, :set, :track, :slug def initialize(opts = {}) @date = opts[:date] @position = opts[:position].to_i @file = opts[:file] @title = opts[:title] @song_id = opts[:song_id] || Song.find_by(title:)&.id @set = opts[:set] ...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/performance_analysis_service.rb
Ruby
mit
92
main
692
class PerformanceAnalysisService < ApplicationService option :analysis_type option :filters, default: -> { {} } ANALYZERS = { gaps: PerformanceAnalysis::GapsAnalyzer, transitions: PerformanceAnalysis::TransitionsAnalyzer, set_positions: PerformanceAnalysis::SetPositionsAnalyzer, geographic: Perfo...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/gap_service.rb
Ruby
mit
92
main
10,719
# This service is used to calculate the gaps between performances # of the same song across different shows. # If update_previous is true, it will also update the `next` gaps for # previous occurrences of songs that were played at specified show. class GapService < ApplicationService param :show option :update_pr...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/jamcharts_importer.rb
Ruby
mit
92
main
3,151
class JamchartsImporter < ApplicationService include ActionView::Helpers::SanitizeHelper BASE_URL = "https://api.phish.net/v5".freeze API_KEY = ENV.fetch("PNET_API_KEY", nil) attr_reader :invalid_items, :missing_shows, :matched_ids param :api_key def call @invalid_items = [] @missing_shows = [] ...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/google_spreadsheet_fetcher.rb
Ruby
mit
92
main
4,616
require "webrick" require "securerandom" require "uri" require "google/apis/sheets_v4" require "googleauth" require "googleauth/stores/file_token_store" class GoogleSpreadsheetFetcher < ApplicationService attr_reader :spreadsheet_id, :range, :has_headers REDIRECT_PORT = 8000 REDIRECT_HOST = "localhost" param...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/interactive_cover_art_service.rb
Ruby
mit
92
main
4,919
class InteractiveCoverArtService < ApplicationService include ActionView::Helpers::TextHelper class InterruptError < StandardError; end param :relation NUM_IMAGES = 2 def prompt_for_zoom print "Zoom (0-50)% 👉 " $stdin.gets.chomp.to_i end def call setup_progress_bar if relation.count > 1 ...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/markdown_view_service.rb
Ruby
mit
92
main
6,992
class MarkdownViewService < ApplicationService include ActionView::Helpers::NumberHelper param :path def call return homepage_markdown if segments.empty? return show_markdown if date? && slug.nil? return track_markdown if date? && slug.present? return song_markdown if resource_type == "songs" &&...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/album_cover_service.rb
Ruby
mit
92
main
3,198
require "mini_magick" class AlbumCoverService < ApplicationService param :show def call return unless show.cover_art.attached? create_album_cover end private def create_album_cover composite_text_on_cover_art attach_album_cover end def composite_text_on_cover_art # Download the co...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/debut_tag_service.rb
Ruby
mit
92
main
487
class DebutTagService < ApplicationService param :show def call show.tracks.where.not(set: "S").each do |track| track.songs.each do |song| next unless song.tracks_count == 1 apply_debut_tag(track) end end end private def apply_debut_tag(track) ttag = track.track_tags...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/show_importer/show_info.rb
Ruby
mit
92
main
832
require "ostruct" class ShowImporter::ShowInfo BASE_URL = "https://api.phish.net/v5".freeze API_KEY = ENV.fetch("PNET_API_KEY", nil) attr_reader :date, :data, :songs def initialize(date) @date = date @data = fetch_pnet_data @songs ||= {} abort "Date \"#{date}\" not found on Phish.net" if dat...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/show_importer/filename_matcher.rb
Ruby
mit
92
main
1,042
class ShowImporter::FilenameMatcher attr_reader :matches, :dir def initialize(dir) @dir = dir @matches = {} match_filenames_with_songs end def find_song(term, opts = {}) return Song.where("lower(title) = ?", term.downcase).first if opts[:exact] Song.kinda_matching(term).first end pri...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/show_importer/cli.rb
Ruby
mit
92
main
4,044
require "reline" class ShowImporter::Cli attr_reader :orch def initialize(date) puts "📅 Preparing #{date}" @orch = ShowImporter::Orchestrator.new(date) ShowImporter::TrackReplacer.new(date) && return if orch.show_found repl end def main_menu print_header orch.pp_list puts "\n\n...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/show_importer/orchestrator.rb
Ruby
mit
92
main
5,800
class ShowImporter::Orchestrator attr_reader :fm, :date, :show_found, :path, :show_info SET_MAP = { "3" => %w[III], "E" => %w[E e I-e II-e III-e], "2" => %w[II], "1" => %w[I], "S" => %w[(Check)] }.freeze def initialize(date) # rubocop:disable Metrics/MethodLength Track.attr_accessor(:f...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/show_importer/track_replacer.rb
Ruby
mit
92
main
2,358
class ShowImporter::TrackReplacer attr_reader :date, :track_hash def initialize(date) @date = date @show = Show.find_by(date:) @track_hash = match_files_to_tracks ensure_tracks_present ensure_all_tracks_matched replace_audio_on_tracks if prompt_for_replacement == "Y" end def match_fi...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/performance_analysis/base_analyzer.rb
Ruby
mit
92
main
2,263
module PerformanceAnalysis class BaseAnalyzer EXCLUDED_SETS = %w[S P].freeze EXCLUDED_SONGS = %w[soundcheck].freeze attr_reader :filters def initialize(filters: {}) @filters = filters end def call raise NotImplementedError, "Subclasses must implement #call" end private ...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/performance_analysis/co_occurrence_analyzer.rb
Ruby
mit
92
main
6,174
module PerformanceAnalysis class CoOccurrenceAnalyzer < BaseAnalyzer def call song_a_slug = filters[:song_slug] song_b_slug = filters[:song_b_slug] return { error: "song_slug required" } unless song_a_slug if song_b_slug analyze_song_pair(song_a_slug, song_b_slug) else ...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/performance_analysis/song_frequency_analyzer.rb
Ruby
mit
92
main
1,466
module PerformanceAnalysis class SongFrequencyAnalyzer < BaseAnalyzer def call song_counts = base_tracks.where.not(songs: { slug: EXCLUDED_SONGS }) .group("songs.id", "songs.title", "songs.slug") .select( "songs.i...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/performance_analysis/transitions_analyzer.rb
Ruby
mit
92
main
10,205
module PerformanceAnalysis class TransitionsAnalyzer < BaseAnalyzer DIRECTION_CONFIG = { "after" => { comparison: ">", order: "ASC" }, "before" => { comparison: "<", order: "DESC" } }.freeze def call song_slug = filters[:song_slug] direction = filters[:direction] || "after" ...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/performance_analysis/geographic_analyzer.rb
Ruby
mit
92
main
3,532
module PerformanceAnalysis class GeographicAnalyzer < BaseAnalyzer def call geo_type = filters[:geo_type] || "state_frequency" case geo_type when "state_frequency" analyze_state_frequency when "never_played" analyze_never_played_in_state when "state_debuts" a...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/performance_analysis/gaps_analyzer.rb
Ruby
mit
92
main
2,038
module PerformanceAnalysis class GapsAnalyzer < BaseAnalyzer def call min_gap = filters[:min_gap] || 20 min_plays = filters[:min_plays] || 2 song_gaps = Song.joins(tracks: :show) .where.not(tracks: { set: EXCLUDED_SETS }) .where.not(songs: { slug: EXC...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/performance_analysis/set_positions_analyzer.rb
Ruby
mit
92
main
5,502
module PerformanceAnalysis class SetPositionsAnalyzer < BaseAnalyzer def call position_type = filters[:position] case position_type when "opener" analyze_openers when "closer" analyze_closers when "encore" analyze_encores else analyze_song_posit...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/backup/attachment_service.rb
Ruby
mit
92
main
4,604
module Backup class AttachmentService < BaseService BATCH_SIZE = 100 param :model_name, proc(&:to_s) param :attachment_name, proc(&:to_s) param :existing_keys, default: -> { nil } def call model_class = model_name.constantize log_info("Starting backup of #{model_name}.#{attachment_n...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/backup/listing_service.rb
Ruby
mit
92
main
875
module Backup class ListingService < BaseService def call log_info("Collecting existing S3 keys...") existing_keys = collect_existing_s3_keys log_info("Found #{existing_keys.size} existing keys in S3") existing_keys end private def collect_existing_s3_keys existing_keys...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/backup/base_service.rb
Ruby
mit
92
main
706
module Backup class BaseService < ApplicationService extend Dry::Initializer protected def s3_client @s3_client ||= Aws::S3::Client.new( region: ENV.fetch("AWS_REGION", "us-east-1"), access_key_id: ENV["AWS_ACCESS_KEY_ID"], secret_access_key: ENV["AWS_SECRET_A...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/services/backup/cleanup_service.rb
Ruby
mit
92
main
3,493
module Backup class CleanupService < BaseService BATCH_SIZE = 100 def call log_info("Collecting valid attachment keys...") valid_keys = collect_valid_attachment_keys log_info("Found #{valid_keys.size} valid attachment keys") s3_objects = ListingService.call log_info("Checking ...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/views/feeds/rss.xml.builder
Ruby
mit
92
main
445
xml.instruct! :xml, version: "1.0" xml.rss version: "2.0" do xml.channel do xml.title "#{App.app_name} Updates" xml.description App.app_desc xml.link App.base_url @announcements.each do |announcement| xml.item do xml.title announcement.title xml.description announcement.descript...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/controllers/mcp_controller.rb
Ruby
mit
92
main
860
class McpController < ApplicationController skip_before_action :verify_authenticity_token rescue_from ActionDispatch::Http::Parameters::ParseError, with: :handle_parse_error def handle body = request.body.read response_json = server.handle_json(body) response.headers["Mcp-Session-Id"] = "stateless" ...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/controllers/downloads_controller.rb
Ruby
mit
92
main
1,075
class DownloadsController < ApplicationController def download_track raise ActiveRecord::RecordNotFound if track.blank? return head(:not_found) unless track.mp3_audio.attached? send_file_response(track.mp3_audio, "attachment", track.mp3_audio.blob.filename.to_s) end def download_blob raise Active...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/controllers/sitemap_controller.rb
Ruby
mit
92
main
396
require "zlib" class SitemapController < ActionController::Base def show path = Rails.root.join("public", "sitemap", "sitemap.xml.gz") return head(:not_found) unless File.exist?(path) expires_in 1.hour, public: true send_data( Zlib::GzipReader.open(path, &:read), type: "application/xml",...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/controllers/mcp_oauth_controller.rb
Ruby
mit
92
main
2,555
# Dummy OAuth server to satisfy Anthropic's MCP connector setup flow. # The MCP server requires no authentication, but Anthropic's client # unconditionally performs OAuth discovery (RFC 9728) and dynamic client # registration (RFC 7591) when adding a connector. Without valid responses # for these endpoints, the connect...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/controllers/application_controller.rb
Ruby
mit
92
main
2,394
class ApplicationController < ActionController::Base AGENT_LINK_HEADERS = [ %(</llms.txt>; rel="llms"; type="text/plain"), %(</sitemap.xml>; rel="sitemap"; type="application/xml"), %(</.well-known/mcp/server-card.json>; rel="mcp_server"; type="application/json"), %(</.well-known/agent-card.json>; rel=...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/controllers/well_known_controller.rb
Ruby
mit
92
main
6,011
class WellKnownController < ActionController::Base HTTP_CACHE_TTL = 1.hour def mcp_server_card cache_json( schema_version: "2025-06-18", protocolVersion: "2025-03-26", name: "phishin", title: App.app_name, description: App.app_desc, version: "1.0.0", serverInfo: { name...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/controllers/oauth/sorcery_controller.rb
Ruby
mit
92
main
2,437
require "typhoeus" class Oauth::SorceryController < ApplicationController before_action :ensure_allowed_provider, only: %i[login callback] def login state = SecureRandom.hex(32) session[:oauth_state] = state login_at(provider, state:) end def callback expected_state = session.delete(:oauth_st...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/controllers/api/v1/search_controller.rb
Ruby
mit
92
main
515
class Api::V1::SearchController < Api::V1::ApiController def index return respond_with_invalid_term unless results respond_with_success results end private def results @results ||= SearchService.call(term: params[:term], scope: "all", audio_status: "complete_or_partial")&.except(:tours) end d...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/controllers/api/v1/tours_controller.rb
Ruby
mit
92
main
337
class Api::V1::ToursController < Api::V1::ApiController caches_action_params :index caches_action_params :show def index respond_with_success get_data_for(tour_scope) end def show respond_with_success tour_scope.friendly.find(params[:id]) end private def tour_scope Tour.includes(shows: :...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/controllers/api/v1/eras_controller.rb
Ruby
mit
92
main
316
class Api::V1::ErasController < Api::V1::ApiController caches_action_params :index caches_action_params :show, %i[id] def index respond_with_success(ERAS) end def show return respond_with_success(ERAS["#{params[:id]}.0"]) if params[:id].to_i.in?([ 1, 2, 3 ]) respond_with_not_found end end
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/controllers/api/v1/years_controller.rb
Ruby
mit
92
main
1,358
class Api::V1::YearsController < Api::V1::ApiController caches_action_params :index, %i[include_show_counts] caches_action_params :show def index respond_with_success(requested_year_data) end def show return respond_with_success(shows_that_year) if requested_years respond_with_not_found end ...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/controllers/api/v1/tags_controller.rb
Ruby
mit
92
main
283
class Api::V1::TagsController < Api::V1::ApiController caches_action_params :index caches_action_params :show def index respond_with_success(get_data_for(Tag), serialize_method: :as_json) end def show respond_with_success Tag.friendly.find(params[:id]) end end
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/controllers/api/v1/tracks_controller.rb
Ruby
mit
92
main
462
class Api::V1::TracksController < Api::V1::ApiController caches_action_params :index caches_action_params :show def index tracks = params[:tag] ? Track.tagged_with(params[:tag]) : track_scope respond_with_success get_data_for(tracks) end def show respond_with_success Track.includes(:tags, :show)...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/controllers/api/v1/shows_controller.rb
Ruby
mit
92
main
2,152
class Api::V1::ShowsController < Api::V1::ApiController caches_action_params :index caches_action_params :show caches_action_params :on_date, %i[date] caches_action_params :on_day_of_year, %i[day] def index shows = Show.with_audio.includes(:venue, :tags, tracks: %i[songs tags]) shows = shows.tagged_w...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/controllers/api/v1/songs_controller.rb
Ruby
mit
92
main
589
class Api::V1::SongsController < Api::V1::ApiController caches_action_params :index caches_action_params :show def index respond_with_success get_data_for(Song), serialize_method: :as_json end def show respond_with_success song_scope.friendly.find(params[:id]) end private def song_scope ...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/controllers/api/v1/playlists_controller.rb
Ruby
mit
92
main
399
class Api::V1::PlaylistsController < Api::V1::ApiController caches_action_params :show, %i[id] def show return respond_with_not_found unless playlist respond_with_success playlist end private def playlist @playlist ||= Playlist.where(id: params[:id]) .or(Playlist.where(slug:...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/controllers/api/v1/api_controller.rb
Ruby
mit
92
main
2,359
class Api::V1::ApiController < ActionController::Base # rubocop:disable Rails/ApplicationController include ApiAuth before_action :require_auth after_action :set_json_content_type rescue_from ActiveRecord::RecordNotFound, with: :respond_with_not_found def self.caches_action_params(action, params = []) ...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/controllers/api/v1/venues_controller.rb
Ruby
mit
92
main
260
class Api::V1::VenuesController < Api::V1::ApiController caches_action_params :index caches_action_params :show def index respond_with_success get_data_for(Venue) end def show respond_with_success Venue.friendly.find(params[:id]) end end
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/controllers/concerns/api_auth.rb
Ruby
mit
92
main
735
module ApiAuth def require_auth return missing_key if key_from_header.blank? return invalid_key if api_key.blank? true end private def api_key @api_key ||= ApiKey.active.find_by(key: key_from_header) end def key_from_header @key_from_header ||= (request.authorization || request....
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/models/playlist_track.rb
Ruby
mit
92
main
1,054
class PlaylistTrack < ApplicationRecord belongs_to :playlist, counter_cache: :tracks_count belongs_to :track validates :position, numericality: { only_integer: true }, uniqueness: { scope: :playlist_id } before_save :assign_duration after_create :save_playlist_duration after_update...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/models/venue.rb
Ruby
mit
92
main
2,886
class Venue < ApplicationRecord has_many :shows, dependent: :nullify has_many :venue_renames, dependent: :destroy has_one_attached :map_snapshot extend FriendlyId friendly_id :name, use: :slugged geocoded_by :address validates :city, presence: true validates :country, presence: true validates :nam...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/models/song.rb
Ruby
mit
92
main
1,477
class Song < ApplicationRecord has_many :songs_tracks, dependent: :destroy has_many :tracks, through: :songs_tracks extend FriendlyId friendly_id :title, use: :slugged validates :title, presence: true, uniqueness: true validates :alias, uniqueness: true, allow_nil: true alias_attribute :name, :title ...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/models/playlist.rb
Ruby
mit
92
main
1,684
class Playlist < ApplicationRecord MAX_TRACKS = 250 has_many :playlist_tracks, dependent: :destroy has_many :tracks, through: :playlist_tracks has_many :likes, as: :likable, dependent: :destroy belongs_to :user accepts_nested_attributes_for :playlist_tracks, allow_destroy: true validates :name, ...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/models/api_key.rb
Ruby
mit
92
main
573
class ApiKey < ApplicationRecord scope :revoked, -> { where.not(revoked_at: nil) } scope :not_revoked, -> { where(revoked_at: nil) } scope :active, -> { not_revoked } validates :name, presence: true, uniqueness: true validates :email, presence: true, uniqueness: true validates :key, presence: true, uniquen...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/models/tour.rb
Ruby
mit
92
main
855
class Tour < ApplicationRecord has_many :shows, dependent: :nullify extend FriendlyId friendly_id :name, use: :slugged validates :name, presence: true, uniqueness: true validates :starts_on, presence: true, uniqueness: true validates :ends_on, presence: true, uniqueness: true def as_json { id...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/models/show.rb
Ruby
mit
92
main
3,807
class Show < ApplicationRecord include HasCoverArt include ShowApiV1 include HasAudioStatus belongs_to :tour, counter_cache: true belongs_to :venue, counter_cache: true has_many :tracks, dependent: :destroy has_many :likes, as: :likable, dependent: :destroy has_many :show_tags, dependent: :destroy ha...
github
jcraigk/phishin
https://github.com/jcraigk/phishin
app/models/tag.rb
Ruby
mit
92
main
917
class Tag < ApplicationRecord has_many :show_tags, dependent: :destroy has_many :shows, through: :show_tags has_many :track_tags, dependent: :destroy has_many :tracks, through: :track_tags validates :name, :color, :priority, presence: true validates :name, :priority, uniqueness: true extend FriendlyId ...