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

plugins.mbcmini: New Plugin for http://mini.imbc.com #3224

Closed
wants to merge 2 commits into from
Closed

plugins.mbcmini: New Plugin for http://mini.imbc.com #3224

wants to merge 2 commits into from

Conversation

hyperbora
Copy link

mbcmini is South Korea radio station.

@mkbloke
Copy link
Member

mkbloke commented Oct 4, 2020

I presume the reason you have added the --mbcmini-id parameter is because there's no direct URL exposed to users for each station? That's the logical solution for such a case, but I'll be interested to see if this is acceptable to the streamlink devs as it's counter to the way other plugins work, with the exception of just one - the sbscokr plugin which implements --sbscokr-id presumably for the same reason.

Edit: Actually two plugins if you count schoolism, although that seems to work partly on URL as well as a lesson part parameter.

@hyperbora
Copy link
Author

Hi, thanks for the review. I modified it to work without parameters as you said.

@mkbloke
Copy link
Member

mkbloke commented Oct 5, 2020

I'm sure they'll be happier with that. 👍

Copy link
Member

@bastimeyer bastimeyer left a comment

Choose a reason for hiding this comment

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

Thank you for the pull request. Is this a radio station only without any live video content?

Before writing a plugin and submitting a PR, it's usually best to open a plugin request or ask first whether it'll be accepted, because otherwise, you may waste the time you've spent on it if it gets rejected. I'm just mentioning it, because I don't know what the current policy is for audio-only streams (even though it's currently not stated in the contribution guidelines). I personally don't have a problem with this, but let's hear from the other maintainers as well.

json_data = json.loads(json_text)

if json_url_key in json_data:
return self.session.streams(json_data[json_url_key])
Copy link
Member

Choose a reason for hiding this comment

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

You are recursively calling the plugin's _get_streams method by calling self.session.streams (1, 2).

In Plugin._get_streams, you are supposed to return an iterator or a list of objects which implement the Stream class, eg. HLSStream, DashStream, HTTPStream, RTMPStream, etc., depending on what kind of streams the website you're writing the plugin for provides.

Copy link
Author

Choose a reason for hiding this comment

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

Hi, thanks for the review. I modified it to use HTTPStream.

Comment on lines 37 to 38
json_text = '{' + ''.join(res.text.split()[1:-1])
json_data = json.loads(json_text)
Copy link
Member

Choose a reason for hiding this comment

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

Plugins should use Streamlink's validator API to return results from network requests, if possible. The API response appears to be a JSONP call, which means you should extract the JSON payload via a regex instead of splitting the response text by newline characters.

Copy link
Author

Choose a reason for hiding this comment

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

Modified to use Streamlink's validation API.

@bastimeyer bastimeyer added more info required Further information is requested new plugin labels Oct 5, 2020
@hyperbora hyperbora marked this pull request as draft October 5, 2020 02:57
@hyperbora hyperbora marked this pull request as ready for review October 5, 2020 05:10
@hyperbora
Copy link
Author

This radio station only transmits audio content.

Copy link
Member

@bastimeyer bastimeyer left a comment

Choose a reason for hiding this comment

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

I've added a commit to the PR branch to fix up the plugin.
Whether it's good for merging depends on whether radio stations (audio only streams) are acceptable.

$ streamlink -l debug 'https://miniplay.imbc.com/WebLiveURL.ashx?channel=sfm'
[cli][debug] OS:         Linux-5.9.0-rc8-1-git-x86_64-with-glibc2.2.5
[cli][debug] Python:     3.8.5
[cli][debug] Streamlink: 1.6.0+23.g49f009f
[cli][debug] Requests(2.24.0), Socks(1.7.1), Websocket(0.56.0)
[cli][info] Found matching plugin mbcmini for URL https://miniplay.imbc.com/WebLiveURL.ashx?channel=sfm
[utils.l10n][debug] Language code: en_US
Available streams: 81k (worst, best)

@gravyboat
Copy link
Member

@bastimeyer My concern is that allowing a radio plugin opens up a pretty big can of worms. There are a million online radio stations, are we going to accept all those because "well you accepted mbcmini". One of the big reasons for putting a site through Streamlink is to make it less resource intensive (Twitch is always my go to example because the site is so awful) or terrible to use in the event of a mediocre video player. Radio stations don't suffer from that issue, it's just streaming audio and presumably isn't that resource intensive though I can't confirm because the site is geo-blocked.

I'm leaning towards no on this, Streamlink is designed specifically for video content, and live content at that. I don't think a radio station really counts any more than a playlist of audio files in my local audio player does. I'm open to discussing it but these are my thoughts. It's not a video, it's not especially resource intensive, so what need does Streamlink serve in this case?

@hyperbora
Copy link
Author

I understand. Then I'll close this PR.

@hyperbora hyperbora closed this Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
more info required Further information is requested new plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants