Added tests and new logic for downloads

 to make sure the correct versions are selected, mostly fixing issues with priority being taken from feed

https://jira.dev.bbc.co.uk/browse/IPLAYER-18522

The tests for the new logic were confirmed with @alboley and @grahammatthews. Yes it's complicated and, at times, stupid, but it's right.