flv-dl 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/ChangeLog.md +12 -0
  2. data/README.md +3 -1
  3. data/bin/flv-dl +12 -12
  4. data/gemspec.yml +1 -1
  5. metadata +2 -2
data/ChangeLog.md CHANGED
@@ -1,3 +1,15 @@
1
+ ### 0.2.0 / 2012-08-14
2
+
3
+ #### flv-dl
4
+
5
+ * Made the default behaviour to download the video.
6
+ * Fixed the `--play` option.
7
+ * Added the `-P --player` option.
8
+
9
+ ### 0.1.1 / 2012-07-14
10
+
11
+ * Forgot to add uri-query_params as a dependency.
12
+
1
13
  ### 0.1.0 / 2012-07-14
2
14
 
3
15
  * Initial release:
data/README.md CHANGED
@@ -30,11 +30,13 @@ Because **fuck flash**, that's why.
30
30
 
31
31
  Downloads a video:
32
32
 
33
+ flv-dl "URL"
33
34
  flv-dl -o video.flv "URL"
34
35
 
35
36
  Plays a video:
36
37
 
37
- flv-dl -p totem "URL"
38
+ export VIDEO_PLAYER=mplayer
39
+ flv-dl -p "URL"
38
40
 
39
41
  List available formats / URLs:
40
42
 
data/bin/flv-dl CHANGED
@@ -7,7 +7,7 @@ require 'pp'
7
7
  require 'flv/video'
8
8
 
9
9
  options = {
10
- :mode => :play,
10
+ :mode => :download,
11
11
  :player => ENV['VIDEO_PLAYER'],
12
12
  :format => :flv
13
13
  }
@@ -20,9 +20,12 @@ optparser = OptionParser.new do |opts|
20
20
  options[:output] = output
21
21
  end
22
22
 
23
- opts.on('-p','--play [COMMAND]','Play the video URL') do |player|
24
- options[:mode] = :play
25
- options[:player] = player if player
23
+ opts.on('-p','--play','Play the video URL') do
24
+ options[:mode] = :play
25
+ end
26
+
27
+ opts.on('-P','--player COMMAND','Video player command') do |player|
28
+ options[:player] = player
26
29
  end
27
30
 
28
31
  opts.on('-f',"--format [#{FLV::Video::FORMATS.keys.join(', ')}]",'The video format') do |format|
@@ -76,17 +79,12 @@ else
76
79
  case options[:mode]
77
80
  when :play
78
81
  unless options[:player]
79
- $stderr.puts "Must specify the video player via --play or $VIDEO_PLAYER"
82
+ $stderr.puts "Must specify the video player via --player or $VIDEO_PLAYER"
80
83
  exit -1
81
84
  end
82
85
 
83
- system(options[:player],video_url)
86
+ system(options[:player],video_url.to_s)
84
87
  when :download
85
- unless options[:output]
86
- $stderr.puts "Must specify --output PATH"
87
- exit -1
88
- end
89
-
90
88
  puts ">>> Requesting #{video_url} ..."
91
89
 
92
90
  http = Net::HTTP.new(video_url.host,video_url.port)
@@ -105,7 +103,9 @@ else
105
103
  http.request(request) do |response|
106
104
  size, total = 0, response.header['Content-Length'].to_i
107
105
 
108
- video_path = options.fetch(:output)
106
+ video_path = options.fetch(:output) do
107
+ "#{video.title}.#{options[:format]}"
108
+ end
109
109
 
110
110
  puts ">>> Downloading to #{video_path.dump} ..."
111
111
 
data/gemspec.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  name: flv-dl
2
- version: 0.1.1
2
+ version: 0.2.0
3
3
  summary: Downloads Flash Video (flv) files from web-pages.
4
4
  description:
5
5
  Downloads or plays Flash Video (flv) files directly from web-pages.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flv-dl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-14 00:00:00.000000000 Z
12
+ date: 2012-08-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: uri-query_params