ultraabox / ultrabox_typescript

ultrabox source code
MIT License
34 stars 25 forks source link

Can't use | in the song title #60

Open leovoel opened 1 year ago

leovoel commented 1 year ago

Because of the custom sample URL loading code. As far as I know (could be wrong) the song title is the only part where other | characters can occur, so it would probably make sense to do the custom sample URL loading after reading the title. At that point a simple .split(...) should be fine to do, on the slice of the compressed string after the title.

One might wonder whether it would make sense to move the custom sample URL loading code after the song tag code switch, but cases in that switch might depend on Config values. If that's the case then it may not be possible to run that so late.

leovoel commented 1 year ago

Okay I was wrong and forgot about channel names, which can also have arbitrary (so |) characters in there.

I'm thinking it might make sense then to do a "skeleton parse" of tag codes, essentially a duplicate of the giant switch, but with only enough code that we can figure out where do the sample | separators start. Then we rewind charIndex and split the string into two and give the first half to the giant switch.

This feels like it's a bit too much duplicate work though, so it would make sense to first review whether it's safe to move the custom sample code after the giant switch instead. If we can do that, that's way simpler.

We could also move the custom sample code to use an actual tag code (re-using a deprecated one?), which might be a much better and less hacky idea than simply splitting the entire string freely (though there's the question of whether to bump the URL version for that change. It's getting bumped to 3 now, but this issue will probably remain for a little longer than that). On the other hand, it is kind of convenient right now to edit URLs with custom samples manually given the current setup.