That isn't very complex, but things get complicated when a music feed contains tracks that have an "episode number", and tracks that do not have an "episode number". Where do the non-numbered tracks go in the auto play order?
To handle this, I (::cough:: llm) wrote the query to handle all tracks in a music feed that do not have an episode number as if it had a season of -1, and to sort those by pub_date, while the sort for properly numbered tracks get handled as normal.
https://github.com/podverse/podverse-orm/commit/3470108ab6c81de9dac9a1f0a7c9fd6bbc810ffa#diff-c3343c792900d109ee2695d00313b8b2e68844b2d088a3271b7527b4c88d459eR384