airstream 0.4.4 → 0.4.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5dcc6b746507c0834d07796b1210fdd144a63fc0
4
- data.tar.gz: 514729d6c594017ddfa7f2b5ffced46f4b14c48e
3
+ metadata.gz: ac0c884a1f577c6fc3fc4e1b0c3a355b385d77d3
4
+ data.tar.gz: 5b1a0c88738bfc1f0d2c922de030e3f250526b1c
5
5
  SHA512:
6
- metadata.gz: 1e94db9ed3a632972a85e8345d4c234b923f88cbc8c7fc4095f97bd3209e4e350bbd82ae5d4a50e22e6c6e4101b9f7149c3af000028951918154c3540d82c292
7
- data.tar.gz: 66740428e655199cf331d77ff629d48554109ecf28fd58065089241937738c9b8a1425a78c2235d9371429ebe66c98c0ebe22f593e58767d8fdb55bdc8ce2cf9
6
+ metadata.gz: b30d51c232d4aee85c099e52fde1ac32899e6a8eca2ac85903ae0b3cd6f75f496f27f70dd931e6b9daddbb4b21dec070bc884e4c8731d2a6bec1fd7e76ee791f
7
+ data.tar.gz: b1b079c7f04119542aeb3c6a92b0277bf5355dbfc4665cd73c6db985ba2d515404d3cb32e7fd44d63b43a5b3e09912d1fb70e44abb324902f4098784764a47b6
@@ -88,22 +88,17 @@ begin
88
88
  io.verbose = options[:verbose]
89
89
  node = Airstream::Node.new options[:reciever]
90
90
  device = Airstream::Device.new node
91
+ io.puts "loading can take a few seconds..."
91
92
  playlist.map! { |file| Airstream::Video.new(file) }
92
93
  player = Airstream::Player.new device, playlist
93
94
 
94
- io.puts "loading"
95
- while player.loading?
96
- io.print "."
97
- sleep 0.8
98
- end
99
-
100
95
  io.puts "=> press ["+Airstream::Io::KEY_QUIT+"] to exit airstream"
101
96
  Airstream::Io.hide_input
102
97
  pbar = ProgressBar.create({ format: '%t |%b%i| %p%%', total: player.duration })
103
98
  begin # reconsider playing...
104
99
  sleep UPDATE_TIMEOUT
105
100
  formatted_time = Time.at(player.elapsed_time).gmtime.strftime('%R:%S')
106
- pbar.title = "#{formatted_time}"
101
+ pbar.title = "#{player.current_title} #{formatted_time}"
107
102
  pbar.progress = player.elapsed_time
108
103
  io.catch_input
109
104
  player.update io
@@ -17,6 +17,11 @@ module Airstream
17
17
  else
18
18
  raise "Unkown file type send to device"
19
19
  end
20
+ block_while_loading
21
+ end
22
+
23
+ def block_while_loading
24
+ sleep 0.2 until position != 0
20
25
  end
21
26
 
22
27
  def image=(image_file)
@@ -36,8 +41,8 @@ module Airstream
36
41
  @player.resume
37
42
  end
38
43
 
39
- def scrub
40
- @player.scrub
44
+ def scrub(seconds=nil)
45
+ @player.scrub seconds
41
46
  end
42
47
 
43
48
  def duration
@@ -22,7 +22,6 @@ module Airstream
22
22
  end
23
23
 
24
24
  def current_file=(file)
25
- # OPTIMIZE check if file exists (local, remote)
26
25
  @device.file = file
27
26
  end
28
27
  private :current_file=
@@ -69,6 +68,10 @@ module Airstream
69
68
  end
70
69
  end
71
70
 
71
+ def current_title
72
+ @files[@file_index]
73
+ end
74
+
72
75
  def finished?
73
76
  @finished || false
74
77
  end
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Airstream
3
- VERSION = '0.4.4'
3
+ VERSION = '0.4.6'
4
4
  end
@@ -6,23 +6,21 @@ module Airstream
6
6
  class Video
7
7
 
8
8
  @@server = nil
9
- attr_reader :url
10
9
 
11
10
  def initialize(video_file)
12
11
  @filename = video_file
13
- if File.exists? video_file
14
- @@server.server.shutdown if @@server
15
- @url = host_file
16
- else
17
- @url = video_file
18
- end
19
12
  end
20
13
 
21
14
  def to_s
22
15
  File.basename(@filename, File.extname(@filename))
23
16
  end
24
17
 
18
+ def url
19
+ File.exists?(@filename) ? host_file : @filename
20
+ end
21
+
25
22
  def host_file
23
+ @@server.server.shutdown if @@server
26
24
  @@server = Rack::Server.new(
27
25
  :server => :webrick,
28
26
  :Host => Airstream::Network.get_local_ip,
@@ -36,5 +34,6 @@ module Airstream
36
34
  end
37
35
  "http://#{@@server.options[:Host]}:#{@@server.options[:Port]}"
38
36
  end
37
+ private :host_file
39
38
  end
40
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airstream
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christoph Lipautz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-23 00:00:00.000000000 Z
11
+ date: 2014-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: airplay