Class: RecoverItunesRatings::Runner
- Inherits:
-
Object
- Object
- RecoverItunesRatings::Runner
- Defined in:
- lib/recover_itunes_ratings/runner.rb
Overview
Restores each rating found in the library XML to the current iTunes library.
Instance Method Summary collapse
-
#initialize(library_xml_path, dry_run: true, reset_album_ratings: false) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
Constructor Details
#initialize(library_xml_path, dry_run: true, reset_album_ratings: false) ⇒ Runner
Returns a new instance of Runner.
7 8 9 10 11 12 13 |
# File 'lib/recover_itunes_ratings/runner.rb', line 7 def initialize(library_xml_path, dry_run: true, reset_album_ratings: false) @dry_run = dry_run @reset_album_ratings = @ratings = SavedRatings.new(library_xml_path) @tracks = MatchedTracks.new(@ratings) end |
Instance Method Details
#run ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/recover_itunes_ratings/runner.rb', line 15 def run @tracks.each do |track, | if @reset_album_ratings && track..get == :user name = "#{track.artist.get} - #{track.album.get}" puts "[#{track..get/20} -> X] Album: #{name}" track..set(-1) unless @dry_run end = track..get next unless && != name = "#{track.artist.get} - #{track.name.get}" puts "[#{/20} -> #{/20}] Song: #{name}" track..set() unless @dry_run end end |