|
17 | 17 | # along with script.module.srgssr. |
18 | 18 | # If not, see <http://www.gnu.org/licenses/>. |
19 | 19 |
|
20 | | -from urllib.parse import parse_qsl, ParseResult |
21 | | -from urllib.parse import urlparse as urlps |
22 | | - |
23 | 20 | import json |
| 21 | +import xbmc |
24 | 22 | import xbmcgui |
25 | 23 | import xbmcplugin |
26 | 24 |
|
@@ -133,28 +131,15 @@ def play_video(self, media_id_or_urn): |
133 | 131 | end_time = end_time // 1000 |
134 | 132 | break |
135 | 133 |
|
136 | | - if start_time and end_time: |
137 | | - parsed_url = urlps(auth_url) |
138 | | - query_list = parse_qsl(parsed_url.query) |
139 | | - updated_query_list = [] |
140 | | - for query in query_list: |
141 | | - if query[0] == "start" or query[0] == "end": |
142 | | - continue |
143 | | - updated_query_list.append(query) |
144 | | - updated_query_list.append(("start", str(start_time))) |
145 | | - updated_query_list.append(("end", str(end_time))) |
146 | | - new_query = utils.assemble_query_string(updated_query_list) |
147 | | - surl_result = ParseResult( |
148 | | - parsed_url.scheme, |
149 | | - parsed_url.netloc, |
150 | | - parsed_url.path, |
151 | | - parsed_url.params, |
152 | | - new_query, |
153 | | - parsed_url.fragment, |
154 | | - ) |
155 | | - auth_url = surl_result.geturl() |
156 | 134 | self.srgssr.log(f"play_video, auth_url = {auth_url}") |
157 | 135 | play_item = xbmcgui.ListItem(title, path=auth_url) |
| 136 | + if self.srgssr.get_kodi_major_version() >= 20 and start_time and end_time: |
| 137 | + info_tag = play_item.getVideoInfoTag() |
| 138 | + duration = end_time - start_time |
| 139 | + info_tag.setResumePoint(start_time, duration) |
| 140 | + info_tag.addVideoStream(xbmc.VideoStreamDetail(duration=duration)) |
| 141 | + info_tag.setDuration(duration) |
| 142 | + |
158 | 143 | subs = self.srgssr.get_subtitles(stream_url, urn) |
159 | 144 | if subs: |
160 | 145 | play_item.setSubtitles(subs) |
|
0 commit comments