bvanheu / pytoutv

TOU.TV client library and user interfaces written in Python 3
96 stars 23 forks source link

Improved sorting of episodes in CLI #68

Closed bmaupin closed 8 years ago

bmaupin commented 8 years ago

Before:

$ toutv list Peanuts
Peanuts:

  * 2425161054 - S2015E21 - Danse de la joie
  * 2425163123 - S2015E33 - Vol au-dessus d'une niche de couscous
  * 2425163602 - S2016E1045 - Ha, l'école!
  * 2425163603 - S2016E1046 - C'est du propre
  * 2425163868 - S2016E1047 - Frère et sœur
  * 2425163869 - S2016E1048 - Marcie
  * 2425163351 - S2016E178 - Tenir sa position
  * 2425163362 - S2016E25 - Un amour brisé

After:

$ toutv list Peanuts
Peanuts:

  * 2425161054 - S2015E21 - Danse de la joie
  * 2425163123 - S2015E33 - Vol au-dessus d'une niche de couscous
  * 2425163362 - S2016E25 - Un amour brisé
  * 2425163351 - S2016E178 - Tenir sa position
  * 2425163602 - S2016E1045 - Ha, l'école!
  * 2425163603 - S2016E1046 - C'est du propre
  * 2425163868 - S2016E1047 - Frère et sœur
  * 2425163869 - S2016E1048 - Marcie
simark commented 8 years ago

Could we also sort by date? It has the advantage that it's unambiguous, and logical.

bmaupin commented 8 years ago

If we sort by date, should we then list the date instead of season/episode? Essentially I think it would be best to sort by a property that's displayed. If we sort by something that isn't displayed (like date), there's always a chance it could look out of order.

As a test, I changed the sort:

def key_func(key):
    return episodes[key].get_air_date()

Added the air date:

print('  * {} - {} - {} ({})'.format(ekey, sae, title, episode.get_air_date()))

And this was the result:

$ toutv list Peanuts
Peanuts:

  * 2425163362 - S2016E25 - Un amour brisé (2016-01-15)
  * 2425163869 - S2016E1048 - Marcie (2016-01-31)
  * 2425163123 - S2015E33 - Vol au-dessus d'une niche de couscous (2016-02-05)
  * 2425163351 - S2016E178 - Tenir sa position (2016-02-05)
  * 2425163603 - S2016E1046 - C'est du propre (2016-02-05)
  * 2425163868 - S2016E1047 - Frère et sœur (2016-02-05)
  * 2425163602 - S2016E1045 - Ha, l'école! (2016-02-05)
  * 2425161054 - S2015E21 - Danse de la joie (2016-02-05)

So it appears they aren't even aired in order.

An alternative would be to sort by episode Id, although that's pretty meaningless to the user imo.

simark commented 8 years ago

I guess that for some shows, the air date is not very relevant, like some shows that are imported and never aired on TV here, or webseries. There, the dates might be a bit arbitrary.

Then, it makes sense to continue sorting by episode number. I think that displaying the date is a plus though (we can do that in a separate patch). Another enhancement would be to rethink in which order the fields appear on each line. For example, the episode id appears first on the line, even though it's not very significant for humans.

simark commented 8 years ago

Thanks for the patch!