[mythtv] Lineup identifiers in GBR are changing on 2017-12-15

Paul Gardiner lists at glidos.net
Sat Dec 16 19:40:59 UTC 2017


On 16/12/2017 17:59, Paul Harrison wrote:
> Just got this from Schedules Direct.
> 
>      Due to lineup naming changes at our upstream, your lineup
>      GBR-0003012-DEFAULT has been deleted.
> 
>      Please use your application to select a lineup which is appropriate;
>      there are many new regional options, such as Freeview, YouView,
>      Freesat and Sky.
> 
>      for more information.
> http://forums.schedulesdirect.org/viewtopic.php?f=15&t=2966
> 
>      Thanks,
>          Schedules Direct
> 
> 
> 
> They could have chosen a better time of year to do this :(
> 
> Anyone any tips on the best way to update the lineup when using the tv_grab_zz_sdjson_sqlite grabber without having to redo everything?

I have these three little scripts that may help: one creates a display 
in html format of the channel info, another downloads the icons, and the 
last creates sql for updating the channel table.

Hope this list allows the attachments through.

Cheers,
	Paul.
-------------- next part --------------
#!/usr/bin/ruby -w

require 'nokogiri'
require 'uri'
require 'net/http'

tv = Nokogiri::XML(File.open("/var/lib/mythtv/sd.xml"))
tv.xpath('//channel').sort{|c1,c2|c1.xpath('display-name')[0].text <=> c2.xpath('display-name')[0].text}.each do |ch|
    icon = ch.xpath('icon')
    if icon.count > 0 then
        uri = URI(icon[0]['src'])
        filename = uri.path.split('/').last
        icon = Net::HTTP.get(uri)
        File.open(File.join('icons',filename), "w") {|file| file.write(icon)}
    end
end
-------------- next part --------------
#!/usr/bin/ruby -w

require 'nokogiri'

mapping =
    {
    '4MUSIC' => [18,['4Music'],'4Music'],
    '4SEVEN' => [47,['4seven'],'4seven'],
    '4SEVENH' => [110,['4seven HD'],'4seven HD'],
    '5ST' => [30,['5STAR'],'5*'],
    '5USA' => [21,['5 USA'],'5USA'],
    'BBC4' => [9,['BBC FOUR'],'BBC4'],
    'BBC4HD' => [106,['BBC FOUR HD'],'BBC4 HD'],
    'BBCNEWS' => [130,['BBC_NEWS'],'BBC NEWS'],
    'BBCNWHD' => [107,['BBC NEWS HD'],'BBC NEWS HD'],
    'BBC1SE' => [1,['BBC ONE Oxford','BBC One Oxford'],'BBC1'],
    'BBC1HD' => [101,['BBC ONE HD','BBC One HD'],'BBC1 HD'],
    'BBCR1' => [700,['BBC Radio 1'],'BBC R1'],
    'BBCR1X' => [701,['BBC R1X'],'BBC R1X'],
    'BBCR2' => [702,['BBC Radio 2'],'BBC R2'],
    'BBCR3' => [703,['BBC Radio 3'],'BBC R3'],
    'BBCR4EX' => [708,['BBC Radio 4 Ex'],'BBC R4X'],
    'BBCR5L' => [705,['BBC R5L'],'BBC R5L'],
    'BBCRDB1' => [601,['BBC RB 1'],'BBC RB1'],
    'BBC2' => [2,['BBC Two Eng','BBC TWO'],'BBC2'],
    'BBC2HD' => [102,['BBC TWO HD'],'BBC2 HD'],
    'CBBC' => [120,['CBBC'],'CBBC'],
    'CBBCHD' => [123,['CBBC HD'],'CBBC HD'],
    'CBEEB' => [121,['CBeebies'],'CBeebies'],
    'CBEEBHD' => [124,['CBeebies HD'],'CBeebies HD'],
    'CAPRAD' => [724,['Capital FM'],'Capital FM'],
    'C4' => [4,['Channel 4'],'C4'],
    'C4HD' => [104,['Channel 4 HD'],'C4 HD'],
    'CH5' => [5,['Channel 5'],'FIVE'],
    'CH5HD' => [105,['Channel 5 HD','Channel 5HD'],'FIVE HD'],
    'CHITV' => [122,['CITV'],'CITV'],
    'CLASSFM' => [731,['Classic FM'],'Classic FM'],
    'DAVE' => [12,['Dave'],'Dave'],
    'DAVEJV' => [84,['Dave ja vu'],'Dave ja vu'],
    'DRAMAUK' => [20,['Drama'],'Drama'],
    'E4' => [28,['E4'],'E4'],
    'FILM4UK' => [15,['Film4'],'Film4'],
    'HEART' => [728,['Heart'],'Heart'],
    'ITV1HDL' => [103,['ITV HD','ITV1 HD'],'ITV1 HD'],
    'ITV1STH' => [3,['ITV'],'ITV1'],
    'ITV2' => [6,['ITV2'],'ITV2'],
    'ITVTHREE' => [10,['ITV3'],'ITV3'],
    'ITV4' => [24,['ITV4'],'ITV4'],
    'KISS' => [713,['Kiss'],'Kiss'],
    'MAGICFM' => [715,['Magic'],'Magic'],
    'MORE4' => [14,['More 4','More4'],'More4'],
    'PICKTV' => [11,['Pick'],'Pick'],
    'POP' => [125,['POP'],'Pop'],
    'SKYNEWS' => [132,['Sky News'],'Sky News'],
    'SPIKEUK' => [31,['Spike'],'Spike'],
    'HITSRAD' => [711,['The Hits Radio'],'Hits'],
    'TINYPOP' => [126,['Tiny Pop'],'Tiny Pop'],
    'VIVAE' => [57,['VIVA'],'VIVA'],
    'YESTERDAY' => [19,['YESTERDAY'],'YESTERDAY']
}


chanstate={}
File.open("/var/lib/mythtv/.xmltv/tv_grab_sd_json.conf").each do |line|
    case line
    when /^channel=(.*)$/
        chanstate[$1] = true
    when /^channel!(.*)$/
        chanstate[$1] = false
    end
end

tv = Nokogiri::XML(File.open("/var/lib/mythtv/sd.xml"))

puts "UPDATE channel SET channum=2000 WHERE channum='unknown nu';"
puts "UPDATE channel SET channum=channum+1000;"
puts "UPDATE channel SET visible=0;"

tv.xpath('//channel').sort{|c1,c2|c1.xpath('display-name')[0].text <=> c2.xpath('display-name')[0].text}.each do |ch|
    dn = ch.xpath('display-name')
    key = dn[1].text
    id = ch['id']
    info = mapping[key]
    if !info.nil? then
        lcn = info[0]
        callsign = info[2]
        info[1].each do |name|
            puts "UPDATE channel SET channum=#{lcn},callsign='#{callsign}',xmltvid='#{id}',icon='s#{id}_h3_aa.png',visible=1 WHERE name='#{name}';"
        end
    end
end
-------------- next part --------------
#!/usr/bin/ruby -w

require 'nokogiri'

chanstate={}
File.open("/var/lib/mythtv/.xmltv/tv_grab_sd_json.conf").each do |line|
    case line
    when /^channel=(.*)$/
        chanstate[$1] = true
    when /^channel!(.*)$/
        chanstate[$1] = false
    end
end

tv = Nokogiri::XML(File.open("/var/lib/mythtv/sd.xml"))
puts '<html>'
puts '<head><link rel="stylesheet" href="sdpick.css" type="text/css"></head>'
puts '<body>'
puts '<table>'
tv.xpath('//channel').sort{|c1,c2|c1.xpath('display-name')[0].text <=> c2.xpath('display-name')[0].text}.each do |ch|
    puts '<tr>'
    puts '<td class="icon">'
    icon = ch.xpath('icon')
    if icon.count > 0 then
        puts "<img style='max-height:30px' src='#{icon[0]['src']}'/>"
    end
    dn = ch.xpath('display-name')
    puts "<td>#{dn[1].text}<td>#{dn[0].text}<td>#{ch['id']}"
    puts "<td>#{chanstate[ch['id']]?'present':''}"
end
puts '</table>'
puts '</body>'
puts '</html>'
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sdpick.css
Type: text/css
Size: 181 bytes
Desc: not available
URL: <http://lists.mythtv.org/pipermail/mythtv-dev/attachments/20171216/8ef14a25/attachment.css>


More information about the mythtv-dev mailing list