taksssss / EPG-Server

用 php 实现的 EPG 服务端, Docker🐳 部署,带设置界面、台标管理,支持 DIYP & 百川 、 超级直播 以及 xmltv 格式。
https://hub.docker.com/r/taksss/php-epg/
GNU General Public License v2.0
162 stars 58 forks source link

处理时区不正确 #13

Closed snowie2000 closed 2 months ago

snowie2000 commented 2 months ago

程序在处理非+8时区时存在计算错误。

以https://assets.livednow.com/epg.xml中的CCTV4为例

    <programme channel="CCTV4" start="20240906063000 +0000" stop="20240906071300 +0000">
        <title lang="zh">浴血十四年-(四套)-8/40</title>
        <date>2024-09-06</date>
    </programme>
    <programme channel="CCTV4" start="20240906071300 +0000" stop="20240906075600 +0000">
        <title lang="zh">浴血十四年-(四套)-9/40</title>
        <date>2024-09-06</date>
    </programme>
    <programme channel="CCTV4" start="20240906075600 +0000" stop="20240906083900 +0000">
        <title lang="zh">浴血十四年-(四套)-10/40</title>
        <date>2024-09-06</date>
    </programme>
    <programme channel="CCTV4" start="20240906083900 +0000" stop="20240906084200 +0000">
        <title lang="zh">记住乡愁-片段展播-2024-28</title>
        <date>2024-09-06</date>
    </programme>

UTC时间 20240906075600 +0000 应换算为 15:56 +8时间,而实际程序给出的epg数据为:

{
"title": "国家记忆-2024-114",
"start": "15:30",
"end": "16:00",
"desc": ""
},
{
"title": "海峡两岸-2024-249",
"start": "16:00",
"end": "16:30",
"desc": ""
},
{
"title": "远方的家2024-117",
"start": "16:30",
"end": "17:15",
"desc": ""
},

我不是很确定是不是由于时区错误导致的,因为我甚至无法找到这些数据到底是从哪里来的……

snowie2000 commented 2 months ago

以上数据是我清空了数据库后,只添加了单一epg生成的数据,不存在和其他epg源混合的问题。 附上有问题的epg文件。

epg.txt

taksssss commented 2 months ago

嗯嗯,现在的版本没有把时区考虑进去,处理时间的时候直接取,没有换算。 我换算一下吧。

channel="CCTV4-美洲" start="20240906153000 +0000" stop="20240906160000 +0000">国家记忆-2024-114 你这个应该是CCTV4-美洲的数据。</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/taksssss"><img src="https://avatars.githubusercontent.com/u/26397391?v=4" />taksssss</a> commented <strong> 2 months ago</strong> </div> <div class="markdown-body"> <p>推上去了,有空试试,看还有问题不。</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/snowie2000"><img src="https://avatars.githubusercontent.com/u/11767189?v=4" />snowie2000</a> commented <strong> 2 months ago</strong> </div> <div class="markdown-body"> <p>依然是不对的</p> <p>接口返回:</p> <pre><code>{ "channel_name": "CCTV4", "date": "2024-09-06", "url": "https://github.com/TakcC/PHP-EPG-Docker-Server", "epg_data": [ .... 省略中间 ... { "title": "此心安处是吾乡5/32", "start": "14:44", "end": "15:30", "desc": "" }, { "title": "远方的家2024-117", "start": "15:30", "end": "16:15", "desc": "" }, ... 省略</code></pre> <p>对应到epg xml:</p> <pre><code><programme channel="CCTV4-美洲" start="20240906064400 +0000" stop="20240906073000 +0000"><title lang="zh">此心安处是吾乡5/32</title><date>2024-09-06</date></programme><programme channel="CCTV4-美洲" start="20240906073000 +0000" stop="20240906081500 +0000"><title lang="zh">远方的家2024-117</title><date>2024-09-06</date></programme></code></pre> <p>可见时区是对了,但频道依然是不对的</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/taksssss"><img src="https://avatars.githubusercontent.com/u/26397391?v=4" />taksssss</a> commented <strong> 2 months ago</strong> </div> <div class="markdown-body"> <p>你看数据库里面同时有 CCTV4美洲 跟 CCTV4 么?为啥会把 CCTV4美洲 的数据更新到 CCTV4 上面去了😂</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/taksssss"><img src="https://avatars.githubusercontent.com/u/26397391?v=4" />taksssss</a> commented <strong> 2 months ago</strong> </div> <div class="markdown-body"> <p>会不会是因为你用了之前的频道映射数据? 旧的那个,会把 <code>CCTV4-美洲</code> 映射成 <code>CCTV4</code>,前几个版本已经改过来了。 或者你试试把所有频道映射规则都删掉,再更新。</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/snowie2000"><img src="https://avatars.githubusercontent.com/u/11767189?v=4" />snowie2000</a> commented <strong> 2 months ago</strong> </div> <div class="markdown-body"> <p>确实是旧版本的错误映射导致的,我把文件全删了重新开始就没有这个问题了</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/taksssss"><img src="https://avatars.githubusercontent.com/u/26397391?v=4" />taksssss</a> commented <strong> 2 months ago</strong> </div> <div class="markdown-body"> <p>嗯嗯,旧版本没考虑全,只忽略 <code>CCTV-4美洲</code> 这种 <code>4美洲</code> 连在一起的。 其实支持双向模糊匹配之后,这条规则大部分情况下也能删除了,除了 <code>DIYP</code> 用 <code>CCTV1-1080P</code> <code>CCTV1-50FPS</code> 这类型名称会被处理错。</p> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>