Skip to content

Commit

Permalink
release: v1.42.0
Browse files Browse the repository at this point in the history
  • Loading branch information
newt-sc committed May 15, 2022
1 parent 4e5ab75 commit 06f1d04
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 25 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
* [v1.42.0](https://github.com/newt-sc/a4kStreaming/releases/tag/plugin.video.a4kstreaming%2Fplugin.video.a4kstreaming-1.42.0):
* Update episodes date ranges

* [v1.41.0](https://github.com/newt-sc/a4kStreaming/releases/tag/plugin.video.a4kstreaming%2Fplugin.video.a4kstreaming-1.41.0):
* Fix trailers

Expand Down
48 changes: 26 additions & 22 deletions a4kStreaming/explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def __add_seasons(core, title):
except:
pass

for index, episode in enumerate(episodes):
for _, episode in enumerate(episodes):
try:
episode_number = episode['series']
episode_season = episode_number['seasonNumber']
Expand All @@ -175,38 +175,42 @@ def __add_seasons(core, title):
'year': episode_rld['year'],
'month': episode_rld['month'],
'day': episode_rld['day'],
'year_end': episode_rld['year'],
'month_end': min(int(episode_rld['month']) + 1, 12),
'day_end': episode_rld['day'] + 1,
'last_episode': episode,
})

if index + 1 < len(episodes) and episodes[index + 1]['releaseDate']['year'] < episode_rld['year'] and (episode_season - 1) in seasons:
if (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,
})
else:
try:
d1 = core.datetime(seasons[episode_season]['year'], seasons[episode_season]['month'], seasons[episode_season]['day'])
d2 = core.datetime(episode_rld['year'], episode_rld['month'], episode_rld['day'])
if d1 > d2:
seasons[episode_season]['year'] = d2.year
seasons[episode_season]['month'] = d2.month
seasons[episode_season]['day'] = d2.day
except:
pass
try:
d1 = core.datetime(seasons[episode_season]['year_end'], seasons[episode_season]['month_end'], seasons[episode_season]['day_end'])
d2 = core.datetime(episode_rld['year'], episode_rld['month'], episode_rld['day'])
if d1 < d2:
seasons[episode_season]['year_end'] = d2.year
seasons[episode_season]['month_end'] = min(int(d2.month) + 1, 12)
seasons[episode_season]['day_end'] = d2.day + 1
seasons[episode_season].last_episode = episode
except:
pass

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
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 = episode_season
rld = episode_rld

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

except:
pass

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.41.0"
version="1.42.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.42.0]:
* Update episodes date ranges

[v1.41.0]:
* Fix trailers

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.41.0"
version="1.42.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.42.0]:
* Update episodes date ranges

[v1.41.0]:
* Fix trailers

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

0 comments on commit 06f1d04

Please sign in to comment.