Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch 2025.01.2 #2573

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
aeaef32
wip
freearhey Jan 2, 2025
76a902a
Create Dockerfile
freearhey Jan 2, 2025
2c22600
Delete cron package
freearhey Jan 2, 2025
06827b2
Update pm2.config.js
freearhey Jan 2, 2025
9ef413e
Update Dockerfile
freearhey Jan 2, 2025
ca1a916
Update README.md
freearhey Jan 2, 2025
9bbc6b8
Update Dockerfile
freearhey Jan 2, 2025
0baf1be
Update pm2.config.js
freearhey Jan 3, 2025
1274094
Install pm2 locally
freearhey Jan 3, 2025
8544221
Update Dockerfile
freearhey Jan 3, 2025
7fee216
Update README.md
freearhey Jan 3, 2025
6e2a814
Update pm2.config.js
freearhey Jan 5, 2025
2db99a5
Update Dockerfile
freearhey Jan 5, 2025
67bd130
Update grab.ts
freearhey Jan 5, 2025
8d1e94a
Update README.md
freearhey Jan 5, 2025
d3b9672
Update README.md
freearhey Jan 5, 2025
fd136c8
Merge branch 'master' into patch-2025.01.2
freearhey Jan 5, 2025
979db51
Merge branch 'master' into patch-2025.01.2
freearhey Jan 10, 2025
0255dfb
Update grab.ts
freearhey Jan 10, 2025
84add7d
Update yarn.lock
freearhey Jan 10, 2025
cb333f5
Update Dockerfile
freearhey Jan 10, 2025
a0a48e2
Merge branch 'master' into patch-2025.01.2
freearhey Jan 18, 2025
92d4bc5
Update grab.ts
freearhey Jan 18, 2025
da2cf51
Update package-lock.json
freearhey Jan 18, 2025
45a06e9
Update yarn.lock
freearhey Jan 18, 2025
03ee512
Update pm2.config.js
freearhey Jan 18, 2025
74ce38b
Update README.md
freearhey Jan 18, 2025
0e33226
Update pm2.config.js
freearhey Jan 18, 2025
e4f4199
Merge branch 'master' into patch-2025.01.2
freearhey Jan 18, 2025
5a98424
Merge branch 'master' into patch-2025.01.2
freearhey Jan 19, 2025
7b008cc
Merge branch 'patch-2025.01.7' into patch-2025.01.2
freearhey Feb 1, 2025
411efb9
Update README.md
freearhey Feb 1, 2025
bd96957
Update yarn.lock
freearhey Feb 1, 2025
d678649
Merge branch 'master' into patch-2025.01.2
freearhey Feb 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM node:22-alpine
ARG GIT_REPO=https://github.com/iptv-org/epg.git
ARG GIT_BRANCH=master
ARG USER=iptv-org
ARG WORKDIR=/epg
WORKDIR $WORKDIR
RUN apk update \
&& apk upgrade --no-cache \
&& apk add --no-cache git tzdata bash \
&& npm install -g npm@latest \
&& git clone --depth 1 -b $(echo "${GIT_BRANCH} ${GIT_REPO}") . \
&& npm install \
&& mkdir /public \
&& adduser -D $USER \
&& chown -R $USER $WORKDIR \
&& cd $WORKDIR \
&& apk del git
USER $USER
EXPOSE 3000
CMD [ "npx", "pm2-runtime", "pm2.config.js" ]
142 changes: 110 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Tools for downloading the EPG (Electronic Program Guide) for thousands of TV cha
- ✨ [Installation](#installation)
- 🚀 [Usage](#usage)
- 💫 [Update](#update)
- 🐋 [Docker](#docker)
- 📺 [Playlists](#playlists)
- 🗄 [Database](#database)
- 👨‍💻 [API](#api)
Expand Down Expand Up @@ -39,13 +40,15 @@ npm install

## Usage

To start the download of the guide, select one of the [supported sites](SITES.md) and paste its name into the command below:
To start the download of the guide, select one of the supported sites from [SITES.md](SITES.md) file and paste its name into the command below:

```sh
npm run grab --- --site=example.com
```

And once the download is complete, the guide will be saved to the `guide.xml` file.
Then run it and wait for the guide to finish downloading. When finished, a new `guide.xml` file will appear in the current directory.

You can also customize the behavior of the script using this options:

```sh
Usage: npm run grab --- [options]
Expand All @@ -55,35 +58,13 @@ Options:
-c, --channels <path> Path to *.channels.xml file (required if the "--site" attribute is
not specified)
-o, --output <path> Path to output file (default: "guide.xml")
-l, --lang <code> Filter channels by language (ISO 639-2 code)
-t, --timeout <milliseconds> Override the default timeout for each request
-d, --delay <milliseconds> Override the default delay between request
-l, --lang <code> Allows to limit the download to channels in the specified language only (ISO 639-1 code)
-t, --timeout <milliseconds> Timeout for each request in milliseconds (default: 0)
-d, --delay <milliseconds> Delay between request in milliseconds (default: 0)
-x, --proxy <url> Use the specified proxy (example: "socks5://username:password@127.0.0.1:1234")
--days <days> Override the number of days for which the program will be loaded
(defaults to the value from the site config)
--maxConnections <number> Limit on the number of concurrent requests (default: 1)
--cron <expression> Schedule a script run (example: "0 0 * * *")
--gzip Create a compressed version of the guide as well (default: false)
```

### Access the guide by URL

You can make the guide available via URL by running your own server:

```sh
npm run serve
```

After that, the guide will be available at the link:

```
http://localhost:3000/guide.xml
```

In addition it will be available to other devices on the same local network at the address:

```
http://<your_local_ip_address>:3000/guide.xml
--days <days> Number of days for which the program will be loaded (defaults to the value from the site config)
--maxConnections <number> Number of concurrent requests (default: 1)
--gzip Specifies whether or not to create a compressed version of the guide (default: false)
```

### Parallel downloading
Expand Down Expand Up @@ -116,12 +97,42 @@ npm run grab --- --channels=path/to/custom.channels.xml

### Run on schedule

If you want to download the guide automatically on a schedule, you need to pass a valid [cron expression](https://crontab.guru/) to the script using the `--cron` attribute:
To download the guide on a schedule, you can use the included process manager. Just run it with desire [cron expression](https://crontab.guru/) and the `grab` options:

```sh
npx pm2 start npm --no-autorestart --cron-restart="0 0,12 * * *" -- run grab --- --site=example.com
```

To track the process, you can use the command:

```sh
npx pm2 logs
```

For more info go to [pm2](https://pm2.keymetrics.io/docs/usage/quick-start/) documentation.

### Access the guide by URL

You can make the guide available via URL by running your own server. The easiest way to do this is to run this command:

```sh
npm run grab --- --site=example.com --cron="0 0 * * *"
npx serve
```

After that, the guide will be available at the link:

```
http://localhost:3000/guide.xml
```

In addition it will be available to other devices on the same local network at the address:

```
http://<your_local_ip_address>:3000/guide.xml
```

For more info go to [serve](https://github.com/vercel/serve) documentation.

## Update

If you have downloaded the repository code according to the instructions above, then to update it will be enough to run the command:
Expand All @@ -136,6 +147,73 @@ And then update all the dependencies:
npm install
```

## Docker

### Build an image

```sh
docker build -t iptv-org/epg --no-cache .
```

### Create and run container

```sh
docker run -p 3000:3000 -e SITE=example.com iptv-org/epg
```

To use your [custom channel list](#use-custom-channel-list) pass the path to it via the [--volume](https://docs.docker.com/engine/storage/volumes/#options-for---volume) option:

```sh
docker run -p 3000:3000 -v /path/to/channels.xml:/epg/channels.xml iptv-org/epg
```

By default, the guide will be downloaded only once and saved to the `/epg/public/guide.xml` file inside the container.

From the outside, it will be available at this link:

```
http://localhost:3000/guide.xml
```

or

```
http://<your_local_ip_address>:3000/guide.xml
```

### Configuration

To fine-tune the execution, you can pass environment variables to the container as follows:

```sh
docker run \
-p 5000:3000 \
-e SITE=example.com \
-e CLANG=fr \
-e CRON="0 0,12 * * *" \
-e PROXY="socks5://username:password@127.0.0.1:1234" \
-e MAX_CONNECTIONS=10 \
-e GZIP=true \
-e DAYS=14 \
-e TIMEOUT=5 \
-e DELAY=2 \
iptv-org/epg
```

| Variable | Description |
| --------------- | ------------------------------------------------------------------------------------------------------------------------- |
| SITE | Name of the site to parse |
| CLANG | Limit the download to channels in the specified language only ([ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) code) |
| CRON | A [cron expression](https://crontab.guru/) describing the schedule of the guide loadings (by default will run once) |
| PROXY | Use the specified proxy |
| MAX_CONNECTIONS | Limit on the number of concurrent requests (default: 1) |
| GZIP | Boolean value indicating whether to create a compressed version of the guide (default: false) |
| DAYS | Number of days for which the guide will be loaded (defaults to the value from the site config) |
| TIMEOUT | Timeout for each request in milliseconds (default: 0) |
| DELAY | Delay between request in milliseconds (default: 0) |

For more info go to [Docker](https://docs.docker.com/get-started/) documentation.

## Playlists

Playlists with already linked guides can be found in the [iptv-org/iptv](https://github.com/iptv-org/iptv) repository.
Expand Down
Loading