1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-24 04:05:39 +01:00

raw: output to directory

This commit is contained in:
Johan Andersson 2015-01-25 13:53:47 +01:00
parent d38992af51
commit 2a8ecf1106

View File

@ -18,8 +18,10 @@ class Raw(Service):
return
if self.url.find(".f4m") > 0:
if options.output is None:
if options.output is None or os.path.isdir(options.output):
filename = os.path.basename(self.url[:self.url.rfind("/")-1])
if os.path.isdir(options.output):
filename = "%s/%s" % (os.path.dirname(options.output), filename)
options.output = "%s.flv" % filename
streams = hdsparse(copy.copy(options), self.url)
if streams:
@ -27,8 +29,10 @@ class Raw(Service):
yield streams[n]
if self.url.find(".m3u8") > 0:
streams = hlsparse(self.url)
if options.output is None:
if options.output is None or os.path.isdir(options.output):
filename = os.path.basename(self.url[:self.url.rfind("/")-1])
if os.path.isdir(options.output):
filename = "%s/%s" % (os.path.dirname(options.output), filename)
options.output = "%s.ts" % filename
for n in list(streams.keys()):
yield HLS(copy.copy(options), streams[n], n)