Updating the EPG π #14328
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/[email protected] | |
| uv run fetcher --input channels.json --sites epg/sites/skyperfectv.co.jp partial/[email protected] | |
| uv run fetcher --input channels.json --sites epg/sites/s.mxtv.jp partial/[email protected] | |
| uv run fetcher --input channels.json --sites epg/sites/nhkworldpremium.com partial/[email protected] | |
| uv run fetcher --input channels.json --sites epg/sites/www3.nhk.or.jp partial/[email protected] | |
| - 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/[email protected] --output="../partial/[email protected]" | |
| NODE_OPTIONS=--max-old-space-size=5000 npm run grab -- --channels=../partial/[email protected] --maxConnections=10 --output="../partial/[email protected]" | |
| NODE_OPTIONS=--max-old-space-size=5000 npm run grab -- --channels=../partial/[email protected] --maxConnections=10 --output="../partial/[email protected]" | |
| NODE_OPTIONS=--max-old-space-size=5000 npm run grab -- --channels=../partial/[email protected] --maxConnections=10 --output="../partial/[email protected]" | |
| NODE_OPTIONS=--max-old-space-size=5000 npm run grab -- --channels=../partial/[email protected] --maxConnections=10 --output="../partial/[email protected]" | |
| - name: Concatenate the partial guides | |
| run: uv run concatenate ./guide.xml --input partial/[email protected] --input partial/[email protected] --input partial/[email protected] --input partial/[email protected] --input partial/[email protected] | |
| - 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 '[email protected]' | |
| 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 |