Zibbp / ganymede

Twitch VOD and Live Stream archiving platform. Includes a rendered and real-time chat for each archive.

Home Page:https://github.com/Zibbp/ganymede

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A list of 0 first party or third party emotes prevents the other list to load anyway

Entrivax opened this issue · comments

Having an empty array of thirdParty or firstParty embed emotes causes to not load the other list.
For example, I have a chat dump containing a list of 0 elements in the third party emotes, preventing the first party ones to not load either.
In my case, I try to convert a chat dump from YouTube to fit the current chat format used by Ganymede, without support of third party emotes. So it falls in the default case and not loading the embedded emotes.

case len(chatData.Emotes.FirstParty) > 0 && len(chatData.Emotes.ThirdParty) > 0:
log.Debug().Msgf("VOD %s chat playback embedded emotes found in 'emotes'", vodID)
for _, emote := range chatData.Emotes.FirstParty {
var ganymedeEmote chat.GanymedeEmote
ganymedeEmote.Name = fmt.Sprint(emote.Name)
ganymedeEmote.ID = emote.ID
ganymedeEmote.URL = emote.Data
ganymedeEmote.Type = "embed"
ganymedeEmote.Width = emote.Width
ganymedeEmote.Height = emote.Height
ganymedeEmotes.Emotes = append(ganymedeEmotes.Emotes, ganymedeEmote)
}
// Loop through third party emotes
for _, emote := range chatData.Emotes.ThirdParty {
var ganymedeEmote chat.GanymedeEmote
ganymedeEmote.Name = fmt.Sprint(emote.Name)
ganymedeEmote.ID = emote.ID
ganymedeEmote.URL = emote.Data
ganymedeEmote.Type = "embed"
ganymedeEmote.Width = emote.Width
ganymedeEmote.Height = emote.Height
ganymedeEmotes.Emotes = append(ganymedeEmotes.Emotes, ganymedeEmote)
}
case len(chatData.EmbeddedData.FirstParty) > 0 && len(chatData.EmbeddedData.ThirdParty) > 0:
log.Debug().Msgf("VOD %s chat playback embedded emotes found in 'emebeddedData'", vodID)
for _, emote := range chatData.EmbeddedData.FirstParty {
var ganymedeEmote chat.GanymedeEmote
ganymedeEmote.Name = fmt.Sprint(emote.Name)
ganymedeEmote.ID = emote.ID
ganymedeEmote.URL = emote.Data
ganymedeEmote.Type = "embed"
ganymedeEmote.Width = emote.Width
ganymedeEmote.Height = emote.Height
ganymedeEmotes.Emotes = append(ganymedeEmotes.Emotes, ganymedeEmote)
}
// Loop through third party emotes
for _, emote := range chatData.EmbeddedData.ThirdParty {
var ganymedeEmote chat.GanymedeEmote
ganymedeEmote.Name = fmt.Sprint(emote.Name)
ganymedeEmote.ID = emote.ID
ganymedeEmote.URL = emote.Data
ganymedeEmote.Type = "embed"
ganymedeEmote.Width = emote.Width
ganymedeEmote.Height = emote.Height
ganymedeEmotes.Emotes = append(ganymedeEmotes.Emotes, ganymedeEmote)
}

image

image

My current workaround for this is to add one fake emote in the thirdParty array like this:

"thirdParty":[{"id":"NOEMOTE","imageScale":1,"data":"","name":"NOEMOTE","url":null,"width":0,"height":0}]