Updating the EPG π #7032
This file contains 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: "Animenosekai/database" | |
# Relative path under $GITHUB_WORKSPACE to place the repository | |
path: "database" | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Installing Python dependencies | |
run: python -m pip install -r requirements.txt | |
- name: Getting the channels ID | |
run: python scripts/filter.py --input database/data/channels.csv --language="jpn" --country="JP" --minify channels.json | |
- name: Downloading the EPG fetchers | |
uses: actions/checkout@v4 | |
with: | |
repository: "Animenosekai/epg" | |
# Relative path under $GITHUB_WORKSPACE to place the repository | |
path: "epg" | |
- name: Filtering the channels | |
run: python scripts/fetcher.py --input channels.json --sites epg/sites japanterebi.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 | |
npm run grab -- --channels=../japanterebi.channels.xml --maxConnections=10 --output="../guide.xml" | |
- name: Fixing the document | |
run: python scripts/fix.py --input guide.xml guide.xml | |
- name: Merging redundant programs | |
run: python scripts/merger.py --input guide.xml guide.xml | |
- name: Minify XML | |
run: python scripts/minify.py --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 commit -am "Automated guide.xml update ($NOW)" | |
git push |