Posts Tagged ‘sort’

Quickly Sort Channels

Wednesday, February 11th, 2009

Something that’s not quite perfect in MythTV is sorting channels. You can move channels around one by one in the backend setup screens but this is slow and boring. A quicker way is to update the channel table in the mythconverg database on your backed. I had a search around and found this useful post on the Ubuntu forms but it was still a pain to have to adjust the SQL strings as they were.  My solution is to put the SQL into to a spreadsheet (attached below):

Channel Order Helper Spreadsheet

Obviously your channel listing is going do be different to mine so I suggest you do the following:

  1. Download the spreadsheet
  2. Get your existing channel names by running:
    SELECT DISTINCT name FROM channel ORDER BY LPAD(channum, 3, 0) ASC;
  3. Paste them into column D in the spread sheet
  4. Re-arrange as required
  5. Select all the cells and copy into gedit or similar (removing any tabs)
  6. Run all statements agains your mythconverg database.

NB. This will update the channel numbers for all sources (you could always change the sql to include a “WHERE sourceid = 1″ clause or simialr. Also, make sure that your frontend is set to sort by “Channel Number” in “Utilities/Setup” -> “Setup” -> “TV” -> “Settings” -> “General”