Skip to content

Add {url} argument to window --title #2232

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

Merged
merged 3 commits into from
Feb 9, 2019

Conversation

RomanKornev
Copy link
Contributor

For #2225
Adds {url} formatting variable to player window --title.

Can there be a situation where args.url doesn't exist?
If so, maybe I should add a DEFAULT_STREAM_METADATA["url"]?

DEFAULT_STREAM_METADATA = {
"title": u"Unknown Title",
"author": u"Unknown Author",
"category": u"No Category",
"game": u"No Game/Category"
}

@codecov
Copy link

codecov bot commented Jan 4, 2019

Codecov Report

Merging #2232 into master will decrease coverage by 0.03%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #2232      +/-   ##
==========================================
- Coverage   52.67%   52.64%   -0.04%     
==========================================
  Files         237      237              
  Lines       14744    14747       +3     
==========================================
- Hits         7766     7763       -3     
- Misses       6978     6984       +6

@beardypig
Copy link
Member

args.url can be None, but never when launching the player, so I think you'd be OK here.

@back-to
Copy link
Collaborator

back-to commented Jan 11, 2019

plugin.url is also available there, instead of args.url

@RomanKornev
Copy link
Contributor Author

I haven't seen any problems using url=args.url.

@beardypig
Copy link
Member

Do urls get unshortened, E.g. bitly, when using args.url?

@RomanKornev
Copy link
Contributor Author

No, with args.url they do not. With plugin.url they do. So I guess plugin.url is more robust.

Another thing I noticed when using plugin.url is that now every URL has a scheme http:// prefixed. That might not be the most readable representation. Maybe we should drop the scheme for title using:

url=''.join(urlsplit(plugin.url)[1:])

@RomanKornev
Copy link
Contributor Author

I guess something like

parsed = urlparse(url)
scheme = "%s://" % parsed.scheme
return parsed.geturl().replace(scheme, '', 1)

would be more robust at dropping the scheme.

Copy link
Collaborator

@back-to back-to left a comment

Choose a reason for hiding this comment

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

probably also okay with the url scheme

@RomanKornev
Copy link
Contributor Author

probably also okay with the url scheme

@back-to Do you mean it's fine as a raw URL or should I implement scheme dropping?

@back-to back-to merged commit 71d550f into streamlink:master Feb 9, 2019
@RomanKornev RomanKornev deleted the add-title-url branch February 11, 2019 11:03
jackyzy823 pushed a commit to jackyzy823/streamlink that referenced this pull request Mar 20, 2019
Billy2011 pushed a commit to Billy2011/streamlink-27 that referenced this pull request May 14, 2020
mkbloke pushed a commit to mkbloke/streamlink that referenced this pull request Aug 18, 2020
resiproxy pushed a commit to resiproxy/streamlink that referenced this pull request Nov 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants