# # # = Jeeves CLI # # == Listings related actions # # Author:: Robert Sharp # Copyright:: Copyright (c) 2014 Robert Sharp # License:: Open Software Licence v3.0 # # This software is licensed for use under the Open Software Licence v. 3.0 # The terms of this licence can be found at http://www.opensource.org/licenses/osl-3.0.php # and in the file copyright.txt. Under the terms of this licence, all derivative works # must themselves be licensed under the Open Software Licence v. 3.0 # # # require 'optplus/nested' class ListingCLI < Optplus::NestedParser usage "listings [update|clean]" description "manage TV listings in Jeeves PVR" def before_actions @jeeves_config = @_parent.jeeves_config end describe :update, 'update TV listings' help :update, 'download TV listings data and load into Jeeves' def update @jeeves_config[:jeeves_uri_timeout] = get_option(:timeout) if option?(:timeout) @jeeves_config[:update_listings] = get_option(:update_listings) if option?(:update_listings) Jeeves.update_listings(@jeeves_config) rescue Jeeves::ListingError => e exit_on_error "Error while updating listings #{e}" end end