Reply to thread

Hello,


i do, today an small script based on msdos for download EPG data from internet.


Download_EPG.bat

[code=dos]

REM Multi source Grabbing EPG V3 - from MediaPortal Software.


REM location

SET source_path=C:\ProgramData\Team MediaPortal\MediaPortal TV Server\xmltv

SET xmltv_path=C:\ProgramData\Team MediaPortal\MediaPortal TV Server\xmltv

SET Wget=".\tools\wgetwin\wget.exe"

SET Zip_tool=".\tools\unzip\unzip.exe"

SET log_path=%source_path%\log


REM location of the EPG file

SET EPG1_path=EPG1

SET EPG2_path=EPG2


REM EPG1 source and filename

REM URL from the source package

SET Zip_WebSource1="http://"

REM filename saved on your disk

SET file_name_in_zip1=EPG1.zip

REM Filename of the file present in the zip

SET file_name_in_xml1=complet.xml

REM filename output wanted

SET file_name_ou_xml1=EPG1.xml


REM EPG2 source and filename

SET Zip_WebSource2="http://"

SET file_name_in_zip2=EPG2.zip

SET file_name_in_xml2=tvguide.xml

SET file_name_ou_xml2=EPG2.xml


REM Log setting

SET Log_name=Grabbing_%Date:~-4% %Date:~-7,-5% %Date:~-10,-8%_%Time:~-11,-9% %Time:~-8,-6% %Time:~-5,-3%.log

SET Keep_file=2


cd "%source_path%"

REM Keep the last log files set to "Keep_file"


for /f "skip=%Keep_file% eol=: delims=" %%F in ('dir /b /a-d /o-d *.log') do del "%%F"


Echo EPG grabbing Version 2 '28/07/2015' >> "%Log_name%"

Echo Grabbing EPG Started - %Date:~-4%/%Date:~-7,-5%/%Date:~-10,-8% %Time:~-11,-9%:%Time:~-8,-6%:%Time:~-5,-3% >> "%Log_name%"

Echo. >> "%Log_name%"

Echo __________________________________________________________________ >> "%Log_name%"


REM : Create folder for download the EPG, WGet contain bug because don't create the folder.

mkdir %EPG1_path% >> "%Log_name%"

mkdir %EPG2_path% >> "%Log_name%"


Echo. >> "%Log_name%"

Echo download EPG Source file >> "%Log_name%"

Echo. >> "%Log_name%"


%Wget% -x -O "%source_path%/%EPG1_path%/%file_name_in_zip1%" -a "%source_path%/%Log_name%" %Zip_WebSource1%

%Wget% -x -O "%source_path%/%EPG2_path%/%file_name_in_zip2%" -a "%source_path%/%Log_name%" %Zip_WebSource2%


REM Unzip the XML EPG, if zipped

%Zip_tool% -o "%source_path%\%EPG1_path%\%file_name_in_zip1%" -d "%source_path%\%EPG1_path%" >> "%Log_name%"

%Zip_tool% -o "%source_path%\%EPG2_path%\%file_name_in_zip2%" -d "%source_path%\%EPG2_path%" >> "%Log_name%"


REM Delete previous EPG XML file available inside the dedicated EPG folder, and rename the new one.

del "%source_path%\%EPG1_path%\%file_name_ou_xml1%" >> "%Log_name%"

rename "%source_path%\%EPG1_path%\%file_name_in_xml1%" "%file_name_ou_xml1%" >> "%Log_name%"


REM Delete previous EPG XML file available inside the dedicated EPG folder, and rename the new one.

del "%source_path%\%EPG2_path%\%file_name_ou_xml2%" >> "%Log_name%"

rename "%source_path%\%EPG2_path%\%file_name_in_xml2%" "%file_name_ou_xml2%" >> "%Log_name%"


REM copy the both XML EPG to the XMLTV path

Echo. >> "%Log_name%"

copy /Y "%source_path%\%EPG1_path%\%file_name_ou_xml1%" "%xmltv_path%\%file_name_ou_xml1%" >> "%Log_name%"

copy /Y "%source_path%\%EPG2_path%\%file_name_ou_xml2%" "%xmltv_path%\%file_name_ou_xml2%" >> "%Log_name%"


Echo. >> "%Log_name%"

Echo Grabbing Finished - %Date:~-4%/%Date:~-7,-5%/%Date:~-10,-8% %Time:~-11,-9%:%Time:~-8,-6%:%Time:~-5,-3% >> "%Log_name%"

[/code]


tvguide.lst

[code]EPG1.xml

EPG2.xml[/code]


V3: 13/01/2016

solve few error in path.


V2 - 28/07/2015

- modified the unzip program FBzip > unzip Msdos '"PKUnzip"

- EPG are stored in their own folder.

- add Log file, with the last 3 files available.


Top Bottom