diff --git a/.bundle/config b/.bundle/config new file mode 100644 index 0000000..9bc01b4 --- /dev/null +++ b/.bundle/config @@ -0,0 +1,3 @@ +--- +BUNDLE_PATH: "vendor/bundle" +BUNDLE_DISABLE_SHARED_GEMS: "true" diff --git a/.gitignore b/.gitignore index f6ef6ce..5ff5768 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /pkg - +/vendor/ coverage +/.bundle/ \ No newline at end of file diff --git a/.rbenv-version b/.rbenv-version deleted file mode 100644 index cb50681..0000000 --- a/.rbenv-version +++ /dev/null @@ -1 +0,0 @@ -2.0.0-p247 diff --git a/.travis.yml b/.travis.yml index 4172c2b..74a2279 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,3 +6,4 @@ bundler_args: --without development rvm: - 1.9.2 - 2.0.0 + - 2.2.2 diff --git a/Gemfile b/Gemfile index 26c1319..2622236 100644 --- a/Gemfile +++ b/Gemfile @@ -3,6 +3,7 @@ source "https://rubygems.org" gemspec gem 'rake' +gem 'youtube-dl.rb' group :development do gem 'rake-notes' diff --git a/Gemfile.lock b/Gemfile.lock index e956450..fce20ab 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,10 +1,10 @@ PATH remote: . specs: - airstream (0.4.9) + airstream (0.4.11) airplay (~> 0.2.9) rack (~> 1.5.2) - ruby-progressbar (~> 1.1.1) + ruby-progressbar (~> 1.7.0) webrick (~> 1.3.1) GEM @@ -21,7 +21,11 @@ GEM builder (3.2.2) childprocess (0.5.5) ffi (~> 1.0, >= 1.0.11) + climate_control (0.2.0) + cocaine (0.6.0) + terrapin (= 0.6.0) colored (1.2) + connection_pool (2.2.1) coveralls (0.7.11) multi_json (~> 1.10) rest-client (>= 1.6.8, < 2) @@ -45,8 +49,9 @@ GEM minitest (5.5.1) multi_json (1.11.0) multi_test (0.1.2) - net-http-digest_auth (1.4) + net-http-digest_auth (1.4.1) net-http-persistent (2.9.4) + connection_pool (~> 2.2) netrc (0.10.3) oj (2.12.1) rack (1.5.5) @@ -61,7 +66,7 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.2.0) rspec-support (3.2.2) - ruby-progressbar (1.1.1) + ruby-progressbar (1.7.5) simplecov (0.9.2) docile (~> 1.1.0) multi_json (~> 1.0) @@ -69,9 +74,13 @@ GEM simplecov-html (0.9.0) term-ansicolor (1.3.0) tins (~> 1.0) + terrapin (0.6.0) + climate_control (>= 0.0.3, < 1.0) thor (0.19.1) tins (1.3.5) webrick (1.3.1) + youtube-dl.rb (0.3.1.2016.09.11.1) + cocaine (>= 0.5.4) PLATFORMS ruby @@ -85,6 +94,7 @@ DEPENDENCIES oj rake rake-notes + youtube-dl.rb BUNDLED WITH - 1.10.6 + 1.15.1 diff --git a/README.md b/README.md index 341be51..7eecc39 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,11 @@ You can also use wildcards and handle files as usually... airstream /home/me/*.mp4 -o 192.168.1.8 airstream /home/me/my-birthday-20{08,10,12}.mov -o 192.168.1.8 ``` +Airstream automatically find your Apple TV on your local network. It also can play remote files, even from Youtube, Vimeo and others (don't forget to install youtube-dl). +```shell +airstream http://youtube.com/watch?v=gCluaJe3lb4 +``` + Use airimg to send images to the airplay device. ```shell airimg http://example.com/photo.png -o 192.168.1.8 diff --git a/airstream.gemspec b/airstream.gemspec index a6457e9..2a9872a 100644 --- a/airstream.gemspec +++ b/airstream.gemspec @@ -28,7 +28,7 @@ lib/airstream/video.rb s.add_dependency 'airplay', '~> 0.2.9' - s.add_dependency 'ruby-progressbar', '~> 1.1.1' + s.add_dependency 'ruby-progressbar', '~> 1.7.0' s.add_dependency 'rack', '~> 1.5.2' s.add_dependency 'webrick', '~> 1.3.1' diff --git a/lib/airstream/version.rb b/lib/airstream/version.rb index f42d258..444fa0f 100644 --- a/lib/airstream/version.rb +++ b/lib/airstream/version.rb @@ -1,4 +1,4 @@ module Airstream - VERSION = '0.4.10' + VERSION = '0.4.11' end diff --git a/lib/airstream/video.rb b/lib/airstream/video.rb index 92c3fc8..4c7c266 100644 --- a/lib/airstream/video.rb +++ b/lib/airstream/video.rb @@ -1,6 +1,7 @@ require 'rack' require 'webrick' +require 'youtube-dl.rb' module Airstream class Video @@ -8,7 +9,19 @@ class Video @@server = nil def initialize(video_file) - @filename = video_file + options = { + skip_download: true, + get_url: true, + format: :best, + continue: false, + color: false, + progress: false + } + begin + @filename = YoutubeDL::Runner.new(video_file, options).run + rescue # optionally: `except Exception, ex:` + @filename = video_file + end end def to_s