lib/ayadn/set.rb in ayadn-1.5.1 vs lib/ayadn/set.rb in ayadn-1.6.0

- old
+ new

@@ -13,10 +13,36 @@ end scroll_config.log(args) scroll_config.save end + desc "movie ITEM VALUE", "Set values for movie (nowwatching)" + map "nowwatching" => :movie + def movie(*args) + movie_config = SetMovie.new + unless args.length != 2 + movie_config.send(args[0], args[1]) + else + abort(Status.error_missing_parameters) + end + movie_config.log(args) + movie_config.save + end + + desc "tvshow ITEM VALUE", "Set values for tvshow (nowwatching)" + map "tv" => :tvshow + def tvshow(*args) + tvshow_config = SetTVShow.new + unless args.length != 2 + tvshow_config.send(args[0], args[1]) + else + abort(Status.error_missing_parameters) + end + tvshow_config.log(args) + tvshow_config.save + end + desc "nicerank ITEM VALUE", "Set NiceRank filter values" long_desc Descriptions.set_nicerank def nicerank *args nicerank_config = SetNiceRank.new if args[0] @@ -143,9 +169,49 @@ def validate(t) Validators.timer(t) end def timer(t) Settings.options[:scroll][:timer] = t + end + end + + class SetMovie + def initialize + Settings.load_config + Settings.get_token + Settings.init_config + Logs.create_logger + end + def log(args) + x = "New value for '#{args[0]}' in 'Movie' => #{args[1]}" + puts "\n#{x}\n".color(:cyan) + Logs.rec.info x + end + def save + Settings.save_config + end + def hashtag(tag) + Settings.options[:movie][:hashtag] = tag + end + end + + class SetTVShow + def initialize + Settings.load_config + Settings.get_token + Settings.init_config + Logs.create_logger + end + def log(args) + x = "New value for '#{args[0]}' in 'TV Show' => #{args[1]}" + puts "\n#{x}\n".color(:cyan) + Logs.rec.info x + end + def save + Settings.save_config + end + def hashtag(tag) + Settings.options[:tvshow][:hashtag] = tag end end class SetNiceRank def initialize