Class: LastfmItunes::Itunes
- Inherits:
-
Object
- Object
- LastfmItunes::Itunes
- Includes:
- Tracks
- Defined in:
- lib/lastfm-itunes/itunes.rb
Instance Attribute Summary collapse
-
#library ⇒ Object
Returns the value of attribute library.
-
#tracks ⇒ Object
Returns the value of attribute tracks.
-
#xml_path ⇒ Object
Returns the value of attribute xml_path.
Instance Method Summary collapse
- #artists ⇒ Object
- #group_tracks_by_artist ⇒ Object
-
#initialize(xml_path) ⇒ Itunes
constructor
A new instance of Itunes.
- #old_group_tracks_by_artist ⇒ Object
Methods included from Tracks
#find, #intersection_of_tracks, #over_limit?
Constructor Details
#initialize(xml_path) ⇒ Itunes
Returns a new instance of Itunes.
8 9 10 11 12 13 |
# File 'lib/lastfm-itunes/itunes.rb', line 8 def initialize(xml_path) @xml_path = File.(xml_path) @library = ::ITunes::Library.load(@xml_path) raise InvalidLibraryException unless library.track_ids @tracks = @library.music.tracks.select { |t| t.location_path } end |
Instance Attribute Details
#library ⇒ Object
Returns the value of attribute library.
6 7 8 |
# File 'lib/lastfm-itunes/itunes.rb', line 6 def library @library end |
#tracks ⇒ Object
Returns the value of attribute tracks.
6 7 8 |
# File 'lib/lastfm-itunes/itunes.rb', line 6 def tracks @tracks end |
#xml_path ⇒ Object
Returns the value of attribute xml_path.
6 7 8 |
# File 'lib/lastfm-itunes/itunes.rb', line 6 def xml_path @xml_path end |
Instance Method Details
#artists ⇒ Object
20 21 22 |
# File 'lib/lastfm-itunes/itunes.rb', line 20 def artists @tracks.map(&:artist).uniq end |
#group_tracks_by_artist ⇒ Object
16 17 18 |
# File 'lib/lastfm-itunes/itunes.rb', line 16 def group_tracks_by_artist old_group_tracks_by_artist(@tracks) end |
#old_group_tracks_by_artist ⇒ Object
15 |
# File 'lib/lastfm-itunes/itunes.rb', line 15 alias :old_group_tracks_by_artist :group_tracks_by_artist |