Pyckplayer 1.0.2__tar.gz → 1.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyckplayer-1.0.2/src/Pyckplayer.egg-info → pyckplayer-1.0.4}/PKG-INFO +1 -1
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/setup.py +1 -1
- {pyckplayer-1.0.2 → pyckplayer-1.0.4/src/Pyckplayer.egg-info}/PKG-INFO +1 -1
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/core.py +43 -5
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/LICENSE +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/MANIFEST.in +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/README.md +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/pyproject.toml +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/setup.cfg +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/Pyckplayer.egg-info/SOURCES.txt +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/Pyckplayer.egg-info/dependency_links.txt +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/Pyckplayer.egg-info/entry_points.txt +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/Pyckplayer.egg-info/requires.txt +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/Pyckplayer.egg-info/top_level.txt +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/__init__.py +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/LICENSE +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/css/ckplayer.css +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/css/ckplayer.ixigua.css +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/css/ckplayer.red.css +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/css/images/adclose.png +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/css/images/buffer.png +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/css/images/ckplayer.48.png +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/css/images/ckplayer.png +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/css/images/ckplayer_ixigua.48.png +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/css/images/ckplayer_ixigua.png +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/css/images/ckplayer_red.48.png +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/css/images/ckplayer_red.png +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/css/images/favicon.ico +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/css/images/loading.png +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/css/images/logo.png +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/css/images/play.png +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/flv.js/LICENSE +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/flv.js/README.md +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/flv.js/flv.js +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/flv.js/flv.js.map +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/flv.js/flv.min.js +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/flv.js/flv.min.js.map +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/hls.js/LICENSE +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/hls.js/README.md +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/hls.js/hls-demo.js +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/hls.js/hls-demo.js.map +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/hls.js/hls.js +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/hls.js/hls.js.d.ts +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/hls.js/hls.js.map +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/hls.js/hls.light.js +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/hls.js/hls.light.js.map +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/hls.js/hls.light.min.js +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/hls.js/hls.light.min.js.map +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/hls.js/hls.min.js +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/hls.js/hls.min.js.map +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/js/ckplayer.js +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/js/ckplayer.min.js +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/language/en.js +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/language/zh.cn.js +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/language/zh.hk.js +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/mpegts.js/LICENSE +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/mpegts.js/mpegts.js +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/mpegts.js/mpegts.js.map +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/mpegts.js/mpegts.min.js +0 -0
- {pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/cli.py +0 -0
|
@@ -91,6 +91,20 @@ def download_cover(poster_url: Optional[str], silent: bool = True) -> Optional[s
|
|
|
91
91
|
return None
|
|
92
92
|
|
|
93
93
|
|
|
94
|
+
def detect_stream_type(url: str) -> str:
|
|
95
|
+
url_lower = url.lower()
|
|
96
|
+
if '.m3u8' in url_lower or '/hls/' in url_lower:
|
|
97
|
+
return 'hls'
|
|
98
|
+
elif '.flv' in url_lower:
|
|
99
|
+
return 'flv'
|
|
100
|
+
elif '.ts' in url_lower:
|
|
101
|
+
return 'ts'
|
|
102
|
+
elif '.mp4' in url_lower:
|
|
103
|
+
return 'mp4'
|
|
104
|
+
else:
|
|
105
|
+
return 'auto'
|
|
106
|
+
|
|
107
|
+
|
|
94
108
|
def generate_html(video_url: str,
|
|
95
109
|
poster_url: Optional[str] = None,
|
|
96
110
|
title: str = "CKPlayer") -> str:
|
|
@@ -99,19 +113,43 @@ def generate_html(video_url: str,
|
|
|
99
113
|
js_path = quote((script_dir / "ckplayer" / "js" / "ckplayer.js").as_posix())
|
|
100
114
|
favicon_path = quote((script_dir / "ckplayer" / "css" / "images" / "logo.png").as_posix())
|
|
101
115
|
|
|
116
|
+
stream_type = detect_stream_type(video_url)
|
|
117
|
+
|
|
102
118
|
video_object = {
|
|
103
119
|
"container": "#player",
|
|
104
120
|
"variable": "player",
|
|
105
121
|
"video": video_url,
|
|
106
|
-
"autoplay":
|
|
107
|
-
"loop":
|
|
122
|
+
"autoplay": True,
|
|
123
|
+
"loop": False,
|
|
124
|
+
"preload": "auto",
|
|
108
125
|
}
|
|
109
126
|
|
|
127
|
+
if stream_type == 'hls':
|
|
128
|
+
video_object["plug"] = "hls.js"
|
|
129
|
+
video_object["live"] = True
|
|
130
|
+
elif stream_type == 'flv':
|
|
131
|
+
video_object["plug"] = "flv.js"
|
|
132
|
+
video_object["live"] = True
|
|
133
|
+
elif stream_type == 'ts':
|
|
134
|
+
video_object["plug"] = "mpegts.js"
|
|
135
|
+
video_object["live"] = True
|
|
136
|
+
|
|
110
137
|
if poster_url:
|
|
111
138
|
video_object["poster"] = poster_url
|
|
112
139
|
|
|
113
140
|
video_object_js = json.dumps(video_object)
|
|
114
141
|
|
|
142
|
+
js_includes = ""
|
|
143
|
+
if stream_type == 'hls':
|
|
144
|
+
hls_js_path = quote((script_dir / "ckplayer" / "hls.js" / "hls.min.js").as_posix())
|
|
145
|
+
js_includes = f'<script type="text/javascript" src="file:///{hls_js_path}"></script>\n '
|
|
146
|
+
elif stream_type == 'flv':
|
|
147
|
+
flv_js_path = quote((script_dir / "ckplayer" / "flv.js" / "flv.min.js").as_posix())
|
|
148
|
+
js_includes = f'<script type="text/javascript" src="file:///{flv_js_path}"></script>\n '
|
|
149
|
+
elif stream_type == 'ts':
|
|
150
|
+
mpegts_js_path = quote((script_dir / "ckplayer" / "mpegts.js" / "mpegts.min.js").as_posix())
|
|
151
|
+
js_includes = f'<script type="text/javascript" src="file:///{mpegts_js_path}"></script>\n '
|
|
152
|
+
|
|
115
153
|
html_content = f"""<!DOCTYPE html>
|
|
116
154
|
<html lang="zh-CN">
|
|
117
155
|
<head>
|
|
@@ -120,8 +158,8 @@ def generate_html(video_url: str,
|
|
|
120
158
|
<title>{title}</title>
|
|
121
159
|
<link rel="icon" href="file:///{favicon_path}" type="image/png">
|
|
122
160
|
<link rel="shortcut icon" href="file:///{favicon_path}" type="image/png">
|
|
123
|
-
<link rel="stylesheet" href="file:///{css_path}">
|
|
124
|
-
<script src="file:///{js_path}"></script>
|
|
161
|
+
<link rel="stylesheet" type="text/css" href="file:///{css_path}">
|
|
162
|
+
{js_includes}<script type="text/javascript" src="file:///{js_path}"></script>
|
|
125
163
|
<style>
|
|
126
164
|
body, html {{ margin: 0; padding: 0; background-color: #000; overflow: hidden; }}
|
|
127
165
|
#player {{ width: 100%; height: 100vh; }}
|
|
@@ -131,7 +169,7 @@ def generate_html(video_url: str,
|
|
|
131
169
|
<div id="player"></div>
|
|
132
170
|
<script>
|
|
133
171
|
var videoObject = {video_object_js};
|
|
134
|
-
new ckplayer(videoObject);
|
|
172
|
+
var player = new ckplayer(videoObject);
|
|
135
173
|
</script>
|
|
136
174
|
</body>
|
|
137
175
|
</html>"""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/css/images/ckplayer_ixigua.48.png
RENAMED
|
File without changes
|
{pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/css/images/ckplayer_ixigua.png
RENAMED
|
File without changes
|
{pyckplayer-1.0.2 → pyckplayer-1.0.4}/src/pyckplayer/ckplayer/css/images/ckplayer_red.48.png
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|