Esamlib
From EventScripts Community Encyclopedia
|
[edit] Module: esamlib[edit] Module OverviewEventScripts version: 2.0.0.248d or later [edit] Table of Contents
[edit] DescriptionProvides an interface for the ESAM SDK. [edit] Quick ExampleRetrieving ESAM addon information:>>> import esamlib >>> css = esamlib.getAddon('cssoundtrack') >>> css.getElementNames() # This will change as the SDK is updated ['addon', 'id', 'author', 'authorid', 'name', 'basename', 'approved', 'es_load', 'date', 'woots', 'desc', 'summary', 'currentversion', 'versionnotes', 'video','defaultssid'] >>> css.download() <StringIO.StringIO instance at 0x115BF738> >>> css.currentversion '7' >>> css.approved '1' >>> css.get('approved') '1'Retrieving ESAM user information: >>> import esamlib >>> sd = esamlib.getUser('SuperDave') >>> sd.getElementNames() # This will change as the SDK is updated ['username', 'userid', 'addontotal', 'addonrank', 'woottotal', 'wootrank', 'downloadtotal', 'downloadrank'] >>> sd.username 'SuperDave' >>> sd.userid '11091' >>> sd.downloadrank '4' >> sd.get('userid') '11091' >>> sd.addons.getAddonNameList() ['cheapbombtimer', 'regenmod', 'cheapzombie', 'cheapdeathmatch', 'gunmod', 'cheapwirecut', 'swapwithvictim', 'slomomod', 'slobot', 'knifegrenade', 'newrewards', 'cssoundtrack', 'cheapbleed', 'explosivedeaths', 'nadeslay', 'healmates', 'teamfog', 'healthregen', 'weaponstats', 'splashdamage', 'doublevip', 'cheapbeacon','nowyouseeme', 'coloredhealth', 'bomberman', 'sourceradar', 'ezrestrict', 'assistedkills', 'randmaps', 'iedmod', 'safespawn', 'ezfilter', 'extendedevents', 'iptocountry', 'cheapbulletwhizz', 'cheapemote'] >>> sd.addons.cssoundtrack <esamlib.Addon object at 0x1173AB70> >>> sd.addons.find('cssoundtrack') <esamlib.Addon object at 0x1173AB70> >>> sd.addons.cssoundtrack.getElementNames() # This will change as the SDK is updated ['addon', 'id', 'author', 'authorid', 'name', 'basename', 'approved', 'es_load', 'date', 'woots', 'desc', 'summary', 'currentversion', 'versionnotes', 'video','defaultssid'] >>> sd.addons.cssoundtrack.id '13758' >>> sd.addons.cssoundtrack.currentversion '7' >>> sd.addons.cssoundtrack.video 'http://www.youtube.com/v/G3S8l3BB4J0' >>> sd.addons.cssoundtrack.woots '21' >>> sd.addons.cssoundtrack.date '2007-05-02 04:21:26' >>> sd.addons.cssoundtrack.defaultssid '200'Upload functions: # API keys can be obtained from: http://addons.eventscripts.com/manage/api_key/ # Upload to in-use basename gungame3 >>> esamlib.upload('SuperDave', my_api_key, 'gungame3', 'c:\\Redirect.zip', 'Redirect', '1.0', 'Version notes', 'Another SD test upload', 'Test summary', 'redirect', '2.0') 'Error: Basename in use by another user.' # Upload to available basename sd_redirect >>> esamlib.upload('SuperDave', my_api_key, 'sd_redirect', 'c:\\Redirect.zip', 'Redirect', '1.0', 'Version notes', 'Another SD test upload', 'Test summary', 'redirect', '2.0') 'Success! Addon ID# 16569' # Add GODJonez as a collaborator on the redirect project >>> esamlib.addCollaborator('SuperDave', my_api_key, 'sd_redirect', 'GODJonez') 'GODJonez added successfully to sd_redirect' # Remove GODJonez as a collaborator on the redirect project >>> esamlib.removeCollaborator('SuperDave', my_api_key, 'sd_redirect', 'GODJonez') 'GODJonez removed successfully from sd_redirect'Query functions: # Unless otherwise specified, query functions return a list (in order, if meaningful) of dictionaries of addon/user information. # Query the leader and collaborators of an addon with the return format (leader, [collaborators,]) >>> esamlib.getCollaborators('sentrysounds') ('Mattie', ['HellenAngel']) # Query [NATO]Hunter's addons >>> result = esamlib.search(esamlib.SEARCH_USER, 'Hunter') # Query all addons that require at least ES 2.1 >>> result = esamlib.search(esamlib.SEARCH_ESVERSION, '2.1') # Query the top four addons by woots >>> result = esamlib.topAddons(esamlib.TOP_WOOTS, 4) # Query the top three users by number of addons >>> result = esamlib.topUsers(esamlib.TOP_ADDONCOUNT, 3) # Query the top ten users by downloads >>> result = esamlib.topUsers(esamlib.TOP_DOWNLOADS) # Query the addons updated less than one day ago >>> result = esamlib.updated_since(time.time() - 86400) # Query addons watched by XE_ManUp >>> result = esamlib.watchedBy('XE_ManUp') [edit] Module Content[edit] Classes
[edit] Methods
[edit] Constants
[edit] See Also[edit] Notes
|
|
