repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
redis/redis-rb
https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/lib/redis/commands/sorted_sets.rb
lib/redis/commands/sorted_sets.rb
# frozen_string_literal: true class Redis module Commands module SortedSets # Get the number of members in a sorted set. # # @example # redis.zcard("zset") # # => 4 # # @param [String] key # @return [Integer] def zcard(key) send_command([:zcard,...
ruby
MIT
b6e81b2b3fb477cb8612d368d72a0bd179afbfe6
2026-01-04T15:47:51.017627Z
true
redis/redis-rb
https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/lib/redis/commands/server.rb
lib/redis/commands/server.rb
# frozen_string_literal: true class Redis module Commands module Server # Asynchronously rewrite the append-only file. # # @return [String] `OK` def bgrewriteaof send_command([:bgrewriteaof]) end # Asynchronously save the dataset to disk. # # @return [Stri...
ruby
MIT
b6e81b2b3fb477cb8612d368d72a0bd179afbfe6
2026-01-04T15:47:51.017627Z
false
redis/redis-rb
https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/lib/redis/commands/geo.rb
lib/redis/commands/geo.rb
# frozen_string_literal: true class Redis module Commands module Geo # Adds the specified geospatial items (latitude, longitude, name) to the specified key # # @param [String] key # @param [Array] member arguemnts for member or members: longitude, latitude, name # @return [Integer] ...
ruby
MIT
b6e81b2b3fb477cb8612d368d72a0bd179afbfe6
2026-01-04T15:47:51.017627Z
false
redis/redis-rb
https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/lib/redis/commands/lists.rb
lib/redis/commands/lists.rb
# frozen_string_literal: true class Redis module Commands module Lists # Get the length of a list. # # @param [String] key # @return [Integer] def llen(key) send_command([:llen, key]) end # Remove the first/last element in a list, append/prepend it to another li...
ruby
MIT
b6e81b2b3fb477cb8612d368d72a0bd179afbfe6
2026-01-04T15:47:51.017627Z
false
redis/redis-rb
https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/lib/redis/commands/transactions.rb
lib/redis/commands/transactions.rb
# frozen_string_literal: true class Redis module Commands module Transactions # Mark the start of a transaction block. # # @example With a block # redis.multi do |multi| # multi.set("key", "value") # multi.incr("counter") # end # => ["OK", 6] # # ...
ruby
MIT
b6e81b2b3fb477cb8612d368d72a0bd179afbfe6
2026-01-04T15:47:51.017627Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/jobs/attach_cover_image_from_discogs_job.rb
app/jobs/attach_cover_image_from_discogs_job.rb
# frozen_string_literal: true require "open-uri" class AttachCoverImageFromDiscogsJob < ApplicationJob retry_on Integrations::Service::TooManyRequests, wait: 1.minute, attempts: :unlimited queue_as :default def perform(imageable) return if imageable.has_cover_image? discogs_client = Integrations::Disco...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/jobs/media_sync_all_job.rb
app/jobs/media_sync_all_job.rb
# frozen_string_literal: true class MediaSyncAllJob < MediaSyncJob def perform(dir = Setting.media_path) file_paths = MediaFile.file_paths(dir) file_md5_hashes = Parallel.map(file_paths, in_processes: self.class.parallel_processor_count) do |file_path| MediaFile.get_md5_hash(file_path, with_mtime: true...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/jobs/application_job.rb
app/jobs/application_job.rb
# frozen_string_literal: true class ApplicationJob < ActiveJob::Base end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/jobs/media_sync_job.rb
app/jobs/media_sync_job.rb
# frozen_string_literal: true class MediaSyncJob < ApplicationJob include BlackCandy::Configurable has_config :parallel_processor_count, default: Parallel.processor_count, env_prefix: "media_sync" queue_as :critical # Limits the concurrency to 1 to prevent inconsistent media syncing data. limits_concurren...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/presenters/filter_sort_presenter.rb
app/presenters/filter_sort_presenter.rb
# frozen_string_literal: true class FilterSortPresenter def initialize(params) @params = params end def has_filter? params[:filter].present? end def filter_value(key) params[:filter].fetch(key, nil) end def sort_value params[:sort] end def sort_direction_value params[:sort_dir...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/helpers/sessions_helper.rb
app/helpers/sessions_helper.rb
# frozen_string_literal: true module SessionsHelper def logged_in? Current.session.present? end def is_admin? Current.user.is_admin end def login(session) cookies.signed[:session_id] = { value: session.id, expires: 1.year.from_now, httponly: true, secure: BlackCandy.config.force_ssl? } end ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/helpers/song_helper.rb
app/helpers/song_helper.rb
# frozen_string_literal: true module SongHelper def song_json_builder(song, for_api: false) stream_url = for_api ? new_api_v1_stream_url(song_id: song.id) : new_stream_url(song_id: song.id) transcoded_stream_url = for_api ? new_api_v1_transcoded_stream_url(song_id: song.id) : new_transcoded_stream_url(song_i...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/helpers/application_helper.rb
app/helpers/application_helper.rb
# frozen_string_literal: true module ApplicationHelper include Pagy::Frontend def avatar_tag(user) hash = Digest::MD5.hexdigest(user.email) image_tag "https://www.gravatar.com/avatar/#{hash}", class: "c-avatar" end def icon_tag(name, options = {}) return if name.blank? size = options.delete(...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/media_syncing_controller.rb
app/controllers/media_syncing_controller.rb
# frozen_string_literal: true class MediaSyncingController < ApplicationController before_action :require_admin def create if Media.syncing? flash[:error] = t("error.syncing_in_progress") redirect_to setting_path else MediaSyncAllJob.perform_later end end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/artists_controller.rb
app/controllers/artists_controller.rb
# frozen_string_literal: true class ArtistsController < ApplicationController before_action :require_admin, only: [ :update ] before_action :find_artist, except: [ :index ] before_action :get_sort_option, only: [ :index ] def index records = Artist.sort_records(*sort_params).with_attached_cover_image ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/albums_controller.rb
app/controllers/albums_controller.rb
# frozen_string_literal: true class AlbumsController < ApplicationController before_action :require_admin, only: [ :update ] before_action :find_album, except: [ :index ] before_action :get_sort_option, only: [ :index ] def index records = Album.includes(:artist) .with_attached_cover_image .fi...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/settings_controller.rb
app/controllers/settings_controller.rb
# frozen_string_literal: true class SettingsController < ApplicationController before_action :require_admin, only: [ :update ] def show @user = Current.user end def update setting = Setting.instance if setting.update(setting_params) flash.now[:success] = t("notice.updated") else f...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/home_controller.rb
app/controllers/home_controller.rb
# frozen_string_literal: true class HomeController < ApplicationController def index @recently_added_albums = Album.includes(:artist).with_attached_cover_image.order(created_at: :desc).limit(10) @recently_played_albums = Current.user.recently_played_albums.with_attached_cover_image end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/songs_controller.rb
app/controllers/songs_controller.rb
# frozen_string_literal: true class SongsController < ApplicationController before_action :get_sort_option, only: [ :index ] def index records = Song.includes(:artist, :album) .filter_records(filter_params) .sort_records(*sort_params) @pagy, @songs = pagy(records) end private def filt...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/libraries_controller.rb
app/controllers/libraries_controller.rb
# frozen_string_literal: true class LibrariesController < ApplicationController def show @albums_count = Album.count @artists_count = Artist.count @songs_count = Song.count @playlists_count = Current.user.playlists_with_favorite.count end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/transcoded_stream_controller.rb
app/controllers/transcoded_stream_controller.rb
# frozen_string_literal: true class TranscodedStreamController < ApplicationController include TranscodedStreamConcern end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/playlists_controller.rb
app/controllers/playlists_controller.rb
# frozen_string_literal: true class PlaylistsController < ApplicationController before_action :find_playlist, only: [ :destroy, :update ] before_action :get_sort_option, only: [ :index ] def index @pagy, @playlists = pagy(Current.user.playlists_with_favorite.sort_records(*sort_params)) end def create ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/users_controller.rb
app/controllers/users_controller.rb
# frozen_string_literal: true class UsersController < ApplicationController before_action :require_admin, only: [ :index, :create, :new, :destroy ] before_action :find_user, only: [ :edit, :update, :destroy ] before_action :auth_user, only: [ :edit, :update ] def index @users = User.where.not(id: Current....
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/errors_controller.rb
app/controllers/errors_controller.rb
# frozen_string_literal: true class ErrorsController < ApplicationController layout "plain" skip_before_action :require_login def forbidden render status: :forbidden end def not_found render status: :not_found end def unprocessable_entity render status: :unprocessable_entity end def ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/sessions_controller.rb
app/controllers/sessions_controller.rb
# frozen_string_literal: true class SessionsController < ApplicationController layout "plain" skip_before_action :require_login before_action :find_session, only: [ :destroy ] def new redirect_to root_path if logged_in? end def create session = Session.build_from_credential(session_params) ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/application_controller.rb
app/controllers/application_controller.rb
# frozen_string_literal: true class ApplicationController < ActionController::Base include Pagy::Backend include SessionsHelper helper_method :native_app?, :need_transcode?, :render_flash, :mobile?, :dialog? before_action :find_current_session before_action :find_current_request_details before_action :re...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/stream_controller.rb
app/controllers/stream_controller.rb
# frozen_string_literal: true class StreamController < ApplicationController include StreamConcern end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/search_controller.rb
app/controllers/search_controller.rb
# frozen_string_literal: true class SearchController < ApplicationController SEARCH_RESULT_MAX_AMOUNT = 10 def index searched_albums = Album.search(params[:query]).includes(:artist).with_attached_cover_image searched_artists = Artist.search(params[:query]).with_attached_cover_image searched_playlists ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/current_playlist/songs_controller.rb
app/controllers/current_playlist/songs_controller.rb
# frozen_string_literal: true class CurrentPlaylist::SongsController < Playlists::SongsController layout "playlist" skip_before_action :redirect_to_built_in_playlist def index @songs = @playlist.songs_with_favorite @should_play = params[:should_play] == "true" @should_play_song_id = params[:song_id...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/current_playlist/songs/albums_controller.rb
app/controllers/current_playlist/songs/albums_controller.rb
# frozen_string_literal: true class CurrentPlaylist::Songs::AlbumsController < ApplicationController before_action :find_current_playlist before_action :find_album after_action :add_to_recently_played, only: [ :update ] def update @current_playlist.replace(@album.song_ids) redirect_to current_playlis...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/current_playlist/songs/playlists_controller.rb
app/controllers/current_playlist/songs/playlists_controller.rb
# frozen_string_literal: true class CurrentPlaylist::Songs::PlaylistsController < ApplicationController before_action :find_current_playlist before_action :find_playlist def update @current_playlist.replace(@playlist.song_ids) redirect_to current_playlist_songs_path( should_play: params[:should_pl...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/playlists/songs_controller.rb
app/controllers/playlists/songs_controller.rb
# frozen_string_literal: true class Playlists::SongsController < ApplicationController before_action :find_playlist before_action :find_song, only: [ :move, :destroy ] before_action :redirect_to_built_in_playlist, only: [ :index ] def index @pagy, @songs = pagy(@playlist.songs.includes(:artist)) end ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/concerns/stream_concern.rb
app/controllers/concerns/stream_concern.rb
# frozen_string_literal: true module StreamConcern extend ActiveSupport::Concern included do before_action :find_stream end def new send_file @stream.file_path end private def find_stream @stream = Stream.new(Song.find(params[:song_id])) end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/concerns/transcoded_stream_concern.rb
app/controllers/concerns/transcoded_stream_concern.rb
# frozen_string_literal: true module TranscodedStreamConcern extend ActiveSupport::Concern included do before_action :find_stream before_action :find_cache end # Similar to send_file in rails, but let response_body to be a stream object. # The instance of Stream can respond to each() method. So the...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/albums/filter/years_controller.rb
app/controllers/albums/filter/years_controller.rb
# frozen_string_literal: true class Albums::Filter::YearsController < ApplicationController def index @years = Album.distinct.order(:year).pluck(:year).compact end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/albums/filter/genres_controller.rb
app/controllers/albums/filter/genres_controller.rb
# frozen_string_literal: true class Albums::Filter::GenresController < ApplicationController def index @genres = Album.distinct.order(:genre).pluck(:genre).compact end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/dialog/artists_controller.rb
app/controllers/dialog/artists_controller.rb
# frozen_string_literal: true module Dialog class ArtistsController < DialogController before_action :require_admin def edit @artist = Artist.find(params[:id]) end end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/dialog/albums_controller.rb
app/controllers/dialog/albums_controller.rb
# frozen_string_literal: true module Dialog class AlbumsController < DialogController before_action :require_admin def edit @album = Album.find(params[:id]) end end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/dialog/playlists_controller.rb
app/controllers/dialog/playlists_controller.rb
# frozen_string_literal: true module Dialog class PlaylistsController < DialogController def index @pagy, @playlists = pagy(Current.user.playlists_with_favorite.order(created_at: :desc)) end def new @playlist = Playlist.new end def edit @playlist = Current.user.playlists.find(...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/dialog/dialog_controller.rb
app/controllers/dialog/dialog_controller.rb
# frozen_string_literal: true module Dialog class DialogController < ApplicationController layout proc { "dialog" unless native_app? } end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/api/v1/systems_controller.rb
app/controllers/api/v1/systems_controller.rb
# frozen_string_literal: true module Api module V1 class SystemsController < ApiController skip_before_action :find_current_session skip_before_action :require_login def show end end end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/api/v1/songs_controller.rb
app/controllers/api/v1/songs_controller.rb
# frozen_string_literal: true module Api module V1 class SongsController < ApiController def show @song = Song.find(params[:id]) end end end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/api/v1/transcoded_stream_controller.rb
app/controllers/api/v1/transcoded_stream_controller.rb
# frozen_string_literal: true module Api module V1 class TranscodedStreamController < ApiController include TranscodedStreamConcern end end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/api/v1/api_controller.rb
app/controllers/api/v1/api_controller.rb
# frozen_string_literal: true module Api module V1 class ApiController < ApplicationController skip_before_action :verify_authenticity_token private def find_current_session authenticate_with_http_token do |token, _| Current.session = Session.find_signed(token) end ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/api/v1/authentications_controller.rb
app/controllers/api/v1/authentications_controller.rb
# frozen_string_literal: true module Api module V1 class AuthenticationsController < ApiController skip_before_action :find_current_session, only: [ :create ] skip_before_action :require_login, only: [ :create ] def create @session = Session.build_from_credential(session_params) ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/api/v1/stream_controller.rb
app/controllers/api/v1/stream_controller.rb
# frozen_string_literal: true module Api module V1 class StreamController < ApiController include StreamConcern end end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/api/v1/current_playlist/songs_controller.rb
app/controllers/api/v1/current_playlist/songs_controller.rb
# frozen_string_literal: true module Api module V1 class CurrentPlaylist::SongsController < ApiController before_action :find_playlist before_action :find_song, only: [ :destroy, :move ] def index @songs = @playlist.songs_with_favorite end def destroy @playlist.son...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/api/v1/current_playlist/songs/albums_controller.rb
app/controllers/api/v1/current_playlist/songs/albums_controller.rb
# frozen_string_literal: true module Api module V1 class CurrentPlaylist::Songs::AlbumsController < ApiController before_action :find_current_playlist before_action :find_album after_action :add_to_recently_played, only: [ :update ] def update @current_playlist.replace(@album.son...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/api/v1/current_playlist/songs/playlists_controller.rb
app/controllers/api/v1/current_playlist/songs/playlists_controller.rb
# frozen_string_literal: true module Api module V1 class CurrentPlaylist::Songs::PlaylistsController < ApiController before_action :find_current_playlist before_action :find_playlist def update @current_playlist.replace(@playlist.song_ids) end private def find_curre...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/api/v1/favorite_playlist/songs_controller.rb
app/controllers/api/v1/favorite_playlist/songs_controller.rb
# frozen_string_literal: true module Api module V1 class FavoritePlaylist::SongsController < ApiController before_action :find_playlist before_action :find_song, only: [ :destroy ] def create @song = Song.find(params[:song_id]) @playlist.playlists_songs.create(song_id: @song.id...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/favorite_playlist/songs_controller.rb
app/controllers/favorite_playlist/songs_controller.rb
# frozen_string_literal: true class FavoritePlaylist::SongsController < Playlists::SongsController skip_before_action :redirect_to_built_in_playlist private def find_playlist @playlist = Current.user.favorite_playlist end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/users/settings_controller.rb
app/controllers/users/settings_controller.rb
# frozen_string_literal: true class Users::SettingsController < ApplicationController before_action :find_user before_action :auth_user def update return unless @user.update(user_setting_params) flash.now[:success] = t("notice.updated") end private def user_setting_params params.require(:use...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/search/artists_controller.rb
app/controllers/search/artists_controller.rb
# frozen_string_literal: true class Search::ArtistsController < ApplicationController def index @artists = Artist.search(params[:query]).with_attached_cover_image end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/search/albums_controller.rb
app/controllers/search/albums_controller.rb
# frozen_string_literal: true class Search::AlbumsController < ApplicationController def index @albums = Album.search(params[:query]).includes(:artist).with_attached_cover_image end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/search/songs_controller.rb
app/controllers/search/songs_controller.rb
# frozen_string_literal: true class Search::SongsController < ApplicationController def index @songs = Song.search(params[:query]).includes(:artist, :album) end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/search/playlists_controller.rb
app/controllers/search/playlists_controller.rb
# frozen_string_literal: true class Search::PlaylistsController < ApplicationController def index @playlists = Playlist.search(params[:query]) end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/songs/filter/years_controller.rb
app/controllers/songs/filter/years_controller.rb
# frozen_string_literal: true class Songs::Filter::YearsController < Albums::Filter::YearsController end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/controllers/songs/filter/genres_controller.rb
app/controllers/songs/filter/genres_controller.rb
# frozen_string_literal: true class Songs::Filter::GenresController < Albums::Filter::GenresController end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/models/current.rb
app/models/current.rb
# frozen_string_literal: true class Current < ActiveSupport::CurrentAttributes attribute :setting attribute :session attribute :ip_address attribute :user_agent delegate :user, to: :session, allow_nil: true end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/models/sort_value.rb
app/models/sort_value.rb
class SortValue attr_accessor :name, :direction def initialize(name, direction = "asc") @name = name.to_s @direction = (direction.to_s == "desc") ? "desc" : "asc" end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/models/playlist.rb
app/models/playlist.rb
# frozen_string_literal: true class Playlist < ApplicationRecord include SearchableConcern include SortableConcern validates :name, presence: true, if: :require_name? has_many :playlists_songs has_many :songs, -> { order "playlists_songs.position" }, through: :playlists_songs belongs_to :user search_b...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/models/artist.rb
app/models/artist.rb
# frozen_string_literal: true class Artist < ApplicationRecord UNKNOWN_NAME = "Unknown Artist" VARIOUS_NAME = "Various Artists" include SearchableConcern include ImageableConcern include SortableConcern after_initialize :set_default_name, if: :new_record? validates :name, presence: true has_many :a...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/models/session.rb
app/models/session.rb
class Session < ApplicationRecord before_create :find_current_info belongs_to :user def self.build_from_credential(credential) user = User.find_by(email: credential[:email]) # User authentication has been migrated from Authlogic to has_secure_password, so for backward compatibility # we need to chec...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/models/media.rb
app/models/media.rb
# frozen_string_literal: true class Media include Singleton include Turbo::Broadcastable extend ActiveModel::Naming class << self def sync(type, file_paths = []) return if file_paths.blank? case type when :added add_files(file_paths) when :removed remove_files(file...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/models/media_listener.rb
app/models/media_listener.rb
# frozen_string_literal: true class MediaListener include Singleton include BlackCandy::Configurable SERVICE_PATH = File.join(Rails.root, "lib", "daemons", "media_listener_service") has_config :service_name, default: "media_listener_service", env_prefix: "media_listener" has_config :pid_dir, default: File....
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/models/favorite_playlist.rb
app/models/favorite_playlist.rb
# frozen_string_literal: true class FavoritePlaylist < Playlist def name I18n.t("label.favorites") end private def require_name? false end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/models/playlists_song.rb
app/models/playlists_song.rb
# frozen_string_literal: true class PlaylistsSong < ApplicationRecord belongs_to :playlist belongs_to :song default_scope { order :position } acts_as_list scope: :playlist end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/models/stream.rb
app/models/stream.rb
# frozen_string_literal: true class Stream extend Forwardable WEB_SUPPORTED_FORMATS = MediaFile::SUPPORTED_FORMATS - %w[wma] SAFARI_SUPPORTED_FORMATS = MediaFile::SUPPORTED_FORMATS - %w[ogg opus oga] IOS_SUPPORTED_FORMATS = SAFARI_SUPPORTED_FORMATS ANDROID_SUPPORTED_FORMATS = WEB_SUPPORTED_FORMATS TRANSC...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/models/sort_option.rb
app/models/sort_option.rb
class SortOption extend Forwardable attr_accessor :values def_delegators :@values, :push, :include? def initialize @values = [] @default = nil end def default @default || SortValue.new(@values.first) end def set_default(value, direction) @default = SortValue.new(value, direction) ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/models/media_file.rb
app/models/media_file.rb
# frozen_string_literal: true class MediaFile SUPPORTED_FORMATS = WahWah.support_formats.freeze class << self def file_paths(media_path) return [] if media_path.blank? absolute_media_path = File.expand_path(media_path) # Because Ruby ignores the FNM_CASEFOLD flag in Dir.glob, case sensitiv...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/models/application_record.rb
app/models/application_record.rb
# frozen_string_literal: true class ApplicationRecord < ActiveRecord::Base self.abstract_class = true end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/models/current_playlist.rb
app/models/current_playlist.rb
# frozen_string_literal: true class CurrentPlaylist < Playlist def songs_with_favorite favorite_playlist = Current.user.favorite_playlist songs.includes(:artist, album: { cover_image_attachment: :blob }) .joins("Left JOIN playlists_songs T1 ON songs.id = T1.song_id AND T1.playlist_id = #{favorite_play...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/models/setting.rb
app/models/setting.rb
# frozen_string_literal: true class Setting < ApplicationRecord include GlobalSettingConcern AVAILABLE_BITRATE_OPTIONS = [ 128, 192, 320 ].freeze has_setting :media_path, default: proc { BlackCandy.config.media_path } has_setting :discogs_token has_setting :transcode_bitrate, type: :integer, default: 128 ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/models/song.rb
app/models/song.rb
# frozen_string_literal: true class Song < ApplicationRecord include SearchableConcern include FilterableConcern include SortableConcern validates :name, :file_path, :file_path_hash, :md5_hash, presence: true belongs_to :album, touch: true belongs_to :artist, touch: true has_many :playlists_songs has...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/models/album.rb
app/models/album.rb
# frozen_string_literal: true class Album < ApplicationRecord UNKNOWN_NAME = "Unknown Album" include SearchableConcern include ImageableConcern include FilterableConcern include SortableConcern after_initialize :set_default_name, if: :new_record? validates :name, presence: true has_many :songs, -> ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/models/user.rb
app/models/user.rb
# frozen_string_literal: true class User < ApplicationRecord AVAILABLE_THEME_OPTIONS = %w[dark light auto].freeze DEFAULT_THEME = "auto" RECENTLY_PLAYED_LIMIT = 10 include ScopedSettingConcern has_secure_password has_setting :theme, default: DEFAULT_THEME serialize :recently_played_album_ids, type: Arr...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/models/concerns/sortable_concern.rb
app/models/concerns/sortable_concern.rb
# frozen_string_literal: true module SortableConcern extend ActiveSupport::Concern included do const_set(:SORT_OPTION, SortOption.new) end class_methods do def sort_by(*attributes) attributes.each do |attr| scope "sort_by_#{attr}", ->(direction) { order(attr => direction) } self...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/models/concerns/imageable_concern.rb
app/models/concerns/imageable_concern.rb
module ImageableConcern extend ActiveSupport::Concern ALLOWED_IMAGE_CONTENT_TYPES = %w[image/jpeg image/png].freeze included do has_one_attached :cover_image do |attachable| attachable.variant :small, resize_to_fill: [ 200, 200 ] attachable.variant :medium, resize_to_fill: [ 400, 400 ], preproce...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/models/concerns/searchable_concern.rb
app/models/concerns/searchable_concern.rb
# frozen_string_literal: true module SearchableConcern extend ActiveSupport::Concern class_methods do def search_by(attr, options = {}) associations = Hash(options[:associations]) associations_attrs = associations.map { |name, attr| "#{name}_#{attr}" } predicate = [ attr ].push(*associations...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/models/concerns/filterable_concern.rb
app/models/concerns/filterable_concern.rb
# frozen_string_literal: true module FilterableConcern extend ActiveSupport::Concern included do const_set(:VALID_FILTERS, []) end class_methods do def filter_by(*attributes) attributes.each do |attr| scope "filter_by_#{attr}", ->(value) { where(attr => value) } self::VALID_FILT...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/models/concerns/scoped_setting_concern.rb
app/models/concerns/scoped_setting_concern.rb
# frozen_string_literal: true module ScopedSettingConcern extend ActiveSupport::Concern included do const_set(:AVAILABLE_SETTINGS, []) end class_methods do def has_setting(setting, type: :string, default: nil) self::AVAILABLE_SETTINGS.push(setting) store :settings, accessors: setting ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/models/concerns/global_setting_concern.rb
app/models/concerns/global_setting_concern.rb
# frozen_string_literal: true module GlobalSettingConcern extend ActiveSupport::Concern included do # Ensures only one Settings row is created validates :singleton_guard, inclusion: { in: [ 0 ] } const_set(:AVAILABLE_SETTINGS, []) end class_methods do delegate :update, to: :instance def ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/models/integrations/discogs.rb
app/models/integrations/discogs.rb
# frozen_string_literal: true class Integrations::Discogs < Integrations::Service base_uri "https://api.discogs.com" def initialize(token = Setting.discogs_token) self.class.headers "Authorization" => "Discogs token=#{token}" end def cover_image(object) case object when Artist artist_cover_...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/app/models/integrations/service.rb
app/models/integrations/service.rb
# frozen_string_literal: true require "open-uri" class Integrations::Service include HTTParty def request(path, options = {}, method = :get) response = self.class.send(method, path, options) raise TooManyRequests if response.code.to_i == 429 parse_json(response) end def download_image(url) ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/seeds.rb
db/seeds.rb
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Ch...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/queue_schema.rb
db/queue_schema.rb
ActiveRecord::Schema[7.1].define(version: 1) do create_table "solid_queue_blocked_executions", force: :cascade do |t| t.bigint "job_id", null: false t.string "queue_name", null: false t.integer "priority", default: 0, null: false t.string "concurrency_key", null: false t.datetime "expires_at", nul...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/cache_schema.rb
db/cache_schema.rb
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # This file is the source Rails uses to define your schema when running `bin/rai...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/schema.rb
db/schema.rb
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # This file is the source Rails uses to define your schema when running `bin/rai...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/cable_schema.rb
db/cable_schema.rb
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # This file is the source Rails uses to define your schema when running `bin/rai...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20241016135211_drop_solid_cache_entries_table.rb
db/migrate/20241016135211_drop_solid_cache_entries_table.rb
class DropSolidCacheEntriesTable < ActiveRecord::Migration[7.2] def change drop_table :solid_cache_entries do |t| t.binary "key", limit: 1024, null: false t.binary "value", limit: 536870912, null: false t.datetime "created_at", null: false t.integer "key_hash", limit: 8, null: false ...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20240115051630_create_solid_queue_tables.solid_queue.rb
db/migrate/20240115051630_create_solid_queue_tables.solid_queue.rb
# This migration comes from solid_queue (originally 20231211200639) class CreateSolidQueueTables < ActiveRecord::Migration[7.0] def change create_table :solid_queue_jobs do |t| t.string :queue_name, null: false t.string :class_name, null: false, index: true t.text :arguments t.integer :pri...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20221115062920_change_array_value_to_text.rb
db/migrate/20221115062920_change_array_value_to_text.rb
class ChangeArrayValueToText < ActiveRecord::Migration[7.0] def up change_column :users, :recently_played_album_ids, :text User.update_all(recently_played_album_ids: []) end def down change_column :users, :recently_played_album_ids, :integer, array: true, default: [] end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20240104023417_rename_is_various_in_artists.rb
db/migrate/20240104023417_rename_is_various_in_artists.rb
class RenameIsVariousInArtists < ActiveRecord::Migration[7.1] def change rename_column :artists, :is_various, :various end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20221115062930_remove_extensions.rb
db/migrate/20221115062930_remove_extensions.rb
class RemoveExtensions < ActiveRecord::Migration[7.0] def change disable_extension "pg_trgm" disable_extension "hstore" disable_extension "plpgsql" end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20200915090637_use_hstore_for_settings.rb
db/migrate/20200915090637_use_hstore_for_settings.rb
class UseHstoreForSettings < ActiveRecord::Migration[6.0] def up enable_extension "hstore" if adapter_name.downcase == "postgresql" && !extension_enabled?("hstore") add_column :settings, :values, :hstore add_column :settings, :singleton_guard, :integer add_column :users, :settings, :hstore add_ind...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20211221081317_rename_length_to_duration_in_songs.rb
db/migrate/20211221081317_rename_length_to_duration_in_songs.rb
class RenameLengthToDurationInSongs < ActiveRecord::Migration[6.1] def change rename_column :songs, :length, :duration end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20240115122443_migrate_images_from_artists.rb
db/migrate/20240115122443_migrate_images_from_artists.rb
class MigrateImagesFromArtists < ActiveRecord::Migration[7.1] def up Artist.where.not(image: nil).find_each do |artist| image_path = Rails.root.join("public", "uploads", "artist", "image", artist.id.to_s, artist.image) image_format = File.extname(image_path).downcase.delete(".") next unless Fil...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20230616013722_add_bit_depth_to_songs.rb
db/migrate/20230616013722_add_bit_depth_to_songs.rb
class AddBitDepthToSongs < ActiveRecord::Migration[7.0] def change add_column :songs, :bit_depth, :integer end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20220705083238_add_file_path_hash_to_songs.rb
db/migrate/20220705083238_add_file_path_hash_to_songs.rb
class AddFilePathHashToSongs < ActiveRecord::Migration[7.0] def change add_column :songs, :file_path_hash, :string add_index :songs, :file_path_hash add_index :songs, :md5_hash reversible do |dir| dir.up do Song.find_each do |song| song.update_column(:file_path_hash, MediaFile...
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false
blackcandy-org/blackcandy
https://github.com/blackcandy-org/blackcandy/blob/6c669296c1108c712c2933bc2d64f0ea4a1d0001/db/migrate/20231101052018_create_sessions.rb
db/migrate/20231101052018_create_sessions.rb
class CreateSessions < ActiveRecord::Migration[7.1] def change create_table :sessions do |t| t.references :user, null: false t.string :user_agent t.string :ip_address t.timestamps end end end
ruby
MIT
6c669296c1108c712c2933bc2d64f0ea4a1d0001
2026-01-04T15:47:26.110434Z
false