Go.bat Datemath and sed.exe explained
If you are like me and never used these commands before and wanted to know exactly whats going on well I took the time to do the reading and will try to explain it for those that are running their own grabber.
I had a good idea what it was doing but wanted to know how so here it goes.
first open a cmd prompt and enter
echo %Date:~0,14% and hit enter
you will get a output like this
Tues 08/18/2015
so what happened,well you just asked to display your pc date,thats obvious aint it but what u really asked was show me the pc date starting from position 0 and show the next 14 characters.see the ~0,14% from above.position 0 is at the beginning of the line(to the left of the letter T).
now keeping that in mind lets look at the first commands in that section...
set Day=%Date:~7,2% ----->position 7,next 2 characters = 18 which is todays date and we assign that value to the variable Day via set Day =
set Mth=%Date:~4,2% ----->position 4,next 2 characters = 08 which is the month and we assign that value to the variable Mth via set Mth =
set Yr=%Date:~10,4% ----->position 10,next 4 characters = 2015 which is the year and we assign that value to the variable Yr via set Yr =
so...
Day = 18
Mth = 08
Yr = 2015
next command,i am only going to explain the first one as the rest are just a repeat
call datemath %Yr% %Mth% %Day% + 1 ---->datemath calculates a new date.so we asked to calculate a new date starting from %yr% %Mth% %day% which is 2015 08 18(remember we set these variables above) plus 1 day
set Day1=%_ymd_str% ----> sets the variable Day1 to our newly cacluated date which would be 20150819
the next 2 commads are exactly same but for day2 and day3
so after they are all done we have...
day1 = 20150819
day2 = 20150820
day3 = 20150821
next we make 3 copies of our original dummy file(one for each day we want) and name them dummy1.txt,dummy2.txt,dummy3.txt
finally we want to modify the dates in each of those files for each day of epg
again I will expain the first one as the rest are the same.
sed.exe is nothing more that a editor that we can use to remove,replace,edit text
sed.exe -e "s/20150513213/%Yr%%Mth%%Day%070/g" dummy1.txt > dummy1_1.txt
-e means expression to follow,s means substitute(replace).we want to replace 20150513213(if you look in the dummy.body file you will find this start date) with %Yr%%Mth%%Day%(which we assigned above to be 20150818,todays date.070 sets the time to 0700.g means global which replaces all the starts dates in all our dummy channels in the file named dummy1.txt and outputs the new file as dummy1_1.txt.
sed.exe -e "s/2016051322/%Day1%07/g" dummy1_1.txt > dummy1_conv.txt
this does the exact same thing as above but reads the file Dummy1_1.txt which we created when we replaced the start date but changes the end dates(2016051322,if you look in the dummy.body file you will find this end date) instead of the starting date.the file is outputed as dummy1_conv.txt
so when that's all finished we have
dummy1_conv.txt ---->start date 20150818070000 end date 20150819070000
dummy2_conv.txt ---->start date 20150819070000 end date 20150820070000
dummy3_conv.txt ---->start date 20150820070000 end date 20150821070000
finally we combine all 3 files into one file called dummy_conv.txt
copy /b dummy1_conv.txt + dummy2_conv.txt + dummy3_conv.txt dummy_conv.txt
that's it,now we have 3 days of out dummy channels with correct dates that we add into our epg file.