Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import es
- import os
- class DownloadHandler:
- downloads = []
- @staticmethod
- def downloadAll():
- for d in DownloadHandler.downloads:
- d.addDownload()
- class DownloadPath(str):
- basepath = str(es.ServerVar('eventscripts_gamedir'))
- def __init__(self, other):
- self.other = other
- DownloadHandler.downloads.append(self)
- def __str__(self):
- return os.path.join(DownloadPath.basepath, self)
- def addDownload(self):
- for f in self.files():
- es.stringtable('downloadables', os.path.join(self.other, f))
- def getContent(self):
- return os.listdir(str(self))
- def files(self):
- return [x for x in self.getContent() if os.path.isfile(os.path.join(str(self), x))]
- def dirs(self):
- return [x for x in self.getContent() if os.path.isidr(os.path.join(str(self), x))]
- # Bitte in diesem Bereich alle deine Pfade angeben, die heruntergeladen werden sollen.
- DownloadPath('maps')
- DownloadPath('sound/ordner/und/so/weiter')
- # DownloadPath('')
- # Nichts Editieren!
- def es_map_start(ev):
- DownloadHandler.downloadAll()
- def load():
- DownloadHandler.downloadAll()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement