Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[service.subtitles.opensubtitles-com] 1.0.3 #2563

Merged
merged 5 commits into from
Jan 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions service.subtitles.opensubtitles-com/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Search and download subtitles for movies and TV-Series from OpenSubtitles.com. S

REST API implementation based on tomburke25 [python-opensubtitles-rest-api](https://github.com/tomburke25/python-opensubtitles-rest-api)

v1.0.3 (2023-12-18)
- Fixed issue with file path

v1.0.2 (2023-08-28)
- Update user agent header

Expand Down
5 changes: 4 additions & 1 deletion service.subtitles.opensubtitles-com/addon.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="service.subtitles.opensubtitles-com"
name="OpenSubtitles.com"
version="1.0.2"
version="1.0.3"
provider-name="amet, opensubtitles, juokelis, opensubtitlesdev">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
Expand Down Expand Up @@ -52,6 +52,9 @@
<description lang="zh_CN">多语种的电影及剧集字幕,每日更新千余条翻译好的字幕。免费下载,提供API接口,已拥有上百万的用户。</description>
<disclaimer lang="en_GB">Users need to provide OpenSubtitles.com username and password in add-on configuration. This is our new extension, old opensubtitles.org will not work on this, but the account can be easily imported on opensubtitles.com.</disclaimer>
<news>
v1.0.3 (2023-12-18)
- Fixed issue with file path

v1.0.2 (2023-08-28)
- Update user agent header

Expand Down
3 changes: 3 additions & 0 deletions service.subtitles.opensubtitles-com/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v1.0.3 (2023-12-18)
- Fixed issue with file path

v1.0.2 (2023-08-28)
- Update user agent header

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import struct

import xbmcvfs
import xbmcvfs, xbmc

from resources.lib.utilities import log

Expand All @@ -12,6 +12,16 @@ def get_file_data(file_original_path):


if file_original_path.find("http") > -1:
orig_path = xbmc.getInfoLabel('Window(10000).Property(videoinfo.current_path)')
orig_size = xbmc.getInfoLabel('Window(10000).Property(videoinfo.current_size)')
if orig_path:
orig_path = str(orig_path)
item["basename"] = os.path.basename(orig_path)
item["file_original_path"] = orig_path
if orig_size:
item["file_size"] = int(orig_size)
return item

item["temp"] = True

elif file_original_path.find("rar://") > -1:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ def __init__(self, api_key, username, password):
self.username = username
self.password = password

self.request_headers = {"Api-Key": self.api_key, "User-Agent": "Opensubtitles.com Kodi plugin v1.0.2" ,"Content-Type": CONTENT_TYPE, "Accept": CONTENT_TYPE}
self.request_headers = {"Api-Key": self.api_key, "User-Agent": "Opensubtitles.com Kodi plugin v1.0.3" ,"Content-Type": CONTENT_TYPE, "Accept": CONTENT_TYPE}


self.session = Session()
self.session.headers = self.request_headers
Expand Down Expand Up @@ -216,5 +217,5 @@ def download_subtitle(self, query: Union[dict, OpenSubtitlesDownloadRequest]):
if not subtitle["content"]:
logging(f"Could not download subtitle from {subtitle.download_link}")

return subtitle

return subtitle
Loading