Skip to content

Scheduling

jesmannstl edited this page Aug 10, 2025 · 3 revisions

Scheduling

Create file for processing

Windows

Create a New text document in your text editor and add the following updating to the directory and lineup for example zap2xml-run.bat

@echo off
cd /d path\to\zap2xml
node dist/index.js --lineupId=YOUR_LINEUP_ID --timespan=15 --country=USA --postalCode=12345

If you wish to use multiple lineups and optionally Merging to one file you can add to the same file (adding 30 second timeout between)

@echo off
node dist/index.js --country=USA --lineupId=USA-DITV501-X --timespan=48 --postalCode=10001 --outputFile=ditvnyc.xml
timeout /t 30 /nobreak
node dist/index.js --country=CAN --lineupId=CAN-0005995-X --timespan=120 --postalCode=E3B3W4 --appendAsterisk --outputFile=shawcan.xml
timeout /t 30 /nobreak
node dist/index.js --country=MEX --lineupId=MEX-OTA09400 --timespan=360 --postalCode=09400 --mediaportal --outputFile=mex09400ota.xml
node path/to/tvmerge/tv_merge.js -i ditvnyc.xml shawcan.xml mex09400ota.xml -o combinedepg.xml

Linux, Raspberry Pi, macOS

Process is similar to windows with minor changes Create a New text document in your text editor and add the following updating to the directory and lineup for example zap2xml-run.sh

#!/bin/bash
@echo off
cd /d path\to\zap2xml
node dist/index.js --lineupId=YOUR_LINEUP_ID --timespan=15 --country=USA --postalCode=12345

If you wish to use multiple lineups and optionally Merging to one file you can add to the same file (adding 30 second timeout between)

#!/bin/bash
@echo off
node dist/index.js --country=USA --lineupId=USA-DITV501-X --timespan=48 --postalCode=10001 --outputFile=ditvnyc.xml
sleep 30s
node dist/index.js --country=CAN --lineupId=CAN-0005995-X --timespan=120 --postalCode=E3B3W4 --appendAsterisk --outputFile=shawcan.xml
sleep 30s
node dist/index.js --country=MEX --lineupId=MEX-OTA09400 --timespan=360 --postalCode=09400 --mediaportal --outputFile=mex09400ota.xml
node path/to/tvmerge/tv_merge.js -i ditvnyc.xml shawcan.xml mex09400ota.xml -o combinedepg.xml

Then Make the script executable:

chmod +x run-zap2xml.sh

Daily Schedule

Windows

Open Task Scheduler (search for it in the Start menu). Click "Create Basic Task..." Name it (e.g., "zap2xml Daily Update"). Set the trigger to "Daily" and choose your preferred time. For "Action", select "Start a program". Browse to your run-zap2xml.bat file. Finish the wizard.

Linux and Raspberry Pi

Schedule a daily task using cron Open crontab editor:

crontab -e

Add the following line to run the script daily at 3:00 AM (or choose your time):

0 3 * * * /path/to/zap2xml/run-zap2xml.sh

Save and exit.

macOS

Schedule a daily task using launchd Create a property list file at ~/Library/LaunchAgents/com.zap2xml.daily.plist with the following content (update the path as needed):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.zap2xml.daily</string>
    <key>ProgramArguments</key>
    <array>
        <string>/path/to/zap2xml/run-zap2xml.sh</string>
    </array>
    <key>StartCalendarInterval</key>
    <dict>
        <key>Hour</key>
        <integer>2</integer>
        <key>Minute</key>
        <integer>0</integer>
    </dict>
    <key>StandardOutPath</key>
    <string>/tmp/zap2xml.log</string>
    <key>StandardErrorPath</key>
    <string>/tmp/zap2xml.err</string>
</dict>
</plist>

Load the job:

launchctl load ~/Library/LaunchAgents/com.zap2xml.daily.plist

The script will now run daily at 2:00 AM. Adjust the time in the plist as needed.

Clone this wiki locally