XMLTV - Script EPG Multi-Source (1 Viewer)

azzuro

Test Group
  • Team MediaPortal
  • May 10, 2007
    9,366
    4,994
    France - IDF
    France France
    Country flag
    • Thread starter
    • Moderator
    • #1
    Hello,

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

    Download_EPG.bat
    Code:
    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%"
    tvguide.lst
    Code:
    EPG1.xml
    EPG2.xml
    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.
     

    Attachments

    Last edited:

    LoDeNo

    Portal Pro
    February 19, 2009
    324
    66
    France France
    Country flag
    C'est là dedans qu'on met l'URL, à la place du http:// ?
    REM URL from the source package
    SET Zip_WebSource1="http://"
     

    azzuro

    Test Group
  • Team MediaPortal
  • May 10, 2007
    9,366
    4,994
    France - IDF
    France France
    Country flag
    • Thread starter
    • Moderator
    • #10
    For information
    the source path correspond at the directory where all files are saved from script
     

    Users Who Are Viewing This Thread (Users: 0, Guests: 1)

    OP Similar threads Forum Replies Date
    framug No color in TVGuide when XMLTV without DVB EPG MediaPortal 1 Talk 59
    B xmltv - cannot import tvguide.xml australia Installation, configuration support 0
    geotwticher TV Guide EPG Grabber for Australia 2020 RIP freepg.tv General 4
    P Timeshifting in XMLTV General 2
    C Can the XmlTv Plugin handle 600+ channels? General 3
    JJDoherty 1.22.0 XMLTV not raising the following OnImportEpgPrograms event... 1.22 0
    lacanox XMLTV not writing the tv schedule Electronic Program Guide 3
    A [solved] XmlTv not importing programs General 8
    dcapslock TV Server xmltv IWakeupHandler Bug Television (MyTV frontend and TV-Server) 6
    T No data available using xmltv and mc2xml xmlTV 2
    W XMLTVImport duplicate item error xmlTV 5
    J Schedules Direct - XmlTV Plugin xmlTV 6
    joEhSuper Issues with FilmInfo+ scraper script during import Moving Pictures 5
    M [solved] IMDB script broken again General Support 67
    Rob Hexenmeister Detect recording in progress from external script (AHK) General Support 8
    M EPG color by length of TV-show MediaPortal 1 Talk 1
    D Downloading EPG XML file: Installation, configuration support 0
    D EPG No Data General Support 2
    D [solved] EPG Data off by -20 hours? General 10
    G Q about scheduling weekly series when epg lists duplicate back to back episodes each week General Support 2
    F Mini EPG more information? WMC Skin 4
    N No TV or EPG on fresh install General 0
    T Freesat EPG in UK anyone? Electronic Program Guide 78
    Dark Eyes TVService locks up or fails to restart on resuming from sleep, and crashes when grabbing EPG Installation, configuration support 7
    G Movie release date in guide Electronic Program Guide 2
    Top Bottom