Class: TivoHMO::CLI
- Inherits:
-
Clamp::Command
- Object
- Clamp::Command
- TivoHMO::CLI
- Includes:
- GemLogger::LoggerSupport
- Defined in:
- lib/tivohmo/cli.rb
Overview
The command line interface to tivohmo
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.description ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/tivohmo/cli.rb', line 14 def self.description desc = " TivoHMO version \#{TivoHMO::VERSION}\n\n Runs a HMO server. Specify one or more applications to show up as top level\n shares in the TiVo Now Playing view. The application, identifier,\n transcoder, metadata options can be given in groups to apply the transcoder\n and metadata to each application - uses the application's default if not given\n\n e.g.\n\n tivohmo -t Movies\n -a TivoHMO::Adapters::Filesystem::Application \\\\\n -i ~/Video/Movies \\\\\n -t \"TV Shows\" \\\\\n -a TivoHMO::Adapters::Filesystem::Application \\\\\n -i ~/Video/TV\n\n to run two top level filesystem video serving apps for different dirs, or\n\n tivohmo -t Vids \\\\\n -a TivoHMO::Adapters::Filesystem::Application \\\\\n -i ~/Video\n\n to run the single filesystem app, or\n\n tivohmo -t PlexVideo \\\\\n -a TivoHMO::Adapters::Plex::Application \\\\\n -i localhost\n\n to run the single plex app\n DESC\n desc.split(\"\\n\").collect(&:strip).join(\"\\n\")\nend\n" |
Instance Method Details
#execute ⇒ Object
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/tivohmo/cli.rb', line 107 def execute if version? puts "TivoHMO Version #{TivoHMO::VERSION}" return end install_tivohmo if install? c = File.(configuration) if configuration s = File.(settings) if settings TivoHMO::Config.instance.setup(c, s) setup_logging logger.info "TivoHMO #{TivoHMO::VERSION} starting up" # set any config items passed in on cli configitem_list.each do |item| key, value = item.split('=') Config.instance.set(key, value) end # allow cli option to override config file set_if_default(:port, TivoHMO::Config.instance.get(:port).try(:to_i)) server = TivoHMO::API::Server.new apps = setup_applications apps.each {|app| server.add_child(app) } preload_containers(server) if preload? opts = {} set_if_default(:beacon, TivoHMO::Config.instance.get(:beacon)) if beacon.present? limit, interval = beacon.split(":") opts[:limit] = limit.to_i if limit.present? opts[:interval] = interval.to_i if interval.present? end notifier = TivoHMO::Beacon.new(port, **opts) TivoHMO::Server.start(server, port) do |s| wait_for_server { notifier.start } end end |