Class: Pika::Operator
- Inherits:
-
Object
- Object
- Pika::Operator
- Defined in:
- lib/pika/operator.rb
Instance Attribute Summary collapse
-
#config_file ⇒ Object
readonly
Returns the value of attribute config_file.
-
#missing_files_names ⇒ Object
readonly
Returns the value of attribute missing_files_names.
-
#missing_files_urls ⇒ Object
readonly
Returns the value of attribute missing_files_urls.
-
#remote_tracks_urls ⇒ Object
readonly
Returns the value of attribute remote_tracks_urls.
Instance Method Summary collapse
Instance Attribute Details
#config_file ⇒ Object (readonly)
Returns the value of attribute config_file.
5 6 7 |
# File 'lib/pika/operator.rb', line 5 def config_file @config_file end |
#missing_files_names ⇒ Object (readonly)
Returns the value of attribute missing_files_names.
5 6 7 |
# File 'lib/pika/operator.rb', line 5 def missing_files_names @missing_files_names end |
#missing_files_urls ⇒ Object (readonly)
Returns the value of attribute missing_files_urls.
5 6 7 |
# File 'lib/pika/operator.rb', line 5 def missing_files_urls @missing_files_urls end |
#remote_tracks_urls ⇒ Object (readonly)
Returns the value of attribute remote_tracks_urls.
5 6 7 |
# File 'lib/pika/operator.rb', line 5 def remote_tracks_urls @remote_tracks_urls end |
Instance Method Details
#status(file, local = false) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/pika/operator.rb', line 7 def status(file, local = false) @config_file = file if local puts "Using local playlist file" else puts "Using config file: #{config_file}" @config_file = fetch_playlist end initialize_locals(config_file) puts "#{pluralize(missing_files_names.length, "tracks")} to download".yellow extract_missing_files_urls if missing_files_urls begin print "Download missing files? [Yn]: " input = STDIN.gets end while not ["Y", "y", "N", "n"].include? input.chomp if positive?(input.chomp) puts "Fetching files information. This may take some time..." puts download_missing_files end else puts "Nothing to do here.".green puts "Terminating." end end |