View difference between Paste ID: 5BCiCWC7 and 6x0XPy1t
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 = path.path(str(es.ServerVar('eventscripts_gamedir')))
15
    
16
    def __init__(self, other):
17-
        path.path.__init__(self, str(self.basepath / other))
17+
        path.path.__init__(self, str(DownloadPath.basepath / other))
18
        
19
        DownloadHandler.downloads.append(self)
20
        
21
    def addDownload(self):
22
        for f in self.files():
23-
            es.stringtable('downloadables', str(f).split(str(self.basepath))[1])
23+
            es.stringtable('downloadables', str(f[0]).split(str(DownloadPath.basepath)+ path.path.module.sep)[1])
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()