simon-weber / Autoplaylists-for-Google-Music

Adds autoplaylists, aka iTunes "smart playlists", to Google Music.
https://autoplaylists.simon.codes
MIT License
94 stars 18 forks source link

"playlist title" condition allows cycles #164

Closed simon-weber closed 6 years ago

simon-weber commented 6 years ago

Even self-cycles! For example, creating a playlist titled "foo" and then matching for playlist titles containing "foo".

I'm surprised this isn't built into the existing cycle detection logic. Hopefully it's straightforward to do.

simon-weber commented 6 years ago

I lied, it's not that easy to trigger. I had built a cycle like this:

A: title match B
B: id match A

I can recreate it, but I haven't really figured out what's going on yet.

simon-weber commented 6 years ago

I moved cycle detection into getLinkedTracks, but the important part was initializing the cache to the empty set upon first seeing a playlist: that way, if we see it again, we terminate the cycle. I'm not really sure why the previous code worked without this (maybe it didn't?).