Announcement

Collapse
No announcement yet.

Update of HSTV.exe to overcome xmltv file problem?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Update of HSTV.exe to overcome xmltv file problem?

    Hi,

    Although it is physically not possible to have 2 TV programs started at identical times for a single station, the xmltv files I download in the Netherlands, contain sometimes such records.
    The hstv.exe program cannot handle such and aborts complaining that it can not store records with identical (index)keys. Which is correct: in the access database (in the temp table) I found one record too many.

    Also I found that one of these double records (the one that is too many, which should be ignored) have identical start and endtimes. When those records are deleted or ignored in the Access database everything seems to be working correctly!

    I was wondering if someone (CFGuy?) could update HSTV.exe so it will ignore (during the import fase, not the download!) records which have identical start and stoptimes?

    Thanks,
    Henk

    #2
    Could you send me one of the xml files that has a duplicate entry like that?
    There is some code already that looks for duplicate info based on time and channel name, so I need to see what is different about this case.
    --
    Jeff Farmer
    HS 3, HSPhone
    My HS3 Plugins: CFHSExtras, Random, Restart, Tracker, WeatherXML, PanaBluRay
    Other Plugins In Use: APCUPSD, BLOnkyo, Device History, EasyTrigger, HSTouch Server, PHLocation2, Pushover, RFXCom, UltraGCIR3, UltraMon3, UltraPioneerAVR3, X10, Z-Wave

    Hardware: GoControl Irrigation Controler, Schlage Lever Lock, Schlage Deadbolt, Way2Call Hi-Phone, RFXCom RFXrec433 Receiver, WGL 800, TI-103, Z-Net, Pioneer 1120, Pioneer 1021, Pioneer LX302, Panasonic BDT-110, Panasonic BDT-210 x2

    Comment


      #3
      NGC duplicate key

      The NGC channel in the attached file produces a duplicate key problem with HSTV version 2.8.2

      The duplicate receords are:
      - <programme start="20051102060000 +0100" stop="20051102070000 +0100" channel="18.tvgids.nl" clumpidx="0/2">
      <title lang="nl">CNBC</title>
      <url>http://www.tvgids.nl/programmadetail/?ID=4645067</url>
      </programme>
      - <programme start="20051102060000 +0100" stop="20051102070000 +0100" channel="18.tvgids.nl" clumpidx="1/2">
      <title lang="nl">Today's business</title>
      <url>http://www.tvgids.nl/programmadetail/?ID=4645068</url>
      </programme>

      - <programme start="20051102120000 +0100" stop="20051102123000 +0100" channel="18.tvgids.nl" clumpidx="0/2">
      <title lang="nl">National Geographic Channel</title>
      <url>http://www.tvgids.nl/programmadetail/?ID=4645071</url>
      </programme>
      - <programme start="20051102120000 +0100" stop="20051102123000 +0100" channel="18.tvgids.nl" clumpidx="1/2">
      <title lang="nl">Storm stories: Without warning</title>
      <url>http://www.tvgids.nl/programmadetail/?ID=4645072</url>
      </programme>

      - <programme start="20051102220000 +0100" stop="20051102230000 +0100" channel="18.tvgids.nl" clumpidx="0/2">
      <title lang="nl">Knowhow Wednesday</title>
      <url>http://www.tvgids.nl/programmadetail/?ID=4645085</url>
      </programme>
      - <programme start="20051102220000 +0100" stop="20051102230000 +0100" channel="18.tvgids.nl" clumpidx="1/2">
      <title lang="nl">Megacities: Paris</title>
      <url>http://www.tvgids.nl/programmadetail/?ID=4645086</url>
      </programme>




      Thanks, Bert
      Attached Files
      Last edited by b_weijenberg; November 2, 2005, 07:38 AM.

      Comment


        #4
        remove dupl keys from xml file

        The attached file contains a program to remove the duplicate records from the imported NL xml file.

        Bert

        source:

        Imports System
        Imports System.IO
        Imports System.Text
        Imports VB = Microsoft.VisualBasic


        'This program removes double entries from the hstv xml file of today and optional
        'from the next day(s).
        'Command format: HSTVclean [<number of days>]
        ' Optional: <number of days> is a digit from 1 to 7
        ' default = 1

        Module Module1

        Sub Main()
        Dim tempfile As String = "C:\Program Files\HomeSeer 2\data\hstv\listings\temp.txt"
        Dim infile, curfile, regel As String
        Dim i As Integer
        Dim vandaag As System.DateTime
        Dim dagi As System.DateTime

        For Each s As String In My.Application.CommandLineArgs
        If IsNumeric(s) Then
        i = s
        Else
        i = 0
        End If
        Next

        If i > 7 Then
        i = 7
        End If

        If i > 0 Then
        i -= 1
        End If

        vandaag = System.DateTime.Now

        For i = 0 To i
        dagi = vandaag.AddDays(i)
        curfile = "tv_grab_nl" & Trim(Str(Year(dagi))) & VB.Right("0" & Trim(Str(Month(dagi))), 2) & VB.Right("0" & Trim(Str(Day(dagi))), 2) & ".xml"
        infile = "C:\Program Files\HomeSeer 2\data\hstv\listings\" & curfile

        If File.Exists(infile) Then
        Dim st_i As StreamReader = New StreamReader(infile)

        ' Delete temp output file if it exists.
        If File.Exists(tempfile) Then
        File.Delete(tempfile)
        End If

        Dim st_o As StreamWriter = New StreamWriter(tempfile)
        While st_i.Peek <> -1
        regel = st_i.ReadLine
        st_o.WriteLine(regel)
        If InStr(regel, "clumpidx=", CompareMethod.Text) <> 0 Then
        regel = st_i.ReadLine
        st_o.WriteLine(regel)
        regel = st_i.ReadLine
        st_o.WriteLine(regel)
        regel = st_i.ReadLine
        st_o.WriteLine(regel)
        regel = st_i.ReadLine
        Do While InStr(regel, "clumpidx=", CompareMethod.Text) <> 0
        regel = st_i.ReadLine
        regel = st_i.ReadLine
        regel = st_i.ReadLine
        regel = st_i.ReadLine
        Loop
        st_o.WriteLine(regel)
        End If
        End While
        st_i.Close()
        st_o.Close()

        File.Delete(infile)
        My.Computer.FileSystem.RenameFile(tempfile, curfile)
        Else
        MsgBox("File " & infile & " doesn't exist!")
        End If
        Next
        End Sub
        End Module
        Attached Files

        Comment

        Working...
        X