-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathteletask-cli.rb
More file actions
executable file
·41 lines (35 loc) · 905 Bytes
/
Copy pathteletask-cli.rb
File metadata and controls
executable file
·41 lines (35 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#
# This script handles the command line input only
# The actual logic is in /lib
#
require_relative 'lib/teletask_feed.rb'
require 'optparse'
options = {}
options_parser =
OptionParser.new do |opts|
opts.banner = "Usage: teletask-cli.rb [options]"
opts.on("-x", "--xspf LOCATION", "Generates an xspf playlist from a feed at location") do |location|
options[:xspf] = location
end
opts.on("-d", "--download LOCATION", "Downloads all videos from a feed at location") do |location|
options[:download] = location
end
opts.on_tail("-h", "--help", "Show this message") do
puts opts
exit
end
end
options_parser.parse!
if(options[:xspf])
TeletaskFeed
.new(options[:xspf])
.parse_tracks
.write_xspf
elsif(options[:download])
TeletaskFeed
.new(options[:download])
.parse_tracks
.download_files
else
puts options_parser
end