bherrmann7/Car-Cast — pull request #99 by smblott-github (2013-11-03 12:10:26+00:00)
Title: Better ordering of priority podcasts.

Hi Bob,

Thanks for taking yesterday's PR.

Here's some better code for inserting new priority podcasts when the currently-playing file is in `podcast-order.txt`. I hope you'll consider it. Basically, it ensures that multiple podcasts from a single priority subscription remain in the order in which they otherwise would have been.

Say we have: `CP, P1, P2, N1` in `podcast-order.txt` (the first being the Current podcast, the next two from a Priority subscription, and the fourth a Non-priority podcast.

Now, we download two new podcasts, `P3` and `P4` from the same subscription. And let's say that this is order that the user has selected via "Newest first" on the subscription page. So this is the order the user wants.

With the code I submitted yesterday, we end up with `CP, P4, P3, P1, P2, N1`. Why? because, in effect, podcasts are added individually. A new `MetaHolder` is created after each podcast is downloaded.

This PR fixes the order to `CP, P1, P2, P3, P4, N1`, which I think is more intuitive:

- after the current podcast, we get the priority podcasts in the same order as they otherwise would have been, followed by any remaining podcasts.

And, podcasts from a single subscription always end up in the correct order, whether they're in `podcast-order.txt` or not.

Thanks,
Steve