Skip to content

Commit

Permalink
release: v1.26.0
Browse files Browse the repository at this point in the history
  • Loading branch information
newt-sc committed Apr 2, 2021
1 parent d5152f1 commit 202ec4e
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 28 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
* [v1.26.0](https://github.com/newt-sc/a4kStreaming/releases/tag/plugin.video.a4kstreaming%2Fplugin.video.a4kstreaming-1.26.0):
* Handle meta issues where an older episode has newer release date

* [v1.25.0](https://github.com/newt-sc/a4kStreaming/releases/tag/plugin.video.a4kstreaming%2Fplugin.video.a4kstreaming-1.25.0):
* Additional requests error handling

Expand Down
64 changes: 39 additions & 25 deletions a4kStreaming/explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,51 +146,65 @@ def __add_seasons(core, title):
episodes = title['episodes']['episodes']
episodes = list(filter(lambda ep: ep['releaseDate'], episodes))

prev_rld = None
for index, episode in enumerate(episodes):
try:
episodeNumber = episode['series']
episodeSeason = episodeNumber['seasonNumber']
episodeNumber = episodeNumber['episodeNumber']
episodeReleaseDate = episode['releaseDate']
current_rld = episode['releaseDate']
if prev_rld:
if current_rld['year'] < prev_rld['year'] or current_rld['month'] < prev_rld['month'] or current_rld['day'] < prev_rld['day']:
prev_rld['year'] = current_rld['year']
prev_rld['month'] = max(current_rld['month'] - 1, 1)
prev_rld['day'] = 1

prev_rld = current_rld
except:
pass

for index, episode in enumerate(episodes):
try:
episode_number = episode['series']
episode_season = episode_number['seasonNumber']
episode_number = episode_number['episodeNumber']
episode_rld = episode['releaseDate']

if not seasons.get(episodeSeason, None) and episodeNumber == 1:
seasons[episodeSeason] = core.utils.DictAsObject({
if not seasons.get(episode_season, None) and episode_number == 1:
seasons[episode_season] = core.utils.DictAsObject({
'episodes': 0,
'episode_ids': [],
'first_episode_year': episodeReleaseDate['year'],
'year': episodeReleaseDate['year'],
'month': episodeReleaseDate['month'],
'day': episodeReleaseDate['day'],
'first_episode_year': episode_rld['year'],
'year': episode_rld['year'],
'month': episode_rld['month'],
'day': episode_rld['day'],
})

if index + 1 < len(episodes) and episodes[index + 1]['releaseDate']['year'] < episodeReleaseDate['year'] and (episodeSeason - 1) in seasons:
prev_season_last_ep_release_date = seasons[episodeSeason - 1].last_episode['releaseDate']
seasons[episodeSeason].update({
if index + 1 < len(episodes) and episodes[index + 1]['releaseDate']['year'] < episode_rld['year'] and (episode_season - 1) in seasons:
prev_season_last_ep_release_date = seasons[episode_season - 1].last_episode['releaseDate']
seasons[episode_season].update({
'year': prev_season_last_ep_release_date['year'],
'month': prev_season_last_ep_release_date['month'],
'day': prev_season_last_ep_release_date['day'] + 1,
})

seasons[episodeSeason].episodes += 1
seasons[episodeSeason].episode_ids.append(episode['id'])
seasons[episodeSeason].last_episode = episode
seasons[episode_season].episodes += 1
seasons[episode_season].episode_ids.append(episode['id'])
seasons[episode_season].last_episode = episode

if index > 0:
season_to_update = None
releaseDate = None
if episodes[index - 1]['series']['seasonNumber'] + 1 == episodeSeason:
season_to_update = episodeSeason - 1
releaseDate = episodes[index - 1]['releaseDate']
rld = None
if episodes[index - 1]['series']['seasonNumber'] + 1 == episode_season:
season_to_update = episode_season - 1
rld = episodes[index - 1]['releaseDate']

if index + 1 == len(episodes):
season_to_update = episodeSeason
releaseDate = episodeReleaseDate
season_to_update = episode_season
rld = episode_rld

if season_to_update:
seasons[season_to_update].update({
'year_end': releaseDate['year'],
'month_end': releaseDate['month'],
'day_end': releaseDate['day'],
'year_end': rld['year'],
'month_end': rld['month'],
'day_end': rld['day'],
})

except:
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="plugin.video.a4kstreaming"
name="a4kStreaming"
version="1.25.0"
version="1.26.0"
provider-name="Unknown">
<requires>
<import addon="script.module.requests"/>
Expand Down Expand Up @@ -32,6 +32,9 @@ Designed for low-end devices and Estuary skin.
<screenshot>screenshot-06.jpg</screenshot>
</assets>
<news>
[v1.26.0]:
* Handle meta issues where an older episode has newer release date

[v1.25.0]:
* Additional requests error handling

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="plugin.video.a4kstreaming"
name="a4kStreaming"
version="1.25.0"
version="1.26.0"
provider-name="Unknown">
<requires>
<import addon="script.module.requests"/>
Expand Down Expand Up @@ -35,6 +35,9 @@ Designed for low-end devices and Estuary skin.
<screenshot>screenshot-06.jpg</screenshot>
</assets>
<news>
[v1.26.0]:
* Handle meta issues where an older episode has newer release date

[v1.25.0]:
* Additional requests error handling

Expand Down
2 changes: 1 addition & 1 deletion packages/addons.xml.crc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
639143a1abcefdb87ac6940b28da1f257fac88cd
c93ab7aebbe35f6d1c5e14f74ee6f846dd02469e

0 comments on commit 202ec4e

Please sign in to comment.