TV_SORT(1)

πŸ“¦ version 1.4.0, in alpine 3.24

πŸ’– NAME πŸ’–

okay so bestie, this is tv_sort β€” the lil tool that sorts your XMLTV listings files by date and adds in the stop times for you ✨ (it's a user-contributed Perl thing, so you know it's got range πŸ’…)

✨ SYNOPSIS ✨

tv_sort [--help] [--by-channel] [--output FILE] [FILE...]

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the vibe: it reads XMLTV data and writes out that exact same data, just sorted in date order. That's it, that's the whole main character energy πŸ‘‘

And where the stop times of programmes are missing? It literally guesses them from the start time of the next programme on the same channel 🌸. But bestie, hear me β€” for the last programme of a channel, no stop time can be added. None. Nada. Not possible 😭

tv_sort also does some sanity checks while it's in there, like making sure no two programmes on the same channel overlap. Very "vibe check the timeline" of it, no cap πŸ’€

  • --output FILE β€” writes to FILE instead of standard output πŸ“
  • --by-channel β€” sorts first by channel id, then by date within each channel πŸŽ€
  • --duplicate-error β€” if the input contains the same programme more than once, this considers that an error πŸ”₯. The default is to silently ignore duplicate entries (much more chill of it, ngl)
  • --help β€” you know what this does, queen 🫢

The time sorting goes by start time, then by stop time. Without --by-channel, if start times and stop times are equal then two programmes get sorted by internal channel id. With --by-channel, channel id gets compared first and then the times. Order of operations, iconic πŸ’œ

You can think of tv_sort as converting XMLTV data into a canonical form β€” which is lowkey so useful for diffing two files πŸ‘‘

🌈 EXAMPLES 🌈

At a typical Unix shell or Windows command prompt:

tv_sort <in.xml >out.xml
tv_sort in.xml --output out.xml

These are literally different ways of saying the same thing, iykyk πŸ’…

🌸 AUTHOR 🌸

Ed Avis, ed@membled.com β€” give her a follow, she ate πŸ’–


and that's the whole page bestie, ty for coming to my TED talk 🧚 this one's perl v5.42.2, dated 2025-06-30, so go forth and sort those listings πŸŒŸπŸ’–

πŸ“¦ where this page comes from