Compare commits

..

No commits in common. "main" and "1.0.51" have entirely different histories.
main ... 1.0.51

5 changed files with 104 additions and 106 deletions

View File

@ -4,7 +4,6 @@ ARG GIT_BRANCH=master
ENV CRON_SCHEDULE="0 0,12 * * *" ENV CRON_SCHEDULE="0 0,12 * * *"
ENV API_URL="https://iptv-org.github.io/api" ENV API_URL="https://iptv-org.github.io/api"
ENV DAYS=14 ENV DAYS=14
ENV DELAY=0
ENV MAX_CONNECTIONS=10 ENV MAX_CONNECTIONS=10
ENV ENABLE_FIXES=false ENV ENABLE_FIXES=false
ARG BIN_FOLDER=/bin ARG BIN_FOLDER=/bin
@ -53,10 +52,9 @@ RUN apk update \
&& mkdir /public && mkdir /public
COPY start.sh $WORKDIR COPY start.sh $WORKDIR
COPY serve.json $WORKDIR COPY serve.json $WORKDIR
COPY pm2.config.js $WORKDIR
RUN chmod +x "$START_SCRIPT" \ RUN chmod +x "$START_SCRIPT" \
&& apk del git curl \ && apk del git curl \
&& rm -rf /var/cache/apk/* && rm -rf /var/cache/apk/*
SHELL ["/bin/bash", "-c"] SHELL ["/bin/bash", "-c"]
ENTRYPOINT bash $START_SCRIPT chron-schedule="$CRON_SCHEDULE" work-dir="$WORKDIR" days="$DAYS" delay=$DELAY max_connections="$MAX_CONNECTIONS" enable_fixes="$ENABLE_FIXES" api_url="$API_URL" ENTRYPOINT bash $START_SCRIPT chron-schedule="$CRON_SCHEDULE" work-dir="$WORKDIR" days="$DAYS" max_connections="$MAX_CONNECTIONS" enable_fixes="$ENABLE_FIXES" api_url="$API_URL"
EXPOSE 3000 EXPOSE 3000

View File

@ -56,7 +56,6 @@ It is recommended that you take existing provider code as a base for your custom
|-------------------------------|----------------------------------------------------------------------------|----------------------------------| |-------------------------------|----------------------------------------------------------------------------|----------------------------------|
| CRON_SCHEDULE | CRON expression describing the recurrence for epg retrieval. | `0 0,12 * * *` | | CRON_SCHEDULE | CRON expression describing the recurrence for epg retrieval. | `0 0,12 * * *` |
| DAYS | Describes the desired amount of days in the future for for epg retrieval. | 14 | | DAYS | Describes the desired amount of days in the future for for epg retrieval. | 14 |
| DELAY | Delay between requests in milliseconds | 0 |
| MAX_CONNECTIONS | The maximum amount of parallel connections that can be established | 10 | | MAX_CONNECTIONS | The maximum amount of parallel connections that can be established | 10 |
| ENABLE_FIXES | Some fixes to providers take a long time to be merged into the main branch.<br>When this option is enabled some of these fixes will also be included.<br>The source code for these fixes can be seen under the `fixes` folder.<br> Recreate the container when changing this variable in order for it to take effect | false | | ENABLE_FIXES | Some fixes to providers take a long time to be merged into the main branch.<br>When this option is enabled some of these fixes will also be included.<br>The source code for these fixes can be seen under the `fixes` folder.<br> Recreate the container when changing this variable in order for it to take effect | false |
| API_URL | The endpoint where channel information will be grabbed | `https://iptv-org.github.io/api` | | API_URL | The endpoint where channel information will be grabbed | `https://iptv-org.github.io/api` |
@ -195,23 +194,3 @@ Sometimes a new version of this image will be bound to the same source commit. T
[02-05-2025](https://github.com/iptv-org/epg/commit/7f6849869f7182ddfa1a01b08a160ff8d2129441) [02-05-2025](https://github.com/iptv-org/epg/commit/7f6849869f7182ddfa1a01b08a160ff8d2129441)
- 1.0.51 - 1.0.51
[02-11-2025](https://github.com/iptv-org/epg/commit/6cbe64f2dde47a3eb042cac35932989a7eefb2db) [02-11-2025](https://github.com/iptv-org/epg/commit/6cbe64f2dde47a3eb042cac35932989a7eefb2db)
- 1.0.52
[02-18-2025](https://github.com/iptv-org/epg/commit/39c4c5143e7cf7591ac49227e73e564be70c7615)
- 1.0.53
[02-23-2025](https://github.com/iptv-org/epg/commit/2721fe1ba06761fd06799a233dda27af6184fd17)
- 1.0.54
[03-07-2025](https://github.com/iptv-org/epg/commit/40c9af82d6f7f4e562cd239237fdf46a396d5728)
- 1.0.55
[03-11-2025](https://github.com/iptv-org/epg/commit/40c9af82d6f7f4e562cd239237fdf46a396d5728)
- 1.0.56
[03-16-2025](https://github.com/iptv-org/epg/commit/cf82b4089ef00c1fc94b7751652bfa598f8ab06a)
- 1.0.57
[03-25-2025](https://github.com/iptv-org/epg/commit/138842009bb3f9135430cdc667502ffa51d4a295)
- 1.0.58
[04-04-2025](https://github.com/iptv-org/epg/commit/4df25c92bcad1e4892640f532eae71cf9f5e7b95)
- 1.0.59
[04-04-2025](https://github.com/iptv-org/epg/commit/4df25c92bcad1e4892640f532eae71cf9f5e7b95)<br>Includes fixes for new configuration changes
- 1.0.60
[04-07-2025](https://github.com/iptv-org/epg/commit/7e1fbcbe154f4efd5c81341351cceb06f71b79a0)
- 1.0.61
[04-07-2025](https://github.com/iptv-org/epg/commit/7e1fbcbe154f4efd5c81341351cceb06f71b79a0)<br>Add delay option

View File

@ -2,17 +2,26 @@
const axios = require('axios') const axios = require('axios')
const dayjs = require('dayjs') const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc')
let apiVersion let apiVersion
dayjs.extend(utc)
module.exports = { module.exports = {
site: 'pickx.be', site: 'pickx.be',
days: 2, days: 2,
async url({ channel, date }) { setApiVersion: function (version) {
apiVersion = version
},
getApiVersion: function () {
return apiVersion
},
fetchApiVersion: fetchApiVersion,
url: async function ({ channel, date }) {
if (!apiVersion) { if (!apiVersion) {
await fetchApiVersion() await fetchApiVersion()
} }
return `https://px-epg.azureedge.net/airings/${apiVersion}/${date.format( return `https://px-epg.azureedge.net/airings/${apiVersion}/${date.format(
'YYYY-MM-DD' 'YYYY-MM-DD'
)}/channel/${channel.site_id}?timezone=Europe%2FBrussels` )}/channel/${channel.site_id}?timezone=Europe%2FBrussels`
@ -42,21 +51,19 @@ module.exports = {
episode: item.program.episodeNumber, episode: item.program.episodeNumber,
actors: item.program.actors, actors: item.program.actors,
director: item.program.director ? [item.program.director] : null, director: item.program.director ? [item.program.director] : null,
start: dayjs(item.programScheduleStart), start: dayjs.utc(item.programScheduleStart),
stop: dayjs(item.programScheduleEnd) stop: dayjs.utc(item.programScheduleEnd)
}) })
}) })
} }
return programs return programs
}, },
async channels() { async channels({ lang = '' }) {
let channels = []
const query = { const query = {
operationName: 'getChannels', operationName: 'getChannels',
variables: { variables: {
language: 'fr', language: lang,
queryParams: {}, queryParams: {},
id: '0', id: '0',
params: { params: {
@ -66,37 +73,74 @@ module.exports = {
query: `query getChannels($language: String!, $queryParams: ChannelQueryParams, $id: String, $params: ChannelParams) { query: `query getChannels($language: String!, $queryParams: ChannelQueryParams, $id: String, $params: ChannelParams) {
channels(language: $language, queryParams: $queryParams, id: $id, params: $params) { channels(language: $language, queryParams: $queryParams, id: $id, params: $params) {
id id
channelReferenceNumber
name name
callLetter
number
logo {
key
url
__typename
}
language language
hd
radio radio
replayable
ottReplayable
playable
ottPlayable
recordable
subscribed
cloudRecordable
catchUpWindowInHours
isOttNPVREnabled
ottNPVRStart
subscription {
channelRef
subscribed
upselling {
upsellable
packages
__typename
}
__typename
}
packages
__typename
} }
}` }`
} }
const result = await axios
const data = await axios
.post('https://api.proximusmwc.be/tiams/v3/graphql', query) .post('https://api.proximusmwc.be/tiams/v3/graphql', query)
.then(r => r.data) .then(r => r.data)
.catch(console.error) .catch(console.error)
data.data.channels.forEach(channel => { return (
let lang = channel.language || 'fr' result?.data?.channels
if (channel.language === 'ger') lang = 'de' .filter(
channel =>
channels.push({ !channel.radio && (!lang || channel.language === (lang === 'de' ? 'ger' : lang))
lang, )
.map(channel => {
return {
lang: channel.language === 'ger' ? 'de' : channel.language,
site_id: channel.id, site_id: channel.id,
name: channel.name name: channel.name
}) }
}) }) || []
)
return channels
} }
} }
function fetchApiVersion() {
return new Promise(async (resolve, reject) => {
try {
// you'll never find what happened here :)
// load the pickx page and get the hash from the MWC configuration.
// it's not the best way to get the version but it's the only way to get it.
async function fetchApiVersion() { const hashUrl = 'https://www.pickx.be/nl/televisie/tv-gids';
const hashUrl = 'https://www.pickx.be/nl/televisie/tv-gids'
const hashData = await axios const hashData = await axios.get(hashUrl)
.get(hashUrl)
.then(r => { .then(r => {
const re = /"hashes":\["(.*)"\]/ const re = /"hashes":\["(.*)"\]/
const match = r.data.match(re) const match = r.data.match(re)
@ -106,9 +150,10 @@ async function fetchApiVersion() {
throw new Error('React app version hash not found') throw new Error('React app version hash not found')
} }
}) })
.catch(console.error) .catch(console.error);
const versionUrl = `https://www.pickx.be/api/s-${hashData}` const versionUrl = `https://www.pickx.be/api/s-${hashData}`
const response = await axios.get(versionUrl, { const response = await axios.get(versionUrl, {
headers: { headers: {
Origin: 'https://www.pickx.be', Origin: 'https://www.pickx.be',
@ -116,8 +161,6 @@ async function fetchApiVersion() {
} }
}) })
return new Promise((resolve, reject) => {
try {
if (response.status === 200) { if (response.status === 200) {
apiVersion = response.data.version apiVersion = response.data.version
resolve() resolve()

View File

@ -1,23 +0,0 @@
module.exports = {
apps: [
{
name: 'serve',
script: 'npx serve -- public',
instances: 1,
watch: false,
autorestart: true
},
{
name: 'grab',
script: process.env.SITE
? `npm run grab -- --site=${process.env.SITE} ${
process.env.CLANG ? `--lang=${process.env.CLANG}` : ''
} --output=public/guide.xml`
: `npm run grab -- --gzip --channels=channels.xml --output=public/guide.xml`,
cron_restart: process.env.CRON || null,
instances: 1,
watch: false,
autorestart: false
}
]
}

View File

@ -6,7 +6,6 @@ for arg in "$@"; do
chron-schedule=*) chron_schedule="${arg#*=}" ;; chron-schedule=*) chron_schedule="${arg#*=}" ;;
work-dir=*) work_dir="${arg#*=}" ;; work-dir=*) work_dir="${arg#*=}" ;;
days=*) days="${arg#*=}" ;; days=*) days="${arg#*=}" ;;
delay=*) delay="${arg#*=}" ;;
max_connections=*) max_connections="${arg#*=}" ;; max_connections=*) max_connections="${arg#*=}" ;;
enable_fixes=*) enable_fixes="${arg#*=}" ;; enable_fixes=*) enable_fixes="${arg#*=}" ;;
api_url=*) api_url="${arg#*=}" ;; api_url=*) api_url="${arg#*=}" ;;
@ -17,7 +16,6 @@ echo "chron_schedule : ${chron_schedule}"
cd $work_dir cd $work_dir
echo "working dir : " $(pwd) echo "working dir : " $(pwd)
echo "days : ${days}" echo "days : ${days}"
echo "delay : ${delay}"
echo "max_connections : ${max_connections}" echo "max_connections : ${max_connections}"
echo "enable_fixes : ${enable_fixes}" echo "enable_fixes : ${enable_fixes}"
echo "api url : ${api_url}" echo "api url : ${api_url}"
@ -27,6 +25,9 @@ if [ "$enable_fixes" = true ] ; then
fi fi
sed -i -E "s/(https:\x2f\x2fiptv-org.github.io\x2fapi$\123filename\125)/$api_url$\123filename\125/g" $work_dir/scripts/core/apiClient.ts sed -i -E "s/(https:\x2f\x2fiptv-org.github.io\x2fapi$\123filename\125)/$api_url$\123filename\125/g" $work_dir/scripts/core/apiClient.ts
pm2 --name epg start npm -- run serve
npm run grab --- --channels=channels.xml --maxConnections=$max_connections --days=$days --gzip
ln -s $work_dir/guide.xml /public/guide.xml ln -s $work_dir/guide.xml /public/guide.xml
ln -s $work_dir/guide.xml.gz /public/guide.xml.gz ln -s $work_dir/guide.xml.gz /public/guide.xml.gz
pm2-runtime pm2.config.js --name epg --node-args="--no-autorestart --cron-restart="$chron_schedule" --maxConnections=$max_connections --days=$days --delay=$delay" npm run grab --- --channels=channels.xml --cron="$chron_schedule" --maxConnections=$max_connections --days=$days --gzip