class Airplay::Player::Media

Constants

COMPATIBLE_TYPES

Attributes

file_or_url[R]
url[R]

Public Class Methods

new(file_or_url) click to toggle source
# File lib/airplay/player/media.rb, line 19
def initialize(file_or_url)
  @file_or_url = file_or_url
end

Public Instance Methods

compatible?() click to toggle source
# File lib/airplay/player/media.rb, line 34
def compatible?
  @_compatible ||= begin
    path = File.basename(file_or_url)
    compatibility = MIME::Types.type_for(path).map(&:to_s) & COMPATIBLE_TYPES
    compatibility.any?
  end
end
local?() click to toggle source
# File lib/airplay/player/media.rb, line 42
def local?
  File.exists?(file_or_url)
end
remote?() click to toggle source
# File lib/airplay/player/media.rb, line 46
def remote?
  !!(file_or_url =~ URI::regexp)
end
to_s() click to toggle source
# File lib/airplay/player/media.rb, line 50
def to_s; url end