Addon Details

Watch - Add Favorite

Does this version work for you?

Easy Download Library - Version 6 Final

posted on 2008-05-17 15:50:56
by ojii


[b]Why[/b] Let's say you have a folder with a lot of files in that you want to add to downloadables. Maybe this folder also has subfolders and everything. Now it can be very annoying to add them one by one. Thats what easydllib is for. [b]Interface[/b] [syntax="python"]class downloadables: def __init__() def add(dir,ignore=None,only=None,maxsize=None) dir: path to folder/file. relative to gamedir ignore (optional): File ends that should be ignored only (optional): Opposite of ignore, only file ends in this list will be included maxsize (optional): Maximum size of files to be included def apply() # Applies the downloads to the stringtable def remove(dir)[/syntax] [b]Usage[/b] [syntax="python"]import easydllib def load(): global downloads downloads = easydllib.downloadables() downloads.add('/sound/manysounds/',['ztmp','wav']) downloads.apply() def es_map_start(ev): downloads.apply() def randomFunction(): downloads.remove('/sound/manysounds/somefolder/')[/syntax] If you don't understand the example above: [i]import easydllib[/i]: This imports the library to be used [i]downloads = easydllib.downloadables()[/i]: This creates a class that will be used by this addon [i]downloads.add('/sound/manysounds/',['ztmp','wav'])[/i]: This adds all files in the folder '/sound/manysounds/' including subfolders to the list, except files ending with 'ztmp' or 'wav'. The list of endings to ignore is optional! [i]downloads.apply()[/i]: This should be called on load() and es_map_start(event_var) as its the function that actually fills the stringtable. [i]downloads.remove('/sound/manysounds/somefolder/')[/i]: This removes a folder/file from the downloadables list. [b]Many Thanks[/b] To Roach^Flo: Without his huge mental support I wouldn't have been able to write this lib. He was a great help in a hard time :D


Download the zip archive and unpack it into your games root folder (eg: cstrike). The file should be in the folder: /addons/eventscripts/_libs/python/

Version Notes For 6 Final

Updated on: 2008-05-19 12:03:49 EST by ojii (View Zip Contents)
-replaced all os and os.path functions with path -fixed remove() bugs

( Previous Versions )