Skip to content
New issue

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

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

Already on GitHub? # to your account

Potential issue/bug? #5

Open
birme opened this issue Jun 17, 2023 · 1 comment
Open

Potential issue/bug? #5

birme opened this issue Jun 17, 2023 · 1 comment
Assignees

Comments

@birme
Copy link
Contributor

birme commented Jun 17, 2023

I am looking at these lines of codes:

              let audioGroupItems = m3u.items.MediaItem.filter((item) => {
                return item.attributes.attributes.type === "AUDIO" && item.attributes.attributes["group-id"] === audioGroupId;
              });
              // # Find all langs amongst the mediaItems that have this group id.
              // # It extracts each mediaItems language attribute value.
              // # ALSO initialize in this.audioSegments a lang. property whos value is an array [{seg1}, {seg2}, ...].
              let audioLanguages = audioGroupItems.map((item) => {
                let itemLang;
                if (!item.attributes.attributes["language"]) {
                  itemLang = item.attributes.attributes["name"];
                } else {
                  itemLang = item.attributes.attributes["language"];
                }
                // Initialize lang. in new group.
                if (!this.audioSegments[audioGroupId][itemLang]) {
                  this.audioSegments[audioGroupId][itemLang] = [];
                }
                return (item = itemLang);
              });

and I am wondering what the return (item = itemLang) is intending to do where item is an M3UItem and itemLang is a string/key?

@Nfrederiksen
Copy link

I am not sure i remember why it is like that/the intention here.

But audioLanguages is a list of strings, so having the return value in the map fn be itemLang should indeed suffice.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants