Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
# Conflicts:
#	README_en.md
  • Loading branch information
Guovin committed Nov 29, 2024
2 parents 4fa80f9 + 42f4b32 commit f47d8f5
Show file tree
Hide file tree
Showing 34 changed files with 1,995 additions and 955 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
*.sh linguist-language=Python
Dockerfile linguist-language=Python
Dockerfile linguist-language=Python
54 changes: 27 additions & 27 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:
- master
- dev
- gd
- gd-test
jobs:
push:
runs-on: ${{ matrix.operating-system }}
Expand All @@ -24,10 +23,10 @@ jobs:
- uses: actions/checkout@v3
with:
ref: ${{ env.BRANCH_NAME }}
- name: Run with setup-python 3.8
- name: Run with setup-python 3.13
uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.13'
update-environment: true
cache: 'pipenv'
- name: Check open_driver config
Expand All @@ -40,33 +39,36 @@ jobs:
except:
open_driver = False
print(open_driver)')" >> $GITHUB_ENV
- name: Check open_ffmpeg config
id: check_ffmpeg
run: |
echo "OPEN_FFMPEG=$(python -c '
try:
from utils.config import config
open_ffmpeg = config.open_ffmpeg
except:
open_ffmpeg = False
print(open_ffmpeg)')" >> $GITHUB_ENV
# - name: Check open_ffmpeg config
# id: check_ffmpeg
# run: |
# echo "OPEN_FFMPEG=$(python -c '
# try:
# from utils.config import config
# open_ffmpeg = config.open_ffmpeg
# except:
# open_ffmpeg = False
# print(open_ffmpeg)')" >> $GITHUB_ENV
- name: Set up Chrome
if: env.OPEN_DRIVER == 'True' || env.OPEN_DRIVER == 'true'
if: env.OPEN_DRIVER == 'True'
uses: browser-actions/setup-chrome@latest
with:
chrome-version: stable
- name: Download chrome driver
if: env.OPEN_DRIVER == 'True' || env.OPEN_DRIVER == 'true'
if: env.OPEN_DRIVER == 'True'
uses: nanasess/setup-chromedriver@master
- name: Install FFmpeg
if: env.OPEN_FFMPEG == 'True' || env.OPEN_FFMPEG == 'true'
run: sudo apt-get update && sudo apt-get install -y ffmpeg
# - name: Install FFmpeg
# if: env.OPEN_FFMPEG == 'True'
# run: sudo apt-get update && sudo apt-get install -y ffmpeg
- name: Install pipenv
run: pip3 install --user pipenv
- name: Install dependecies
run: pipenv --python 3.8 && pipenv install
- name: Build
run: pipenv run build
run: pipenv --python 3.13 && pipenv install --deploy
- name: Install selenium
if: env.OPEN_DRIVER == 'True'
run: pipenv install selenium
- name: Update
run: pipenv run dev
- name: Commit and push if changed
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
Expand Down Expand Up @@ -94,13 +96,11 @@ jobs:
if [[ -f "$final_m3u_file" ]]; then
git add -f "$final_m3u_file"
fi
if [[ -f "output/result_cache.pkl" ]]; then
git add -f "output/result_cache.pkl"
if [[ -f "output/cache.pkl" ]]; then
git add -f "output/cache.pkl"
fi
if [[ -f "output/user_result.log" ]]; then
git add -f "output/user_result.log"
elif [[ -f "output/result.log" ]]; then
git add -f "output/result.log"
if [[ -f "output/sort.log" ]]; then
git add -f "output/sort.log"
fi
if [[ -f "updates/fofa/fofa_hotel_region_result.pkl" ]]; then
git add -f "updates/fofa/fofa_hotel_region_result.pkl"
Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,15 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.13'
update-environment: true
cache: 'pipenv'

- name: Install pipenv
run: pip3 install --user pipenv

- name: Install dependencies with pipenv
run: pipenv --python 3.8 && pipenv install

- name: Install PyInstaller
run: pipenv install pyinstaller
run: pipenv --python 3.13 && pipenv install --dev

- name: Build the application
run: pipenv run pyinstaller tkinter_ui/tkinter_ui.spec
Expand All @@ -36,7 +33,7 @@ jobs:
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: iptv-update-tool
name: IPTV
path: dist

- name: Get version from version.json
Expand Down Expand Up @@ -79,6 +76,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/iptv-update-tool.exe
asset_name: iptv-update-tool.exe
asset_path: dist/IPTV.exe
asset_name: IPTV.exe
asset_content_type: application/octet-stream
35 changes: 33 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
# 更新日志(Changelog)

## v1.5.4

### 2024/11/29

