airstream 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/bin/airimg +72 -0
  2. metadata +5 -5
data/bin/airimg CHANGED
@@ -1,2 +1,74 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ PROGRAM_VERSION = "0.1.1" # @TODO move to one place
4
+
5
+ require 'optparse'
6
+ require 'airplay'
7
+ require 'yaml'
8
+
9
+ options = {
10
+ reciever: '192.168.1.8',
11
+ interval: 3
12
+ }
13
+
14
+ CONFIG_FILE = File.join(ENV['HOME'], '.airstreamrc')
15
+
16
+ if File.exists? CONFIG_FILE
17
+ options_config = YAML.load_file(CONFIG_FILE)
18
+ options.merge!(options_config)
19
+ end
20
+
21
+ option_parser = OptionParser.new do |opts|
22
+ executable_name = File.basename($PROGRAM_NAME)
23
+ opts.banner = "offer a image file to an airplay device
24
+
25
+ Usage: #{executable_name} [options] [url|path/]filename
26
+
27
+ Basic options: (configure default in ~/.airstreamrc)
28
+ "
29
+ opts.on("-o RECIEVER",
30
+ "the airplay-device ip-address or domain") do |reciever|
31
+ options[:reciever] = reciever
32
+ end
33
+
34
+ opts.on("-n SECONDS", "--interval SECONDS",
35
+ "seconds between switching image files") do |interval|
36
+ options[:interval] = interval.to_i
37
+ end
38
+
39
+ opts.on("-v", "--version",
40
+ "output version information then quit") do |path|
41
+ puts "airstream airimg v" + PROGRAM_VERSION
42
+ exit 0
43
+ end
44
+ end
45
+
46
+ if ARGV.empty?
47
+ STDERR.puts "No arguments given"
48
+ STDERR.puts option_parser
49
+ exit 1
50
+ end
51
+
52
+ begin
53
+ option_parser.parse!
54
+
55
+ unless options[:reciever]
56
+ STDERR.puts "No host given"
57
+ exit 68
58
+ end
59
+
60
+ node = Airplay::Server::Node.new(options[:reciever],
61
+ options[:reciever], options[:reciever], 7000)
62
+ ap = Airplay::Client.new node
63
+ ap.use node # does not work without that second assign
64
+
65
+ ARGV.each do |file|
66
+ ap.send_image file
67
+ sleep options[:interval]
68
+ end
69
+
70
+ rescue OptionParser::InvalidArgument => ex
71
+ STDERR.puts ex.message
72
+ STDERR.puts option_parser
73
+ end
74
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airstream
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,8 +11,8 @@ bindir: bin
11
11
  cert_chain: []
12
12
  date: 2012-11-03 00:00:00.000000000 Z
13
13
  dependencies: []
14
- description: ! "airstream allows to stream video and image files to\n airplay-devices,
15
- a webserver is needed for local video\n files"
14
+ description: ! "A command line tool to stream video and image files to\n airplay-devices,
15
+ a webserver is needed for local video\n files."
16
16
  email:
17
17
  - christoph at lipautz.org
18
18
  executables:
@@ -23,7 +23,7 @@ extra_rdoc_files: []
23
23
  files:
24
24
  - bin/airstream
25
25
  - bin/airimg
26
- homepage: http://www.lipautz.org/
26
+ homepage: https://github.com/unused/airstream
27
27
  licenses: []
28
28
  post_install_message:
29
29
  rdoc_options: []
@@ -42,7 +42,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
42
42
  - !ruby/object:Gem::Version
43
43
  version: '0'
44
44
  requirements: []
45
- rubyforge_project: airstream
45
+ rubyforge_project:
46
46
  rubygems_version: 1.8.24
47
47
  signing_key:
48
48
  specification_version: 3