Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Picarto plugin: update RTMPStream settings #1469

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/livestreamer/plugins/picarto.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
from livestreamer.stream import RTMPStream

API_CHANNEL_INFO = "https://picarto.tv/process/channel"
RTMP_URL = "{}/?{}/{}"
RTMP_URL = "rtmp://{}:1935/play/"
RTMP_PLAYPATH = "golive+{}?token={}"

_url_re = re.compile(r"""
https?://(\w+\.)?picarto\.tv/[^&?/]
""", re.VERBOSE)

_channel_casing_re = re.compile(r"""
<script>placeStreamChannel\('(?P<channel>[^']+)',[^,]+,[^,]+,'(?P<visibility>[^']+)'\);</script>
<script>placeStreamChannelFlash\('(?P<channel>[^']+)',[^,]+,[^,]+,'(?P<visibility>[^']+)',[^,]+\);</script>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take a look at my comments in PR #1332. The matching of placeStreamChannelFlash works if a single person is streaming, or placeStreamChannel if they are involved with a multistream. The following works for both as long as it isn't a multistream where the primary streamer is offline
<script>placeStreamChannel(Flash)?\('(?P<channel>[^']+)',[^,]+,[^,]+,'(?P<visibility>[^']+)'(,[^,]+)?\);</script>
If the page you go to is involved in a multistream and the primary streamer (the one who's page you went to) is offline, but the secondary or tertiary stream is live, it will incorrectly match the second or third stream instead of (correctly) reporting the stream offline.

""", re.VERBOSE)


Expand All @@ -37,7 +38,8 @@ def _get_streams(self):

streams = {}
streams["live"] = RTMPStream(self.session, {
"rtmp": RTMP_URL.format(channel_server_res.text, visibility, channel),
"rtmp": RTMP_URL.format(channel_server_res.text),
"playpath": RTMP_PLAYPATH.format(channel, visibility),
"pageUrl": self.url,
"live": True
})
Expand Down