support other types of streams such as rtmp

This commit is contained in:
zuckerberg 2021-09-08 21:09:31 -04:00
parent 7576e847ca
commit 2a95c597cc
2 changed files with 4 additions and 2 deletions

View File

@ -4,5 +4,5 @@ pkgs.python3Packages.buildPythonApplication {
pname = "radio"; pname = "radio";
src = self; src = self;
version = "0.1"; version = "0.1";
propagatedBuildInputs = with pkgs.python3Packages; [ pip ffmpeg-python flask requests pkgs.ffmpeg ]; propagatedBuildInputs = with pkgs.python3Packages; [ pip ffmpeg-python flask requests pkgs.ffmpeg pkgs.rtmpdump ];
} }

View File

@ -27,7 +27,9 @@ class Radio(object):
def play(self): def play(self):
self.playingUrl = self.queue.get() self.playingUrl = self.queue.get()
info = downloader.getVideoInfo(self.playingUrl) info = downloader.getVideoInfo(self.playingUrl)
if info is None or ("direct" in info and info["direct"] == True): if info is None:
return self.play()
elif "direct" in info and info["direct"] == True:
self.downloader = downloader.DirectDownloader(self.playingUrl, self.downloadFinished) self.downloader = downloader.DirectDownloader(self.playingUrl, self.downloadFinished)
else: else:
self.downloader = downloader.YtdlpDownloader(self.playingUrl, self.downloadFinished) self.downloader = downloader.YtdlpDownloader(self.playingUrl, self.downloadFinished)