Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
0cb3987380
20
Common.py
20
Common.py
@ -257,29 +257,23 @@ def appendError(obj):
|
|||||||
class downloader(XiGuaLiveApi):
|
class downloader(XiGuaLiveApi):
|
||||||
playlist = None
|
playlist = None
|
||||||
|
|
||||||
def updRoomInfo(self):
|
def _updateRoomOnly(self):
|
||||||
global broadcaster, isBroadcasting, updateTime, forceNotBroadcasting, forceNotDownload
|
global broadcaster, isBroadcasting, updateTime
|
||||||
super(downloader, self).updRoomInfo()
|
super(downloader, self)._updateRoomOnly()
|
||||||
updateTime = datetime.strftime(datetime.now(), dt_format)
|
updateTime = datetime.strftime(datetime.now(), dt_format)
|
||||||
broadcaster = self.roomLiver
|
broadcaster = self.roomLiver
|
||||||
isBroadcasting = self.isLive
|
isBroadcasting = self.isLive
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
self.updPlayList()
|
self.updPlayList()
|
||||||
else:
|
else:
|
||||||
forceNotDownload = False
|
|
||||||
forceNotBroadcasting = False
|
|
||||||
self.playlist = False
|
self.playlist = False
|
||||||
|
|
||||||
def updPlayList(self):
|
def updPlayList(self):
|
||||||
global streamUrl
|
global streamUrl
|
||||||
if self.isLive:
|
if self.isLive and "stream_url" in self._rawRoomInfo:
|
||||||
if "stream_url" in self._rawRoomInfo:
|
self.playlist = self._rawRoomInfo["stream_url"]["flv_pull_url"]
|
||||||
if self.playlist is None:
|
self.playlist = self.playlist.replace("_uhd", "").replace("_sd", "").replace("_ld", "")
|
||||||
self.playlist = None
|
streamUrl = self.playlist
|
||||||
else:
|
|
||||||
self.playlist = self._rawRoomInfo["stream_url"]["flv_pull_url"]
|
|
||||||
self.playlist = self.playlist.replace("_uhd", "").replace("_sd", "").replace("_ld", "")
|
|
||||||
streamUrl = self.playlist
|
|
||||||
else:
|
else:
|
||||||
streamUrl = None
|
streamUrl = None
|
||||||
self.playlist = None
|
self.playlist = None
|
||||||
|
@ -10,8 +10,6 @@ from liveDownloader import run as RUN
|
|||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.config['JSON_AS_ASCII'] = False
|
app.config['JSON_AS_ASCII'] = False
|
||||||
CORS(app, supports_credentials=True)
|
CORS(app, supports_credentials=True)
|
||||||
# url_for('static', filename='index.html')
|
|
||||||
# url_for('static', filename='index.js')
|
|
||||||
|
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
|
@ -191,7 +191,6 @@ if __name__ == "__main__":
|
|||||||
resetColor()
|
resetColor()
|
||||||
time.sleep(60)
|
time.sleep(60)
|
||||||
api.updRoomInfo()
|
api.updRoomInfo()
|
||||||
sys.exit()
|
|
||||||
print("进入", api.roomLiver, "的直播间")
|
print("进入", api.roomLiver, "的直播间")
|
||||||
os.system("title {}".format(api.getTitle()))
|
os.system("title {}".format(api.getTitle()))
|
||||||
print("=" * 30)
|
print("=" * 30)
|
||||||
|
3
api.py
3
api.py
@ -145,8 +145,7 @@ class XiGuaLiveApi:
|
|||||||
"""
|
"""
|
||||||
if self.name is None or self.roomLiver is None:
|
if self.name is None or self.roomLiver is None:
|
||||||
return False
|
return False
|
||||||
if self.name in self.roomLiver:
|
return True
|
||||||
return True
|
|
||||||
|
|
||||||
def _forceSearchUser(self):
|
def _forceSearchUser(self):
|
||||||
"""
|
"""
|
||||||
|
@ -26,8 +26,8 @@ def download():
|
|||||||
isDownload = True
|
isDownload = True
|
||||||
Common.appendDownloadStatus("Download >{}< Start".format(path))
|
Common.appendDownloadStatus("Download >{}< Start".format(path))
|
||||||
f = open(path, "wb")
|
f = open(path, "wb")
|
||||||
|
_size = 0
|
||||||
try:
|
try:
|
||||||
_size = 0
|
|
||||||
for t in p.iter_content(chunk_size=64 * 1024):
|
for t in p.iter_content(chunk_size=64 * 1024):
|
||||||
if Common.forceNotDownload:
|
if Common.forceNotDownload:
|
||||||
Common.modifyLastDownloadStatus("Force Stop Download".format(path))
|
Common.modifyLastDownloadStatus("Force Stop Download".format(path))
|
||||||
|
Reference in New Issue
Block a user