You've already forked RadioPlayer
mirror of
https://github.com/radio95-rnt/RadioPlayer.git
synced 2026-02-26 13:52:00 +01:00
better cache
This commit is contained in:
@@ -13,14 +13,14 @@ class Module(PlayerModule):
|
||||
next = self.playlist[index]
|
||||
else:
|
||||
next = self.playlist[index+1]
|
||||
def prefetch(path):
|
||||
with open(path, "rb") as f:
|
||||
fd = f.fileno()
|
||||
os.posix_fadvise(fd, 0, 0, os.POSIX_FADV_SEQUENTIAL)
|
||||
os.posix_fadvise(fd, 0, 0, os.POSIX_FADV_NOREUSE)
|
||||
os.posix_fadvise(fd, 0, 0, os.POSIX_FADV_WILLNEED)
|
||||
|
||||
with open(track.path.absolute(), "rb") as f:
|
||||
os.posix_fadvise(f.fileno(), 0, 0, os.POSIX_FADV_SEQUENTIAL)
|
||||
os.posix_fadvise(f.fileno(), 0, 0, os.POSIX_FADV_NOREUSE)
|
||||
os.posix_fadvise(f.fileno(), 0, 0, os.POSIX_FADV_WILLNEED)
|
||||
with open(next, "rb") as f:
|
||||
os.posix_fadvise(f.fileno(), 0, 0, os.POSIX_FADV_SEQUENTIAL)
|
||||
os.posix_fadvise(f.fileno(), 0, 0, os.POSIX_FADV_NOREUSE)
|
||||
os.posix_fadvise(f.fileno(), 0, 0, os.POSIX_FADV_WILLNEED)
|
||||
prefetch(track.path.absolute())
|
||||
prefetch(next)
|
||||
|
||||
module = Module()
|
||||
Reference in New Issue
Block a user