Skip to content

Commit

Permalink
修复:php7.3- 版本兼容性问题
Browse files Browse the repository at this point in the history
  • Loading branch information
taksssss committed Sep 6, 2024
1 parent d41702f commit 165a2fa
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 18 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@ PHP 实现的 EPG(电子节目指南)服务端, `Docker` 部署,自带

## 主要功能 ℹ️
- 支持返回 **`DIYP & 百川`****`超级直播`** 以及 **`xmltv`** 格式 📡
- **一键生成**匹配 `M3U``xmltv` 格式 `EPG` 文件 💯
- 支持查看**频道匹配**结果 🪢
- 提供 **`amd64`****`arm64`** 架构 `Docker` 镜像,支持**电视盒子**等设备 🐳
- 基镜像采用 `alpine-apache-php`**压缩后大小仅 `20M`** 📦
- 采用**先构建再存数据库**的策略,**提高读取速度** 🚀
- 采用**先构建再存数据库**的策略,**减少数据冗余****提高读取速度** 🚀
- 支持**繁体中文频道匹配** 🌐
- 支持**双向模糊匹配** ✍🏻
- 支持**多对一频道映射**,支持**正则表达式** 🔄
- 支持设置**频道忽略字符表** 🔇
- 支持生成**指定频道节目单** 📝
- 内置**定时任务**,支持设置定时拉取数据 ⏳
- 支持生成**匹配 `M3U`**`xmltv` 格式文件 💯
- 支持查看**频道匹配**结果 🪢
- 支持**频道指定 `EPG`** 🈯
- 兼容多种 `xmltv` 格式 🗂️
- 使用 `SQLite` 数据库存储 🗃️
- 包含网页设置页面 🌐
Expand All @@ -37,7 +38,7 @@ PHP 实现的 EPG(电子节目指南)服务端, `Docker` 部署,自带

### 2024-9-6:

1. 新增:频道绑定 `EPG`
1. 新增:频道指定 `EPG`
2. 新增:管理页面预加载数据,减少等待时间

### 2024-9-4:
Expand Down Expand Up @@ -164,9 +165,9 @@ PHP 实现的 EPG(电子节目指南)服务端, `Docker` 部署,自带

![编辑频道映射](/pic/channelsMapping.png)

**频道绑定 `EPG`**
**频道指定 `EPG`**

![频道绑定EPG源](/pic/channelsBindEPG.png)
![频道指定EPG源](/pic/channelsBindEPG.png)

**更多设置**

Expand Down
26 changes: 16 additions & 10 deletions epg/manage.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,13 @@ function showChangePasswordForm() {
}
}

// 处理频道绑定 EPG 数据
// 处理频道指定 EPG 数据
$channel_bind_epg = isset($_POST['channel_bind_epg']) ?
array_filter(
array_column(json_decode($_POST['channel_bind_epg'], true), 'channels', 'epg_src'),
fn($channels) => !empty($channels)
function($channels) {
return !empty($channels);
}
) : [];

// 获取旧的配置
Expand Down Expand Up @@ -291,7 +293,7 @@ function showChangePasswordForm() {
];
}

// 返回频道绑定 EPG 数据
// 返回频道指定 EPG 数据
elseif (isset($_GET['get_channel_bind_epg'])) {
// 从数据库中获取频道
$channels = $db->query("SELECT DISTINCT UPPER(channel) FROM epg_data ORDER BY UPPER(channel) ASC")->fetchAll(PDO::FETCH_COLUMN);
Expand Down Expand Up @@ -327,15 +329,19 @@ function($epgSrc) {
'epg_src' => $cleanEpgSrc,
'channels' => $channelBindEpg[$cleanEpgSrc] ?? ''
];
}, array_filter($filteredUrls, fn($epgSrc) => strpos(trim($epgSrc), '#') !== 0)),
}, array_filter($filteredUrls, function($epgSrc) {
return strpos(trim($epgSrc), '#') !== 0;
})),

array_map(function($epgSrc) use ($channelBindEpg) {
$cleanEpgSrc = trim(preg_replace('/^\s*#\s*/', '', $epgSrc));
return [
'epg_src' => '【已停用】' . ltrim($cleanEpgSrc, '#'),
'channels' => $channelBindEpg[$cleanEpgSrc] ?? ''
];
}, array_filter($filteredUrls, fn($epgSrc) => strpos(trim($epgSrc), '#') === 0))
}, array_filter($filteredUrls, function($epgSrc) {
return strpos(trim($epgSrc), '#') === 0;
}))
);
}

Expand Down Expand Up @@ -507,7 +513,7 @@ function($epgSrc) {
<h2>管理配置</h2>
<form method="POST" id="settingsForm">

<label for="xml_urls">EPG源地址(支持 xml 跟 .xml.gz 格式, # 为注释)</label><span id="channelbind" onclick="showModal('channelbindepg')" style="color: blue; cursor: pointer;">(频道绑定EPG源)</span><br><br>
<label for="xml_urls">EPG源地址(支持 xml 跟 .xml.gz 格式, # 为注释)</label><span id="channelbind" onclick="showModal('channelbindepg')" style="color: blue; cursor: pointer;">(频道指定EPG源)</span><br><br>
<textarea placeholder="一行一个,地址前面加 # 可以临时停用,后面加 # 可以备注。快捷键: Ctrl+/ 。" id="xml_urls" name="xml_urls" style="height: 122px;"><?php echo implode("\n", array_map('trim', $Config['xml_urls'])); ?></textarea><br><br>

<div class="form-row">
Expand Down Expand Up @@ -641,17 +647,17 @@ function($epgSrc) {
</div>
</div>

<!-- 频道绑定EPG模态框 -->
<!-- 频道指定EPG模态框 -->
<div id="channelBindEPGModal" class="modal">
<div class="modal-content channel-bind-epg-modal-content">
<span class="close">&times;</span>
<h2>频道绑定EPG源</h2>
<h2>频道指定EPG源<span style="font-size: 14px;">(无指定则按靠前的源更新)</span></h2>
<div class="table-container" id="channel-bind-epg-table-container">
<table id="channelBindEPGTable">
<thead style="position: sticky; top: 0; background-color: white;">
<tr>
<th>EPG源地址</th>
<th>绑定频道(可 , 分隔)</th>
<th>指定EPG源</th>
<th>频道(可 , 分隔)</th>
</tr>
</thead>
<tbody>
Expand Down
4 changes: 2 additions & 2 deletions epg/update.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function getGenList($db) {
];
}

// 获取频道绑定 EPG 关系
// 获取频道指定 EPG 关系
function getChannelBindEPG() {
global $Config;
$channelBindEPG = [];
Expand Down Expand Up @@ -422,7 +422,7 @@ function insertDataToDatabase($channelsData, $db) {
$gen_list = $gen_res['gen_list'];
$gen_list_mapping = $gen_res['gen_list_mapping'];

// 获取频道绑定 EPG 关系
// 获取频道指定 EPG 关系
$channel_bind_epg = getChannelBindEPG();

// 全局变量,用于记录已处理的记录
Expand Down
Binary file modified pic/channelsBindEPG.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pic/management.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 165a2fa

Please sign in to comment.