Skip to content

Commit

Permalink
release: v1.62.0
Browse files Browse the repository at this point in the history
  • Loading branch information
newt-sc committed Oct 15, 2024
1 parent 49a8914 commit 140c855
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 15 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
* [v1.62.0](https://github.com/newt-sc/a4kStreaming/releases/tag/plugin.video.a4kstreaming%2Fplugin.video.a4kstreaming-1.62.0):
* Reduce cache ttl to 5s and remove cache auto refresh

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

Expand Down
15 changes: 11 additions & 4 deletions a4kStreaming/lib/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,20 @@ def __cache_get(key):
return {}

def __cache_check(key):
path = __cache_key_path(key)
return os.path.exists(path)
try:
path = __cache_key_path(key)
if os.path.exists(path):
ttl = os.path.getmtime(path)
if time.time() - ttl < 5:
return True
os.remove(path)
except:
pass

def __cache_cleanup():
try:
# while temp dir bigger than 500MiB, remove files sorted by age (oldest first)
max_size = 500 * 1024 * 1024
# while temp dir bigger than 5MiB, remove files sorted by age (oldest first)
max_size = 5 * 1024 * 1024
files = []
size = 0

Expand Down
8 changes: 0 additions & 8 deletions a4kStreaming/lib/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,6 @@ def execute(core, request, cache=True):
response.text = ''
response.content = core.db.get(request_hash)
response.status_code = 200

def refresh():
response = session.request(verify=False, **request)
if response.status_code == 200:
core.logger.debug('Cache refresh: %s' % request_hash)
core.db.set(request_hash, response.content)

core.threading.Thread(target=refresh).start()
else:
if cache:
core.logger.debug('Cache miss: %s' % request_hash)
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.61.0"
version="1.62.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.62.0]:
* Reduce cache ttl to 5s and remove cache auto refresh

[v1.61.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.61.0"
version="1.62.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.62.0]:
* Reduce cache ttl to 5s and remove cache auto refresh

[v1.61.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 @@
f36bf5c9fe64754387df68028976c6e9f3de2d4d
0510d1eba3846ce5f8607255b16f50be8d5db09b

0 comments on commit 140c855

Please sign in to comment.