Skip to content

Commit

Permalink
Format indent
Browse files Browse the repository at this point in the history
  • Loading branch information
tomohiro committed Apr 10, 2015
1 parent 7ead173 commit 11fe5d2
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions lib/airplayer/playlist.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module AirPlayer
class Playlist < Array
def initialize(options = {})
@shuffle = options['shuffle'] || false
@repeat = options['repeat'] || false
@repeat = options['repeat'] || false
end

def add(item)
Expand All @@ -31,26 +31,27 @@ def entries(&blk)
end

private
def type(item)
if Dir.exists?(File.expand_path(item))
:local_dir
elsif Media.playable?(item)
:url
elsif item.match(/.+(xml|rss)$/)
:podcast
end
end

def media_in_local(path)
Dir.entries(File.expand_path(path)).sort.map do |node|
Media.new(File.expand_path(node, path)) if Media.playable? node
end.compact
def type(item)
if Dir.exist?(File.expand_path(item))
:local_dir
elsif Media.playable?(item)
:url
elsif item.match(/.+(xml|rss)$/)
:podcast
end
end

def media_in_podcast(path)
RSS::Parser.parse(path).items.map do |node|
Media.new(node.link)
end
def media_in_local(path)
Dir.entries(File.expand_path(path)).sort.map do |node|
Media.new(File.expand_path(node, path)) if Media.playable? node
end.compact
end

def media_in_podcast(path)
RSS::Parser.parse(path).items.map do |node|
Media.new(node.link)
end
end
end
end

0 comments on commit 11fe5d2

Please sign in to comment.