JOCHLSDownloader 0.0.4 → 0.0.5
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.
- data/lib/JOCHLSDownloader.rb +12 -2
- metadata +1 -1
data/lib/JOCHLSDownloader.rb
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
#file: JOCHLSDownloader.rb
|
2
|
-
|
3
2
|
# CJOCHLSDownloader -- Downloads all HLS data from a URL
|
4
3
|
# Copyright (c) 2014 Jordi Cenzano (www.jordicenzano.name)
|
5
4
|
|
6
|
-
|
7
5
|
#Checked with ruby 1.9.3 perhaps it works with lower versions
|
8
6
|
if RUBY_VERSION < "1.9.3"
|
9
7
|
fail "JOCHLSDownloader requires ruby >= 1.9.3."
|
@@ -52,6 +50,10 @@ class CJOCHLSDownloader
|
|
52
50
|
|
53
51
|
private
|
54
52
|
|
53
|
+
#Download a m3u8 file and call to parse function
|
54
|
+
# @param domain [String] Source domain to download m3u8 file
|
55
|
+
# @param url [String] Source url path to download m3u8 file
|
56
|
+
# @param basedir [String] local filesystem path to save the downloaded files
|
55
57
|
def downloadHLS (domain, url, basedir)
|
56
58
|
Log Logger::DEBUG, "downloadHLS domain: #{domain}, URL: #{url}, basedir: #{basedir}"
|
57
59
|
|
@@ -82,6 +84,11 @@ private
|
|
82
84
|
end
|
83
85
|
end
|
84
86
|
|
87
|
+
#Parse a m3u8 file
|
88
|
+
# @param file [String] path to donwloaded m3u8 to parse
|
89
|
+
# @param domain [String] Source domain of downloaded m3u8 file
|
90
|
+
# @param url [String] Source url path to downloaded m3u8 file
|
91
|
+
# @param basedir [String] local filesystem path to save the downloaded files
|
85
92
|
def parsem3u8 (file, domain, url, basedir)
|
86
93
|
|
87
94
|
File.open( file ).each do |line|
|
@@ -110,6 +117,9 @@ private
|
|
110
117
|
end
|
111
118
|
end
|
112
119
|
|
120
|
+
#Send a log to file or to stderr
|
121
|
+
# @param type type of log
|
122
|
+
# @param message [String] log message
|
113
123
|
def Log (type, message)
|
114
124
|
|
115
125
|
#To test
|