- September 3, 2012
- 238
- 26
- 27
- Home Country
-
United States of America
- Thread starter
- #11
It's kind of working for me. This is what my batch file looks like:
cscript //NoLogo getcat.vbs C:\xml\xmltv.xml C:\xml\xmltvmp.xml
The problem is that getcat.vbs wont run unless xmltvmp.xml is present before hand.
This doesn't happen with the 1st version of the script.
Also I tried adding "Kids" and "Children" to the script:
So I can keep those categories:
But it's not working:
[DOUBLEPOST=1389664116][/DOUBLEPOST]EDIT
I guess I added "Kids" to the wrong section. After adding it to:
It's no longer stripping it from the xml file.
cscript //NoLogo getcat.vbs C:\xml\xmltv.xml C:\xml\xmltvmp.xml
The problem is that getcat.vbs wont run unless xmltvmp.xml is present before hand.
This doesn't happen with the 1st version of the script.
Also I tried adding "Kids" and "Children" to the script:
Code:
Const ForReading = 1
Const ForWriting = 2
Const TristateUseDefault = -2, TristateTrue = 1, TristateFalse = 0
' input files from argment, open file for reading
strRdFile = WScript.Arguments.Item(0)
strWrFile = WScript.Arguments.Item(1)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strRdFile, ForReading)
Set objWrFile = objFSO.OpenTextFile(strWrFile, ForWriting)
intCnt = 0
strSavedCat = " <category>None</category>"
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
'**********************
' top half, for lines that are NOT "category"
'**********************
If InStr(strLine, "<category") = 0 Then
'*** check if there is a saved "category", do echo to write to file
'*** reset state until finding the next "category"
If intCnt > 0 Then
objWrFile.Write strSavedCat & vbCrLf
intCnt = 0
strSavedCat = " <category>None</category>"
End If
'*** echo lines from tvguide.xml and write to file
objWrFile.Write strLine & vbCrLf
Else
'**********************
' bottom half, for lines that ARE "category"
'**********************
intCnt = intCnt + 1
'*** save junk category if saved = "None"
If InStr(strLine, "Series") Or InStr(strLine, "General") Or InStr(strLine, "Other")Then
If InStr(strSavedCat, "None") Then
strSavedCat = strLine
End If
'*** ignore Episodic
ElseIf InStr(strLine, "Episodic") Then
'*** always save Movie, overwrite Drama, Action, etc
ElseIf InStr(strLine, "Movie") Then
strSavedCat = strLine
Else
'*** check if saved = "good" catergory, don't overwrite "good", add more ElseIf to add "good"
If InStr(strSavedCat, "Drama") Or InStr(strSavedCat, "Action")Then
ElseIf InStr(strSavedCat, "Current") Or InStr(strSavedCat, "Comedy")Then
ElseIf InStr(strSavedCat, "Movie") Then
ElseIf InStr(strSavedCat, "Football") Or InStr(strSavedCat, "Basketball") Then
ElseIf InStr(strSavedCat, "Soccer") Or InStr(strSavedCat, "Golf")Then
ElseIf InStr(strSavedCat, "Children") Or InStr(strSavedCat, "Kids")Then
Else
'*** saved = new categoruy
strSavedCat = strLine
End If
End If
End If
Loop
objFile.Close
objWrFile.Close
So I can keep those categories:
Code:
<programme start="20140124040000 -0800" stop="20140124043000 -0800" channel="I30.2.190198069.microsoft.com">
<title lang="en">Eliot Kid *</title>
<sub-title lang="en">The Bathroom Monster; Igor</sub-title>
<desc lang="en">Eliot thinks an army of monsters is lurking under the city; Eliot's sister has fallen in love with a guitar player.</desc>
<category lang="en">Action/Adventure</category>
<category lang="en">Adventure</category>
<category lang="en">Children</category>
<category lang="en">Comedy</category>
<category lang="en">Family/Children</category>
<category lang="en">General</category>
<category lang="en">Kids</category>
<category lang="en">Series</category>
<episode-num system="ms_progid">1.293936069</episode-num>
<episode-num system="onscreen">126</episode-num>
<audio>
<stereo>stereo</stereo>
</audio>
<new />
<rating system="VCHIP">
<value>TV-Y7</value>
</rating>
</programme>
But it's not working:
Code:
<programme start="20140124040000 -0800" stop="20140124043000 -0800" channel="I30.2.190198069.microsoft.com">
<title lang="en">Eliot Kid *</title>
<sub-title lang="en">The Bathroom Monster; Igor</sub-title>
<desc lang="en">Eliot thinks an army of monsters is lurking under the city; Eliot's sister has fallen in love with a guitar player.</desc>
<category lang="en">Action/Adventure</category>
<episode-num system="ms_progid">1.293936069</episode-num>
<episode-num system="onscreen">126</episode-num>
<audio>
<stereo>stereo</stereo>
</audio>
<new />
<rating system="VCHIP">
<value>TV-Y7</value>
</rating>
</programme>
I guess I added "Kids" to the wrong section. After adding it to:
Code:
'*** always save Movie, overwrite Drama, Action, etc
ElseIf InStr(strLine, "Movie") Then
ElseIf InStr(strLine, "Kids") Then
strSavedCat = strLine
Else
Last edited: