def get_stream(playlist, directory, own_name):
modellist.append(str(own_name))
start_time = "_" + str(datetime.datetime.now().hour) + "-" + str(datetime.datetime.now().minute)
ffs_script = directory + "ts_to_mp4.sh"
merged_file = encoded + own_name + start_time + ".mp4"
stream_file = directory + own_name + start_time + ".ts"
with open(ffs_script, "a+", encoding="utf8") as ffs:
ffs.write("\nffmpeg -i " + stream_file + " -strict -2 -c:v copy " + merged_file + "\n")
ffs.write("chmod 666 " + merged_file + "\n")
os.chmod(ffs_script, 0o777)
with open(oneclick_file, "a+", encoding="utf8") as ocf:
ocf.write("\nffmpeg -i " + stream_file + " -strict -2 -c:v copy " + merged_file + "\n")
ocf.write("chmod 666 " + merged_file + "\n")
os.chmod(oneclick_file, 0o777)
hlsvar = "hlsvariant://" + playlist
print("Retrieving the Streamfile for " + str(own_name))
baitlist_file = cwd + "baitlist.txt"
with open(baitlist_file, "a+", encoding="utf8") as bl:
bl.write(own_name + "\n")
if not os.path.isfile(stream_file):
subprocess.check_call(["livestreamer", "--hls-segment-threads", str(numcpucores), "--retry-streams", "5", "--retry-open", "5", "--hls-segment-attempts", "5", "--hls-segment-timeout", "20", "--http-header", "User-Agent=Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0", "-o", stream_file , hlsvar, "best"])
os.chmod(stream_file, 0o666)
modellist.remove(str(own_name))
return
评论列表
文章目录