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

chore #665

Merged
merged 4 commits into from
Dec 12, 2024
Merged

chore #665

Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ FROM python:3.13-slim

ARG APP_WORKDIR=/iptv-api
ARG LITE=False
ARG APP_PORT=8000

ENV APP_WORKDIR=$APP_WORKDIR
ENV LITE=$LITE
ENV APP_PORT=$APP_PORT
ENV PATH="/.venv/bin:$PATH"

WORKDIR $APP_WORKDIR
Expand Down Expand Up @@ -47,7 +49,7 @@ RUN (crontab -l ; \
echo "0 22 * * * cd $APP_WORKDIR && /.venv/bin/python main.py"; \
echo "0 10 * * * cd $APP_WORKDIR && /.venv/bin/python main.py") | crontab -

EXPOSE 8000
EXPOSE $APP_PORT

COPY entrypoint.sh /iptv-api-entrypoint.sh

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,12 @@ docker run -v /etc/docker/config:/iptv-api/config -v /etc/docker/output:/iptv-ap
docker run -v /etc/docker/config:/iptv-api-lite/config -v /etc/docker/output:/iptv-api-lite/output -d -p 8000:8000 guovern/iptv-api:lite
```

端口环境变量:

```bash
-e APP_PORT=8000
```

3. 更新结果:

- 接口地址:ip:8000
Expand Down
6 changes: 6 additions & 0 deletions README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,12 @@ docker run -v /etc/docker/config:/iptv-api/config -v /etc/docker/output:/iptv-ap
docker run -v /etc/docker/config:/iptv-api-lite/config -v /etc/docker/output:/iptv-api-lite/output -d -p 8000:8000 guovern/iptv-api:lite
```

Port environment variables:

```bash
-e APP_PORT=8000
```

3. Update results:

- API address: ip:8000
Expand Down
2 changes: 1 addition & 1 deletion config/whitelist.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 这是接口或订阅源的白名单,白名单内的接口或订阅源获取的接口将不会参与测速,优先排序至结果最前。
# 填写频道名称会直接保留该记录至最终结果,如:CCTV-1,接口地址,只填写接口地址则对所有频道生效,多条记录换行输入。
# This is the whitelist of the interface or subscription source. The interface in the whitelist or the interface obtained by the subscription source will not participate in the speed measurement and will be prioritized in the result.
# Filling in the channel name will directly retain the record to the final result, such as: CCTV-1, interface address, only fill in the interface address will be effective for all channels, multiple records newline input.
# Filling in the channel name will directly retain the record to the final result, such as: CCTV-1,url, only fill in the interface address will be effective for all channels, multiple records newline input.
8 changes: 8 additions & 0 deletions docs/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@
1. 创建文件
2. 模板文件命名为 user_demo.txt
3.

模板文件需要按照(频道分类,#genre#),(频道名称,频道接口)进行编写,注意是英文逗号。如果需要将该接口设为白名单(不测速、保留在结果最前),可在地址后添加$!即可,例如http://xxx$!
。后面也可以添加额外说明信息,如:http://xxx$!白名单接口

4. 点击 Commit changes...进行保存

![创建user_demo.txt](./images/edit-user-demo.png '创建user_demo.txt')
Expand Down Expand Up @@ -263,6 +265,12 @@ docker run -v /etc/docker/config:/iptv-api/config -v /etc/docker/output:/iptv-ap
docker run -v /etc/docker/config:/iptv-api-lite/config -v /etc/docker/output:/iptv-api-lite/output -d -p 8000:8000 guovern/iptv-api:lite
```

端口环境变量:

```bash
-e APP_PORT=8000
```

3. 更新结果:

- 接口地址:ip:8000
Expand Down
6 changes: 6 additions & 0 deletions docs/tutorial_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,12 @@ docker run -v /etc/docker/config:/iptv-api/config -v /etc/docker/output:/iptv-ap
docker run -v /etc/docker/config:/iptv-api-lite/config -v /etc/docker/output:/iptv-api-lite/output -d -p 8000:8000 guovern/iptv-api:lite
```

Port environment variables:

```bash
-e APP_PORT=8000
```

3. Update results:

- API address: ip:8000
Expand Down
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ service cron start &

python $APP_WORKDIR/main.py &

python -m gunicorn service.app:app -b 0.0.0.0:8000 --timeout=1000
python -m gunicorn service.app:app -b 0.0.0.0:$APP_PORT --timeout=1000
2 changes: 1 addition & 1 deletion service/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def run_service():
print(f"🚀 M3u api: {ip_address}/m3u")
print(f"🚀 Txt api: {ip_address}/txt")
print(f"✅ You can use this url to watch IPTV 📺: {ip_address}")
app.run(host="0.0.0.0", port=8000)
app.run(host="0.0.0.0", port=os.environ.get("APP_PORT") or 8000)
except Exception as e:
print(f"❌ Service start failed: {e}")

Expand Down
2 changes: 1 addition & 1 deletion utils/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ def write_channel_to_file(data, ipv6=False, callback=None):
open_empty_category = config.open_empty_category
ipv_type_prefer = list(config.ipv_type_prefer)
if any(pref in ipv_type_prefer for pref in ["自动", "auto"]) or not ipv_type_prefer:
ipv_type_prefer = ["ipv6", "ipv4"] if (ipv6 or (not os.environ.get("GITHUB_ACTIONS"))) else ["ipv4", "ipv6"]
ipv_type_prefer = ["ipv6", "ipv4"] if (ipv6 or os.environ.get("GITHUB_ACTIONS")) else ["ipv4", "ipv6"]
origin_type_prefer = config.origin_type_prefer
for cate, channel_obj in data.items():
print(f"\n{cate}:", end=" ")
Expand Down
2 changes: 1 addition & 1 deletion utils/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def get_ip_address():
IP = "127.0.0.1"
finally:
s.close()
return f"http://{IP}:8000"
return f"http://{IP}:{os.environ.get("APP_PORT") or 8000}"


def convert_to_m3u():
Expand Down