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

Add raw metadata for IcyInfo #6476

Closed
AlienAsRoger opened this issue Sep 26, 2019 · 1 comment
Closed

Add raw metadata for IcyInfo #6476

AlienAsRoger opened this issue Sep 26, 2019 · 1 comment
Assignees

Comments

@AlienAsRoger
Copy link

AlienAsRoger commented Sep 26, 2019

[REQUIRED] Use case description

Add ability to extract metadata from ICY on the client implementation.
Currently it's impossible to extract additional information from ICY metadata except title and url. It would be better if you would just pass rawMetadata as additional parameter to IcyInfo, so client will handle extraction on it's own if needed.

Use case is that we are using ads info that is passed along with title, but it's not in "title=", instead it's like adw_ad= or ad|main

Example that we are using:

[StreamTitle='';StreamUrl='';metadata='adswizzContext=fGg6M158cDo2MTkzI3U6ODU3MA%3D%3D';adw_ad='true';durationMilliseconds='30511';adId='54691';insertionType='midroll';]

Proposed solution

@Nullable
  @VisibleForTesting
  /* package */ Metadata decode(String metadata) {
    String name = null;
    String url = null;
    int index = 0;
    Matcher matcher = METADATA_ELEMENT.matcher(metadata);
    while (matcher.find(index)) {
      String key = Util.toLowerInvariant(matcher.group(1));
      String value = matcher.group(2);
      switch (key) {
        case STREAM_KEY_NAME:
          name = value;
          break;
        case STREAM_KEY_URL:
          url = value;
          break;
        default:
          Log.w(TAG, "Unrecognized ICY tag: " + name);
          break;
      }
      index = matcher.end();
    }
    return (name != null || url != null) ? new Metadata(new IcyInfo(name, url, metadata)) : null;
  }

and
  ....
  @Nullable public final String rawMetadata;
  ....

  public IcyInfo(@Nullable String title, @Nullable String url, @Nullable String rawMetadata) {
  ....
    this.rawMetadata = rawMetadata;


Alternatives considered

I know you were thinking about other possible use-cases whether to provide key-value pair, but I think providing just raw String would be sufficient.

@icbaker
Copy link
Collaborator

icbaker commented Sep 27, 2019

Thanks for the suggestion!

I agree that probably the best we can do is pass through the whole raw string, because it's not really defined what other tags (or separators) are allowed in ICY, so even key-value is tricky.

I think I'll tweak your suggestion to create the IcyInfo even if both title & url end up null, so that any arbitrary text in an ICY context gets passed along to the app to handle.

ojw28 pushed a commit that referenced this issue Oct 2, 2019
The ICY 'spec' isn't really clear/tight enough to do anything more
specific than this I think.

Issue:#6476
PiperOrigin-RevId: 272405322
@ojw28 ojw28 closed this as completed Oct 2, 2019
ojw28 pushed a commit that referenced this issue Oct 14, 2019
The ICY 'spec' isn't really clear/tight enough to do anything more
specific than this I think.

Issue:#6476
PiperOrigin-RevId: 272405322
@google google locked and limited conversation to collaborators Dec 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants