lib/ayadn/status.rb in ayadn-3.0 vs lib/ayadn/status.rb in ayadn-4.0

- old
+ new

@@ -1,11 +1,13 @@ # encoding: utf-8 module Ayadn class Status - def initialize - @thor = Thor::Shell::Color.new + attr_reader :thor + + def initialize thor = Thor::Shell::Color.new + @thor = thor end def done info("done", "", "green") end @@ -16,15 +18,15 @@ say_red :canceled, "" end end def downloaded(name) - info("downloaded", "#{Settings.config[:paths][:downloads]}/#{name}", "green") + info("downloaded", "#{Settings.config.paths.downloads}/#{name}", "green") end def links_saved(name) - info("done", "links exported to file #{Settings.config[:paths][:lists]}/#{name}", "green") + info("done", "links exported to file #{Settings.config.paths.lists}/#{name}", "green") end def downloading info("connected", "downloading from ADN", "yellow") end @@ -79,10 +81,22 @@ def starring(post_id) say_yellow :starring, "post #{post_id}" end + def all_hashtag_links hashtag + info("info", "links from posts containing hashtag '##{hashtag}':", "cyan") + end + + def all_search_links words + info("info", "links from posts containing word(s) '#{words}':", "cyan") + end + + def all_stars_links + info("info", "links from your starred posts:", "cyan") + end + def not_deleted(post_id) info("error", "could not delete post #{post_id} (post isn't yours, or is already deleted)", "red") end def not_deleted_m(post_id) @@ -183,14 +197,10 @@ def blocked(username) info("blocked", username, "green") end - def error_missing_title - info("error", "please specify (part of) a movie title", "red") - end - def error_missing_username info("error", "please specify a username", "red") end def error_missing_post_id @@ -216,11 +226,11 @@ info("info", "the list is empty", "yellow") end def writing puts "\n" - say_cyan :author, "#{Settings.config[:identity][:handle]}" + say_cyan :author, "#{Settings.config.identity.handle}" puts "\n" end def yourmessage username = nil if username.nil? @@ -231,11 +241,11 @@ puts "\n\n" end def message_from(username) puts "\n" - say_yellow :from, "#{Settings.config[:identity][:handle]}" + say_yellow :from, "#{Settings.config.identity.handle}" say_yellow :to, "#{username[0]}" end def replying_to(post_id) puts "\n" @@ -249,19 +259,19 @@ say_cyan :cancel, "[CTRL+C] to cancel" end end def reply - say_cyan :max, "#{Settings.config[:post_max_length]} characters" + say_cyan :max, "#{Settings.config.post_max_length} characters" end def post - say_cyan :max, "#{Settings.config[:post_max_length]} characters" + say_cyan :max, "#{Settings.config.post_max_length} characters" end def message - say_cyan :max, "#{Settings.config[:message_max_length]} characters" + say_cyan :max, "#{Settings.config.message_max_length} characters" end def valid_colors(colors_list) say_cyan :info, "valid colors:" say { puts colors_list } @@ -418,22 +428,10 @@ def fetching_from(source) info("connexion", "fetching informations from #{source}", "green") end - def no_movie - info("error", "sorry, can't find this movie", "red") - end - - def no_show - info("error", "sorry, can't find this show", "red") - end - - def no_show_infos - info("error", "sorry, can't find informations about this show", "red") - end - def no_force(target) say do say_error "'#{target}' can't be displayed (could be muted, blocked, in the Blacklist, etc)" say_info "please use option '--force' ('-f') to try and display this content anyway" end @@ -526,10 +524,10 @@ puts "\n" say_cyan :next, "Ayadn will use these elements to insert album artwork and a link" end def server_error(bool) - if bool == true + if bool say do say_error "Ayadn couldn't get the JSON reponse" say_yellow :next, "trying again in 10 seconds" end else