From 2c6fea9719faf06109dce722eaa76389e5cfbcfb Mon Sep 17 00:00:00 2001 From: Jason Michalski Date: Sat, 1 Dec 2007 13:53:26 -0600 Subject: [PATCH] Lock when setting the seed and reording the list. Don't want to use the wrong seed. This is fine as along and we don't use random any where else. --- plugin.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugin.py b/plugin.py index 949251a..53b0eca 100644 --- a/plugin.py +++ b/plugin.py @@ -1,4 +1,4 @@ -import os, shutil, re, random +import os, shutil, re, random, threading from urllib import unquote, unquote_plus from urlparse import urlparse @@ -10,6 +10,8 @@ def GetPlugin(name): class Plugin(object): + random_lock = threading.Lock() + CONTENT_TYPE = '' def __new__(cls, *args, **kwds): @@ -105,8 +107,10 @@ class Plugin(object): if query.get('SortOrder',['Normal'])[0] == 'Random': seed = query.get('RandomSeed', ['1'])[0] + self.random_lock.acquire() random.seed(seed) random.shuffle(files) + self.random_lock.release() else: files.sort(dir_sort) -- 2.11.4.GIT