airstream 0.3.7 → 0.4.2
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.
- checksums.yaml +7 -0
- data/bin/airimg +2 -0
- data/bin/airstream +25 -9
- data/lib/airstream.rb +1 -0
- data/lib/airstream/device.rb +22 -78
- data/lib/airstream/io.rb +4 -0
- data/lib/airstream/node.rb +1 -0
- data/lib/airstream/version.rb +1 -1
- data/lib/airstream/video.rb +8 -3
- metadata +20 -30
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 26c40a42a5da7cbfdd5467b39c2561d4af6e95d0
|
4
|
+
data.tar.gz: 095071b2e9df32109de7052bdb705434fc5cb16d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ebe726dd234697e786a91474b26f74e078f14016205c1ccdcccf70ac200b7e86350c734011de41d2951da9fd5d857540f0406d4edeb3304e3e8f4b10b2386113
|
7
|
+
data.tar.gz: f0bf04ee5c7768f0e60da864630f39540951b8fe5366acda57f1457bfb00724a96749456087da5fdd77e85c3295d2909042a43580c615b52b087d8292c30b19b
|
data/bin/airimg
CHANGED
data/bin/airstream
CHANGED
@@ -9,10 +9,10 @@ def self.exit(status)
|
|
9
9
|
end
|
10
10
|
|
11
11
|
options = {
|
12
|
-
reciever: '192.168.
|
12
|
+
reciever: '192.168.0.123',
|
13
13
|
quiet: false,
|
14
14
|
verbose: false,
|
15
|
-
|
15
|
+
# disable_local_http: true
|
16
16
|
}
|
17
17
|
|
18
18
|
CONFIG_FILE = File.join(ENV['HOME'], '.airstreamrc')
|
@@ -55,9 +55,9 @@ Basic options: (configure default in ~/.airstreamrc)
|
|
55
55
|
options[:verbose] = verbose
|
56
56
|
end
|
57
57
|
|
58
|
-
# opts.on("--
|
59
|
-
# "
|
60
|
-
# options[:
|
58
|
+
# opts.on("--disable-use-httpd",
|
59
|
+
# "do not create httpd to offer local files") do |disable_httpd|
|
60
|
+
# options[:disable_local_httpd] = true
|
61
61
|
# end
|
62
62
|
|
63
63
|
opts.on("-v", "--version",
|
@@ -86,15 +86,29 @@ begin
|
|
86
86
|
io = Airstream::Io.new
|
87
87
|
io.quiet = options[:quiet]
|
88
88
|
io.verbose = options[:verbose]
|
89
|
-
|
89
|
+
node = Airstream::Node.new options[:reciever]
|
90
|
+
device = Airstream::Device.new node
|
91
|
+
playlist.map! { |file| Airstream::Video.new(file) }
|
92
|
+
player = Airstream::Player.new device, playlist
|
93
|
+
|
94
|
+
io.puts "loading"
|
95
|
+
while player.loading?
|
96
|
+
io.print "."
|
97
|
+
sleep 0.8
|
98
|
+
end
|
90
99
|
|
91
100
|
io.puts "=> press ["+Airstream::Io::KEY_QUIT+"] to exit airstream"
|
92
101
|
Airstream::Io.hide_input
|
93
|
-
|
102
|
+
pbar = ProgressBar.create({ format: '%t |%b%i| %p%%', total: player.duration })
|
103
|
+
begin # reconsider playing...
|
94
104
|
sleep UPDATE_TIMEOUT
|
105
|
+
formatted_time = Time.at(player.elapsed_time).gmtime.strftime('%R:%S')
|
106
|
+
pbar.title = "#{formatted_time}"
|
107
|
+
pbar.progress = player.elapsed_time
|
95
108
|
io.catch_input
|
96
|
-
|
97
|
-
end until io.quit? ||
|
109
|
+
player.update io
|
110
|
+
end until io.quit? || player.finished?
|
111
|
+
pbar.finish
|
98
112
|
|
99
113
|
rescue Airplay::Protocol::InvalidMediaError
|
100
114
|
STDERR.puts
|
@@ -112,6 +126,8 @@ rescue OptionParser::InvalidArgument => ex
|
|
112
126
|
STDERR.puts ex.message
|
113
127
|
STDERR.puts option_parser
|
114
128
|
exit EXIT_ERROR
|
129
|
+
ensure
|
130
|
+
Airstream::Io.show_input
|
115
131
|
end
|
116
132
|
|
117
133
|
exit EXIT_OK
|
data/lib/airstream.rb
CHANGED
data/lib/airstream/device.rb
CHANGED
@@ -1,99 +1,43 @@
|
|
1
1
|
|
2
2
|
module Airstream
|
3
|
-
# pbar = ProgressBar.create(pbar_options)
|
4
|
-
# while (elapsed_time=server.video_position) < server.video_duration
|
5
|
-
# io.catch_input
|
6
|
-
# break if io.quit? || io.skip?
|
7
|
-
# pbar.progress = elapsed_time
|
8
|
-
# formatted_time = Time.at(elapsed_time).gmtime.strftime('%R:%S')
|
9
|
-
# pbar.title = "#{video_title} #{formatted_time}"
|
10
|
-
# sleep 0.5
|
11
|
-
# end
|
12
|
-
# io.show_input
|
13
|
-
# pbar.finish
|
14
|
-
class Device
|
15
|
-
|
16
|
-
@local_httpd_allowed = false
|
17
|
-
@current_file_index
|
18
3
|
|
19
|
-
|
20
|
-
@video_files = files
|
21
|
-
@reciever = Airstream::Node.new reciever
|
22
|
-
@current_file_index = 0
|
23
|
-
self.video = files.first unless files.empty?
|
24
|
-
end
|
4
|
+
class Device
|
25
5
|
|
26
|
-
|
27
|
-
@reciever.send_image image_file
|
28
|
-
end
|
6
|
+
attr_reader :player, :video_title
|
29
7
|
|
30
|
-
def
|
31
|
-
@
|
32
|
-
@video_duration = nil
|
33
|
-
video = Video.new(video_file)
|
34
|
-
@player = @reciever.send_video(video.url)
|
35
|
-
print "loading"
|
36
|
-
while loading?
|
37
|
-
print "."
|
38
|
-
sleep 0.8
|
39
|
-
end
|
40
|
-
@pbar = ProgressBar.create({ format: '%t |%b%i| %p%%', total: video_duration })
|
41
|
-
@video_title = File.basename(video_file, File.extname(video_file))
|
8
|
+
def initialize(reciever)
|
9
|
+
@reciever = reciever
|
42
10
|
end
|
43
11
|
|
44
|
-
def
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
elsif io.skip? || video_duration <= elapsed_time
|
52
|
-
@current_file_index += 1
|
53
|
-
self.video = @video_files[@current_file_index] if @video_files.count > @current_file_index
|
54
|
-
elsif io.prev?
|
55
|
-
if @current_file_index == 0
|
56
|
-
@reciever.scrub(0)
|
57
|
-
else
|
58
|
-
@current_file_index -= 1
|
59
|
-
self.video = @video_files[@current_file_index] if @video_files.count > @current_file_index
|
60
|
-
end
|
61
|
-
elsif io.fwd?
|
62
|
-
@reciever.scrub(video_position + 30) if video_position + 30 < video_duration
|
63
|
-
elsif io.back?
|
64
|
-
@reciever.scrub(video_position - 30) if video_position - 30 > 0
|
65
|
-
elsif io.pause?
|
66
|
-
paused? ? @player.pause : @player.resume
|
12
|
+
def file=(file)
|
13
|
+
if file.class == Video
|
14
|
+
self.video = file
|
15
|
+
# when
|
16
|
+
# TODO Image then self.image = file
|
17
|
+
else
|
18
|
+
raise "Unkown file type send to device"
|
67
19
|
end
|
68
20
|
end
|
69
21
|
|
70
|
-
def
|
71
|
-
|
72
|
-
!! (@current_file_index == @video_files.count-1) && (video_duration <= elapsed_time)
|
73
|
-
end
|
74
|
-
|
75
|
-
def allow_local_httpd=(is_allowed)
|
76
|
-
@local_httpd_allowed = is_allowed
|
77
|
-
end
|
78
|
-
|
79
|
-
def local_httpd_allowed?
|
80
|
-
@local_httpd_allowed
|
22
|
+
def image=(image_file)
|
23
|
+
@reciever.send_image image_file
|
81
24
|
end
|
82
25
|
|
83
|
-
def
|
84
|
-
@reciever.
|
26
|
+
def video=(video)
|
27
|
+
@player = @reciever.send_video video.url
|
28
|
+
@video_title = video.to_s
|
85
29
|
end
|
86
30
|
|
87
|
-
def
|
88
|
-
@
|
31
|
+
def scrub
|
32
|
+
@player.scrub
|
89
33
|
end
|
90
34
|
|
91
|
-
def
|
92
|
-
|
35
|
+
def duration
|
36
|
+
self.scrub["duration"]
|
93
37
|
end
|
94
38
|
|
95
|
-
def
|
96
|
-
|
39
|
+
def position
|
40
|
+
self.scrub["position"]
|
97
41
|
end
|
98
42
|
end
|
99
43
|
end
|
data/lib/airstream/io.rb
CHANGED
data/lib/airstream/node.rb
CHANGED
data/lib/airstream/version.rb
CHANGED
data/lib/airstream/video.rb
CHANGED
@@ -9,20 +9,25 @@ module Airstream
|
|
9
9
|
attr_reader :url
|
10
10
|
|
11
11
|
def initialize(video_file)
|
12
|
+
@filename = video_file
|
12
13
|
if File.exists? video_file
|
13
14
|
@@server.server.shutdown if @@server
|
14
|
-
@url = host_file
|
15
|
+
@url = host_file
|
15
16
|
else
|
16
17
|
@url = video_file
|
17
18
|
end
|
18
19
|
end
|
19
20
|
|
20
|
-
def
|
21
|
+
def to_s
|
22
|
+
File.basename(@filename, File.extname(@filename))
|
23
|
+
end
|
24
|
+
|
25
|
+
def host_file
|
21
26
|
@@server = Rack::Server.new(
|
22
27
|
:server => :webrick,
|
23
28
|
:Host => Airstream::Network.get_local_ip,
|
24
29
|
:Port => AIRSTREAM_PORT,
|
25
|
-
:app => Rack::File.new(
|
30
|
+
:app => Rack::File.new(@filename),
|
26
31
|
:AccessLog => [], # stfu webrick
|
27
32
|
:Logger => WEBrick::Log::new("/dev/null", 7)
|
28
33
|
)
|
metadata
CHANGED
@@ -1,97 +1,88 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: airstream
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.4.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Christoph Lipautz
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-12-23 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: airplay
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: ruby-progressbar
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rack
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: webrick
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: rake
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - '>='
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '0'
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - '>='
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
|
-
description:
|
83
|
+
description: |-
|
84
|
+
A command line tool to stream video and image files to
|
85
|
+
airplay-devices.
|
95
86
|
email:
|
96
87
|
- christoph at lipautz.org
|
97
88
|
executables:
|
@@ -111,27 +102,26 @@ files:
|
|
111
102
|
- lib/airstream/video.rb
|
112
103
|
homepage: https://github.com/unused/airstream
|
113
104
|
licenses: []
|
105
|
+
metadata: {}
|
114
106
|
post_install_message:
|
115
107
|
rdoc_options: []
|
116
108
|
require_paths:
|
117
109
|
- lib
|
118
110
|
- lib
|
119
111
|
required_ruby_version: !ruby/object:Gem::Requirement
|
120
|
-
none: false
|
121
112
|
requirements:
|
122
|
-
- -
|
113
|
+
- - '>='
|
123
114
|
- !ruby/object:Gem::Version
|
124
115
|
version: '0'
|
125
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
|
-
none: false
|
127
117
|
requirements:
|
128
|
-
- -
|
118
|
+
- - '>='
|
129
119
|
- !ruby/object:Gem::Version
|
130
120
|
version: '0'
|
131
121
|
requirements: []
|
132
122
|
rubyforge_project:
|
133
|
-
rubygems_version:
|
123
|
+
rubygems_version: 2.0.14
|
134
124
|
signing_key:
|
135
|
-
specification_version:
|
125
|
+
specification_version: 4
|
136
126
|
summary: A command line tool for streaming to airplay-devices
|
137
127
|
test_files: []
|