- ⚠️ Python 升级至 3.13,该版本已不支持 Win7,若有需要请使用 v1.5.3
- ⚠️ Github 仓库改名:iptv-api,使用旧接口地址请及时更换新地址
- ⚠️ Docker 新镜像仓库启用:guovern/iptv-api(旧版的 tv-driver 改为:guovern/iptv-api:latest,tv-requests 改为 guovern/iptv-api:lite),iptv-api:latest 为完整版、iptv-api:lite 为精简版,请使用新的名称命令进行拉取,旧仓库将不再维护
- ❤️ 新增微信公众号关注途径(公众号搜索:Govin),推荐关注公众号,可订阅更新通知与使用技巧等文章推送,还可进行交流讨论
- ✨ 更换测速方法(yt-dlp),重构测速逻辑,提升准确性、稳定性与效率,减小接口切换延迟(#563
- ✨ 新增支持 ARM v7(#562
- ✨ 新增双结果 API 访问(ip/m3u, ip/txt)(#581
- ✨ 新增启动 API 服务命令(pipenv run service)
- 🪄 优化 Docker 镜像大小(完整版:-25%,精简版:-66%)
- 🐛 修复部分播放器不支持的信息间隔符(#581

<details>
<summary>English</summary>

- ⚠️ Python has been upgraded to version 3.13, which no longer supports Win7. If needed, please use version v1.5.3.
- ⚠️ The GitHub repository has been renamed to iptv-api. If you are using the old API address, please update it to the new one promptly.
- ⚠️ New Docker image repository is now active: guovern/iptv-api (the old tv-driver is now guovern/iptv-api:latest, and tv-requests is now guovern/iptv-api:lite). iptv-api:latest is the full version, and iptv-api:lite is the lightweight version. Please use the new names to pull the images, as the old repository will no longer be maintained.
- ❤️ A new way to follow the WeChat official account (search for: Govin) has been added. It is recommended to follow the official account to subscribe to update notifications, usage tips, and engage in discussions.
- ✨ The speed measurement method has been changed to yt-dlp, and the speed measurement logic has been refactored to improve accuracy, stability, and efficiency, reducing interface switching delay (#563).
- ✨ Support for ARM v7 has been added (#562).
- ✨ Dual result API access (ip/m3u, ip/txt) has been added (#581).
- ✨ A command to start the API service (pipenv run service) has been added.
- 🪄 The size of the Docker image has been optimized (Full version: -25%, Lite version: -66%).
- 🐛 Fixed the information delimiter issue for some players that do not support it (#581).

</details>

## v1.5.3

### 2024/11/19
Expand Down Expand Up @@ -59,7 +90,7 @@
- ✨ 新增频道接口白名单:不参与测速,永远保留在结果最前面(#470
使用方法:
1. 模板频道接口地址后添加$!即可实现(如:广东珠江,http://xxx.m3u$! )
2. 额外信息补充(如:广东珠江,http://xxx.m3u$!额外信息 ),更多接口白名单请至https://github.com/Guovin/TV/issues/514 讨论
2. 额外信息补充(如:广东珠江,http://xxx.m3u$!额外信息 ),更多接口白名单请至https://github.com/Guovin/iptv-api/issues/514 讨论
- ✨ 新增 🈳 无结果频道分类:无结果频道默认归类至该底部分类下(#473
- ✨ 接口地址增加来源类型说明
- ✨ 默认模板增加广东民生(#481)、广州综合(#504
Expand All @@ -78,7 +109,7 @@
- ✨ Added channel interface whitelist: Not participating in speed testing, always kept at the very front of the results. (#470)
Usage:
1. Add $! after the template channel interface address (e.g., Guangdong Pearl River, http://xxx.m3u$!).
2. Additional information can be appended (e.g., Guangdong Pearl River, http://xxx.m3u$! Additional Information) (#470). For more interface whitelists, please discuss at https://github.com/Guovin/TV/issues/514.
2. Additional information can be appended (e.g., Guangdong Pearl River, http://xxx.m3u$! Additional Information) (#470). For more interface whitelists, please discuss at https://github.com/Guovin/iptv-api/issues/514.
- ✨ Added 🈳 No Results Channel Category: Channels without results are categorized under this bottom category by default (#473).
- ✨ Interface addresses now include source type descriptions.
- ✨ Default templates now include Guangdong People's Livelihood (#481) and Guangzhou Comprehensive (#504).
Expand Down
75 changes: 41 additions & 34 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,51 +1,58 @@
FROM python:3.8-slim
FROM python:3.13 AS builder

ARG APP_WORKDIR=/tv
ARG LITE=False

ENV APP_WORKDIR=$APP_WORKDIR
WORKDIR /app

COPY . $APP_WORKDIR
COPY Pipfile* ./

WORKDIR $APP_WORKDIR
RUN pip install -i https://mirrors.aliyun.com/pypi/simple pipenv

RUN pip install -i https://mirrors.aliyun.com/pypi/simple pipenv \
&& pipenv install

RUN echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware\n \
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware\n \
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware\n \
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware\n \
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware\n \
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware\n \
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware\n \
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware\n \
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware\n" \
> /etc/apt/sources.list
RUN PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy\
&& if [ "$LITE" = False ]; then pipenv install selenium; fi

RUN apt-get update && apt-get install -y --no-install-recommends \
cron \
ffmpeg

ARG INSTALL_CHROMIUM=false
FROM python:3.13-slim

ARG APP_WORKDIR=/iptv-api
ARG LITE=False

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

WORKDIR $APP_WORKDIR

COPY . $APP_WORKDIR

COPY --from=builder /app/.venv /.venv

RUN echo "deb https://mirrors.aliyun.com/debian/ bookworm main contrib non-free non-free-firmware\n \
deb-src https://mirrors.aliyun.com/debian/ bookworm main contrib non-free non-free-firmware\n \
deb https://mirrors.aliyun.com/debian/ bookworm-updates main contrib non-free non-free-firmware\n \
deb-src https://mirrors.aliyun.com/debian/ bookworm-updates main contrib non-free non-free-firmware\n \
deb-src https://mirrors.aliyun.com/debian/ bookworm-updates main contrib non-free non-free-firmware\n \
deb https://mirrors.aliyun.com/debian/ bookworm-backports main contrib non-free non-free-firmware\n \
deb-src https://mirrors.aliyun.com/debian/ bookworm-backports main contrib non-free non-free-firmware\n \
deb https://mirrors.aliyun.com/debian-security/ bookworm-security main contrib non-free non-free-firmware\n \
deb-src https://mirrors.aliyun.com/debian-security/ bookworm-security main contrib non-free non-free-firmware\n" \
> /etc/apt/sources.list

RUN if [ "$INSTALL_CHROMIUM" = "true" ]; then \
apt-get install -y --no-install-recommends \
chromium \
chromium-driver; \
fi
RUN apt-get update && apt-get install -y --no-install-recommends cron

RUN apt-get clean && rm -rf /var/lib/apt/lists/*
RUN if [ "$LITE" = False ]; then apt-get install -y --no-install-recommends chromium chromium-driver; fi \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

RUN (crontab -l ; \
echo "0 22 * * * cd $APP_WORKDIR && /usr/local/bin/pipenv run python main.py scheduled_task"; \
echo "0 10 * * * cd $APP_WORKDIR && /usr/local/bin/pipenv run python main.py scheduled_task") | crontab -
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

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

COPY config /tv_config
COPY config /iptv-api-config

RUN chmod +x /tv_entrypoint.sh
RUN chmod +x /iptv-api-entrypoint.sh

ENTRYPOINT /tv_entrypoint.sh
ENTRYPOINT /iptv-api-entrypoint.sh
26 changes: 21 additions & 5 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ url = "https://mirrors.aliyun.com/pypi/simple"
verify_ssl = true

[scripts]
build = "python main.py"
dev = "python main.py"
service = "python service/app.py"
ui = "python tkinter_ui/tkinter_ui.py"
multicast_tmp = "python updates/multicast/update_tmp.py"
docker_run = "docker run -v ./config:/iptv-api/config -v ./output:/iptv-api/output -d -p 8000:8000 guovern/iptv-api"
docker_run_lite = "docker run -v ./config:/iptv-api-lite/config -v ./output:/iptv-api-lite/output -d -p 8000:8000 guovern/iptv-api:lite"
tkinter_build = "pyinstaller tkinter_ui/tkinter_ui.spec"
docker_build = "docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 --build-arg APP_WORKDIR=/iptv-api -t guovern/iptv-api ."
docker_build_lite = "docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 --build-arg APP_WORKDIR=/iptv-api-lite --build-arg LITE=True -t guovern/iptv-api:lite ."

[dev-packages]

[packages]
requests = "*"
selenium = "*"
bs4 = "*"
Expand All @@ -21,8 +24,21 @@ aiohttp = "*"
flask = "*"
opencc-python-reimplemented = "*"
fake-useragent = "*"
pillow = "*"
yt-dlp = "*"

[packages]
requests = "*"
bs4 = "*"
tqdm = "*"
async-timeout = "*"
aiohttp = "*"
flask = "*"
opencc-python-reimplemented = "*"
fake-useragent = "*"
gunicorn = "*"
pillow = "*"
yt-dlp = "*"

[requires]
python_version = "3.8"
python_version = "3.13"
Loading

0 comments on commit f47d8f5

Please sign in to comment.