You've already forked RadioPlayer
mirror of
https://github.com/radio95-rnt/RadioPlayer.git
synced 2026-02-27 06:03:52 +01:00
better cache
This commit is contained in:
@@ -13,14 +13,14 @@ class Module(PlayerModule):
|
|||||||
next = self.playlist[index]
|
next = self.playlist[index]
|
||||||
else:
|
else:
|
||||||
next = self.playlist[index+1]
|
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:
|
prefetch(track.path.absolute())
|
||||||
os.posix_fadvise(f.fileno(), 0, 0, os.POSIX_FADV_SEQUENTIAL)
|
prefetch(next)
|
||||||
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)
|
|
||||||
|
|
||||||
module = Module()
|
module = Module()
|
||||||
Reference in New Issue
Block a user