View difference between Paste ID: 6x0XPy1t and SuyWFEnT
SHOW: | | - or go back to the newest paste.
1
import es
2
import path
3
4
class DownloadHandler:
5
    downloads = []
6
    
7
    @staticmethod
8
    def downloadAll():
9
        for d in DownloadHandler.downloads:
10
            d.addDownload()
11
12
class DownloadPath(path.path):
13
14-
    basepath = str(es.ServerVar('eventscripts_gamedir'))
14+
    basepath = path.path(str(es.ServerVar('eventscripts_gamedir')))
15
    
16
    def __init__(self, other):
17-
        path.path.__init__(self, str(self.basepath))
17+
        path.path.__init__(self, str(self.basepath / other))
18
        
19-
        self.other = other
19+
20
        
21
    def addDownload(self):
22
        for f in self.files():
23
            es.stringtable('downloadables', str(f).split(str(self.basepath))[1])
24-
        for f in (self / self.other).files():
24+
25
            
26
# Bitte in diesem Bereich alle deine Pfade angeben, die heruntergeladen werden sollen.
27
28
DownloadPath('maps')
29
DownloadPath('sound/ordner/und/so/weiter')
30
# DownloadPath('')
31
32
33
# Nichts Editieren!
34
          
35
def es_map_start(ev):
36
    DownloadHandler.downloadAll()
37
    
38
def load():
39
    DownloadHandler.downloadAll()