Skip to content

Commit

Permalink
release: v0.0.21
Browse files Browse the repository at this point in the history
  • Loading branch information
newt-sc committed May 4, 2020
1 parent 3efa0bf commit 74c0e84
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 9 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
* [v0.0.21](https://github.com/newt-sc/a4kSubtitles/releases/tag/service.subtitles.a4ksubtitles%2Fservice.subtitles.a4ksubtitles-0.0.21):
* TVShow year scrape from imdb when necessary

* [v0.0.20](https://github.com/newt-sc/a4kSubtitles/releases/tag/service.subtitles.a4ksubtitles%2Fservice.subtitles.a4ksubtitles-0.0.20):
* Improve Subscene tvshow matching
* Exctract first sub file from zips when none is matched
* Extract first sub file from zips when none is matched
* Fix Podnadpisi not working properly for tvshows
* Fix non-ascii video file title issues
* Add tvshow tests
Expand Down
17 changes: 15 additions & 2 deletions a4kSubtitles/lib/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
import json
import struct
import hashlib
import re
import threading

from .kodi import xbmc, xbmcvfs
from . import logger, utils
from .kodi import xbmc, xbmcvfs, get_bool_setting
from . import logger, utils, request

__64k = 65536
__longlong_format_char = 'q'
Expand Down Expand Up @@ -63,6 +65,13 @@ def __set_subdb_hash(meta, filepath):
finally:
f.close()

def __scrape_tvshow_year(meta):
imdb_response = request.execute({'method': 'GET', 'url': 'https://www.imdb.com/title/' + meta.imdb_id})
if imdb_response.status_code == 200:
show_year_match = re.search(r' %s \((.*?)\)"' % meta.tvshow, imdb_response.text)
if show_year_match:
meta.tvshow_year = show_year_match.group(1)

def get_meta():
meta = {}
meta['year'] = xbmc.getInfoLabel('VideoPlayer.Year')
Expand Down Expand Up @@ -105,4 +114,8 @@ def get_meta():
meta.is_tvshow = meta.tvshow != ''
meta.is_movie = not meta.is_tvshow

if meta.is_tvshow and meta.imdb_id != '' and get_bool_setting('podnadpisi', 'enabled'):
meta.tvshow_year_thread = threading.Thread(target=__scrape_tvshow_year, args=(meta,))
meta.tvshow_year_thread.start()

return meta
2 changes: 1 addition & 1 deletion a4kSubtitles/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def search(core, params):
meta = core.video.get_meta()
meta.languages = __parse_languages(core, core.utils.unquote(params['languages']).split(','))
meta.preferredlanguage = __parse_language(core, params['preferredlanguage'])
core.logger.debug(lambda: core.json.dumps(meta, indent=2))
core.logger.debug(lambda: core.json.dumps(meta, default=lambda o: '', indent=2))

if meta.imdb_id == '':
core.logger.error('missing imdb id!')
Expand Down
4 changes: 4 additions & 0 deletions a4kSubtitles/services/podnadpisi.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ def build_search_requests(core, service_name, meta):
params['seasons'] = meta.season
params['episodes'] = meta.episode
params['movie_type'] = ['tv-series', 'mini-series']

meta.tvshow_year_thread.join()
if meta.tvshow_year:
params['year'] = meta.tvshow_year
else:
params['movie_type'] = 'movie'
params['year'] = meta.year
Expand Down
7 changes: 5 additions & 2 deletions 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="0.0.20"
version="0.0.21"
provider-name="Unknown">
<requires>
<import addon="xbmc.python" version="2.25.0"/>
Expand All @@ -24,9 +24,12 @@ Supports: OpenSubtitles, BSPlayer, Podnadpisi.NET, SubDB, Subscene
<icon>icon.png</icon>
</assets>
<news>
[v0.0.21]:
* TVShow year scrape from imdb when necessary

[v0.0.20]:
* Improve Subscene tvshow matching
* Exctract first sub file from zips when none is matched
* Extract first sub file from zips when none is matched
* Fix Podnadpisi not working properly for tvshows
* Fix non-ascii video file title issues
* Add tvshow tests
Expand Down
7 changes: 5 additions & 2 deletions 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="0.0.20"
version="0.0.21"
provider-name="Unknown">
<requires>
<import addon="xbmc.python" version="2.25.0"/>
Expand All @@ -27,9 +27,12 @@ Supports: OpenSubtitles, BSPlayer, Podnadpisi.NET, SubDB, Subscene
<icon>icon.png</icon>
</assets>
<news>
[v0.0.21]:
* TVShow year scrape from imdb when necessary

[v0.0.20]:
* Improve Subscene tvshow matching
* Exctract first sub file from zips when none is matched
* Extract first sub file from zips when none is matched
* Fix Podnadpisi not working properly for tvshows
* Fix non-ascii video file title issues
* Add tvshow tests
Expand Down
2 changes: 1 addition & 1 deletion packages/addons.xml.crc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ce64fa5330ba39c0eb089278d215c932d0f9d6ac
cb2c5a3c7846568f15ffc86dd3a3cc20dab27c70

0 comments on commit 74c0e84

Please sign in to comment.