Updating the EPG π #16718
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: EPG Update | |
| run-name: Updating the EPG π | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| # At minute 0 | |
| - cron: "0 * * * *" | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Downloading the channels database | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: "iptv-org/database" | |
| # Relative path under $GITHUB_WORKSPACE to place the repository | |
| path: "database" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| version: "latest" | |
| # - uses: actions/setup-python@v5 | |
| # with: | |
| # python-version: "3.11" | |
| - name: Installing Python dependencies | |
| run: uv sync | |
| - name: Installing the package | |
| run: uv pip install -e . | |
| - name: Getting the channels ID | |
| run: uv run filter --channels database/data/channels.csv --feeds database/data/feeds.csv --language="jpn" --country="JP" --minify channels.json | |
| - name: Downloading the EPG fetchers | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: "Animenosekai/epg" | |
| ref: "plus" | |
| path: "epg" # Relative path under $GITHUB_WORKSPACE to place the repository | |
| - name: Filtering the channels | |
| run: | | |
| uv run fetcher --input channels.json --sites epg/sites japanterebi.channels.xml | |
| uv run fetcher --input channels.json --sites epg/sites/tvguide.myjcom.jp partial/japanterebi@jcom.channels.xml | |
| uv run fetcher --input channels.json --sites epg/sites/skyperfectv.co.jp partial/japanterebi@skyperfectv.channels.xml | |
| uv run fetcher --input channels.json --sites epg/sites/s.mxtv.jp partial/japanterebi@mxtv.channels.xml | |
| uv run fetcher --input channels.json --sites epg/sites/nhkworldpremium.com partial/japanterebi@nhkworldpremium.channels.xml | |
| uv run fetcher --input channels.json --sites epg/sites/www3.nhk.or.jp partial/japanterebi@nhk.channels.xml | |
| - uses: actions/setup-node@v4 | |
| with: | |
| # node-version: latest | |
| # We can't use `latest` for now as the build for `libxmljs2` seems to fail | |
| node-version: "21.7.3" | |
| # `package-lock.json` is not here yet | |
| # cache: npm | |
| - name: Installing JavaScript dependencies | |
| run: | | |
| cd epg | |
| npm install | |
| - name: Fetching the programs data | |
| run: | | |
| cd epg | |
| NODE_OPTIONS=--max-old-space-size=5000 npm run grab -- --channels=../partial/japanterebi@jcom.channels.xml --output="../partial/guide@jcom.xml" | |
| NODE_OPTIONS=--max-old-space-size=5000 npm run grab -- --channels=../partial/japanterebi@skyperfectv.channels.xml --maxConnections=10 --output="../partial/guide@skyperfectv.xml" | |
| NODE_OPTIONS=--max-old-space-size=5000 npm run grab -- --channels=../partial/japanterebi@mxtv.channels.xml --maxConnections=10 --output="../partial/guide@mxtv.xml" | |
| NODE_OPTIONS=--max-old-space-size=5000 npm run grab -- --channels=../partial/japanterebi@nhkworldpremium.channels.xml --maxConnections=10 --output="../partial/guide@nhkworldpremium.xml" | |
| NODE_OPTIONS=--max-old-space-size=5000 npm run grab -- --channels=../partial/japanterebi@nhk.channels.xml --maxConnections=10 --output="../partial/guide@nhk.xml" | |
| - name: Concatenate the partial guides | |
| run: uv run concatenate ./guide.xml --input partial/guide@jcom.xml --input partial/guide@skyperfectv.xml --input partial/guide@mxtv.xml --input partial/guide@nhkworldpremium.xml --input partial/guide@nhk.xml | |
| - name: Fixing the document | |
| run: uv run fix --input guide.xml guide.xml | |
| - name: Merging redundant programs | |
| run: uv run merger --input guide.xml guide.xml | |
| - name: Minify XML | |
| run: uv run minify --input guide.xml guide.xml | |
| - name: Remove the downloaded repositories | |
| run: | | |
| echo "Removing 'database'" | |
| rm -r database | |
| echo "Removing 'epg'" | |
| rm -r epg | |
| - name: Committing the new data | |
| run: | | |
| git config --global user.name 'Japan Terebi [GitHub Actions]' | |
| git config --global user.email 'japanterebi@users.noreply.github.com' | |
| export NOW=$(date +'%Y-%m-%dT%H:%M:%S') | |
| git add guide.xml | |
| git add channels.json | |
| git add japanterebi.channels.xml | |
| git add partial/japanterebi@*.channels.xml | |
| git add partial/guide@*.xml | |
| git commit -am "Automated guide.xml update ($NOW)" | |
| git push |