Skip to content

Commit

Permalink
release: v2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
newt-sc committed Jan 30, 2021
1 parent 40994ea commit 9855352
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
* [v2.3.0](https://github.com/newt-sc/a4kSubtitles/releases/tag/service.subtitles.a4ksubtitles%2Fservice.subtitles.a4ksubtitles-2.3.0):
* Add concurrency error handling

* [v2.2.0](https://github.com/newt-sc/a4kSubtitles/releases/tag/service.subtitles.a4ksubtitles%2Fservice.subtitles.a4ksubtitles-2.2.0):
* Fix KODI 19 Matrix support

Expand Down
12 changes: 12 additions & 0 deletions a4kSubtitles/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,15 @@ def download(self, params, settings=None):
finally:
if restore_settings:
restore_settings()

def auto_load_enabled(self, settings=None):
restore_settings = None

try:
if settings:
restore_settings = self.mock_settings(settings)

return self.core.kodi.get_bool_setting('general.auto_search') and self.core.kodi.get_bool_setting('general.auto_download')
finally:
if restore_settings:
restore_settings()
10 changes: 8 additions & 2 deletions a4kSubtitles/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,18 @@ def __extract_zip(core, archivepath, filename, episodeid):
try:
return __extract_gzip(core, archivepath, filename)
except:
core.os.rename(archivepath, dest)
try: core.os.remove(dest)
except: pass
try: core.os.rename(archivepath, dest)
except: pass
return dest

if not using_libvfs:
src = core.utils.extract_zipfile_member(zipfile, subfile, core.utils.temp_dir)
core.os.rename(src, dest)
try: core.os.remove(dest)
except: pass
try: core.os.rename(src, dest)
except: pass
else:
src = 'archive://' + archivepath_ + '/' + subfile
core.kodi.xbmcvfs.copy(src, dest)
Expand Down
5 changes: 4 additions & 1 deletion 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.a4ksubtitles"
name="a4kSubtitles"
version="2.2.0"
version="2.3.0"
provider-name="Unknown">
<requires>
<import addon="script.module.requests"/>
Expand All @@ -27,6 +27,9 @@ Supports: OpenSubtitles, BSPlayer, Podnadpisi.NET, Subscene, Addic7ed
<screenshot>screenshot-03.png</screenshot>
</assets>
<news>
[v2.3.0]:
* Add concurrency error handling

[v2.2.0]:
* Fix KODI 19 Matrix support

Expand Down
5 changes: 4 additions & 1 deletion packages/addons.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<addons>
<addon id="service.subtitles.a4ksubtitles"
name="a4kSubtitles"
version="2.2.0"
version="2.3.0"
provider-name="Unknown">
<requires>
<import addon="script.module.requests"/>
Expand All @@ -30,6 +30,9 @@ Supports: OpenSubtitles, BSPlayer, Podnadpisi.NET, Subscene, Addic7ed
<screenshot>screenshot-03.png</screenshot>
</assets>
<news>
[v2.3.0]:
* Add concurrency error handling

[v2.2.0]:
* Fix KODI 19 Matrix support

Expand Down
2 changes: 1 addition & 1 deletion packages/addons.xml.crc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
76debceb64549a9e810cd1110ff064bbfd26a338
1cf652272d659fb7b413a06ee24601b01c3945c4
31 changes: 31 additions & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,34 @@ def get_error_msg(e):

api.A4kSubtitlesApi({'xbmc': True, 'xbmcaddon': True, 'xbmcplugin': True, 'xbmcgui': True, 'xbmcvfs': True})
api.A4kSubtitlesApi({'kodi': True})

def test_auto_load_enabled():
a4ksubtitles_api = api.A4kSubtitlesApi({'kodi': True})

settings = {
'general.auto_search': 'true',
'general.auto_download': 'true',
}
auto_load_enabled = a4ksubtitles_api.auto_load_enabled(settings)
assert auto_load_enabled is True

settings = {
'general.auto_search': 'false',
'general.auto_download': 'true',
}
auto_load_enabled = a4ksubtitles_api.auto_load_enabled(settings)
assert auto_load_enabled is False

settings = {
'general.auto_search': 'true',
'general.auto_download': 'false',
}
auto_load_enabled = a4ksubtitles_api.auto_load_enabled(settings)
assert auto_load_enabled is False

settings = {
'general.auto_search': 'false',
'general.auto_download': 'false',
}
auto_load_enabled = a4ksubtitles_api.auto_load_enabled(settings)
assert auto_load_enabled is False

1 comment on commit 9855352

@psychovsky
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I beg you to add this site to your subtitle provider list:
https://turkcealtyazi.org/ @newt-sc

Please sign in to comment.