Class: RecoverItunesRatings::SavedRatings
- Inherits:
-
Object
- Object
- RecoverItunesRatings::SavedRatings
- Defined in:
- lib/recover_itunes_ratings/saved_ratings.rb
Overview
Enumerates the track ratings in an iTunes Library XML file.
Constant Summary collapse
- IGNORED_TYPES =
["Music Video", "Movie", "Home Video", "TV Show", "Podcast", "iTunes U", "Audiobook", "Book", "Voice Memo"]
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(library_xml_path) ⇒ SavedRatings
constructor
A new instance of SavedRatings.
Constructor Details
#initialize(library_xml_path) ⇒ SavedRatings
Returns a new instance of SavedRatings.
9 10 11 |
# File 'lib/recover_itunes_ratings/saved_ratings.rb', line 9 def initialize(library_xml_path) @path = library_xml_path end |
Instance Method Details
#each ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/recover_itunes_ratings/saved_ratings.rb', line 13 def each parse on_track: ->(data) { next if data["Track Type"] == "Remote" next if IGNORED_TYPES.any?(&data.method(:has_key?)) next if IGNORED_TYPES.any? { |t| data["Genre"] == t } yield data["Persistent ID"], data["Rating"].to_i } end |