Thanks to visit codestin.com
Credit goes to github.com

Skip to content

cli: add title to json#3941

Closed
odnar-dev wants to merge 11 commits into
streamlink:masterfrom
odnar-dev:odnar-dev-patch-1
Closed

cli: add title to json#3941
odnar-dev wants to merge 11 commits into
streamlink:masterfrom
odnar-dev:odnar-dev-patch-1

Conversation

@odnar-dev

@odnar-dev odnar-dev commented Aug 26, 2021

Copy link
Copy Markdown

image

image

used as mpv backend :
image

@odnar-dev odnar-dev marked this pull request as ready for review August 26, 2021 06:34

@bastimeyer bastimeyer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the PR.

You are introducing a breaking change of Streamlink's CLI with that. I am not sure if this is worth adding right now. Maybe later when we decide to bump the major release version.

Also, before this can get merged, the tests need to be fixed first, which includes the mocked test setup which is currently not ideal for the title metadata.

Comment thread src/streamlink_cli/main.py Outdated
Comment thread src/streamlink_cli/main.py Outdated
@bastimeyer bastimeyer added the CLI label Aug 26, 2021
@odnar-dev odnar-dev requested a review from bastimeyer August 26, 2021 14:33
Comment thread src/streamlink_cli/main.py Outdated
Comment thread src/streamlink_cli/console.py
Comment thread src/streamlink_cli/main.py Outdated
@bastimeyer

Copy link
Copy Markdown
Member

After thinking about it again (I only had the diff in mind in my previous comment, sorry), do we want the interpolated --title parameter value in the JSON output, or the individual stream metadata properties?

The --title parameter is just a utility for formatting the window title of the player launched by Streamlink, which is not useful for JSON data, where individual metadata properties make much more sense.

@odnar-dev

Copy link
Copy Markdown
Author

After thinking about it again (I only had the diff in mind in my previous comment, sorry), do we want the interpolated --title parameter value in the JSON output, or the individual stream metadata properties?

both

The --title parameter is just a utility for formatting the window title of the player launched by Streamlink, which is not useful for JSON data, where individual metadata properties make much more sense.

i have a script that use streamlink as mpv backend instead of youtube-dl for some specific sites like twitch... $
just by typing "mpv %url%"
it run 'streamlink -j url quality' then extract streamurl from the response and passe it to mpv
this is needed so they are no need to call streamlink two times to get the title

@bastimeyer

Copy link
Copy Markdown
Member

What I am saying is that the JSON data should not include the custom --title stuff but rather the individual values of the plugin metadata, so one who uses the JSON response can read metadata separately, which is impossible with a single string based on the user's --title value. In your case, these single metadata properties can be used and combined for formatting the player window title.

{
  "type": "hls",
  "url": "https://foo",
  "master": "https://bar",
  "headers": {},
  "metadata": {
    "author": ...,
    "category": ...,
    "title": ...,
  }
}

@odnar-dev

Copy link
Copy Markdown
Author

i am not sure if this is worth adding right now ;
if user wanted only a specific metadata like the author name he can alwayse call streamlink -j --title "{author}" %url% best
if he wanted multiple metadata properties, he probably gonna combine them; so instead of just calling streamlink with the formate he wanted, he gonna need to combine them manually

also this way respect the formate in streamlink config file if i called streamlink -j %url% best

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants