Changeset 2c6fea9719faf06109dce722eaa76389e5cfbcfb

Show
Ignore:
Timestamp:
12/02/07 21:04:02 (1 year ago)
Author:
Jason Michalski <armooo@armooo.net>
git-committer:
Jason Michalski <armooo@armooo.net> 1196651042 -0600
git-parent:

[ba90f24843c7c942b001b46fb707cbc0d409f90d]

git-author:
Jason Michalski <armooo@armooo.net> 1196538806 -0600
Message:

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.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugin.py

    r8b942de r2c6fea9  
    1 import os, shutil, re, random 
     1import os, shutil, re, random, threading 
    22from urllib import unquote, unquote_plus 
    33from urlparse import urlparse 
     
    1010 
    1111class Plugin(object): 
     12 
     13    random_lock = threading.Lock() 
    1214 
    1315    CONTENT_TYPE = '' 
     
    106108        if query.get('SortOrder',['Normal'])[0] == 'Random': 
    107109            seed = query.get('RandomSeed', ['1'])[0] 
     110            self.random_lock.acquire() 
    108111            random.seed(seed) 
    109112            random.shuffle(files) 
     113            self.random_lock.release() 
    110114        else: 
    111115            files.sort(dir_sort)