Mercurial > wow > hotcorners
comparison Libs/LibSharedMedia-3.0/LibSharedMedia-3.0.lua @ 11:371e14cd2feb
- major fixes with icons not showing correctly.
| author | Tercio |
|---|---|
| date | Thu, 08 Dec 2016 13:01:40 -0200 |
| parents | c31ee4251181 |
| children | 3596dadf9a90 |
comparison
equal
deleted
inserted
replaced
| 10:6572ed4edaae | 11:371e14cd2feb |
|---|---|
| 1 --[[ | 1 --[[ |
| 2 Name: LibSharedMedia-3.0 | 2 Name: LibSharedMedia-3.0 |
| 3 Revision: $Revision: 89 $ | 3 Revision: $Revision: 91 $ |
| 4 Author: Elkano (elkano@gmx.de) | 4 Author: Elkano (elkano@gmx.de) |
| 5 Inspired By: SurfaceLib by Haste/Otravi (troeks@gmail.com) | 5 Inspired By: SurfaceLib by Haste/Otravi (troeks@gmail.com) |
| 6 Website: http://www.wowace.com/projects/libsharedmedia-3-0/ | 6 Website: http://www.wowace.com/projects/libsharedmedia-3-0/ |
| 7 Description: Shared handling of media data (fonts, sounds, textures, ...) between addons. | 7 Description: Shared handling of media data (fonts, sounds, textures, ...) between addons. |
| 8 Dependencies: LibStub, CallbackHandler-1.0 | 8 Dependencies: LibStub, CallbackHandler-1.0 |
| 9 License: LGPL v2.1 | 9 License: LGPL v2.1 |
| 10 ]] | 10 ]] |
| 11 | 11 |
| 12 local MAJOR, MINOR = "LibSharedMedia-3.0", 6000201 -- 6.0.2 v1 / increase manually on changes | 12 local MAJOR, MINOR = "LibSharedMedia-3.0", 6010002 -- 6.1.0 v2 / increase manually on changes |
| 13 local lib = LibStub:NewLibrary(MAJOR, MINOR) | 13 local lib = LibStub:NewLibrary(MAJOR, MINOR) |
| 14 | 14 |
| 15 if not lib then return end | 15 if not lib then return end |
| 16 | 16 |
| 17 local _G = getfenv(0) | 17 local _G = getfenv(0) |
| 221 if type(key) ~= "string" then | 221 if type(key) ~= "string" then |
| 222 error(MAJOR..":Register(mediatype, key, data, langmask) - key must be string, got "..type(key)) | 222 error(MAJOR..":Register(mediatype, key, data, langmask) - key must be string, got "..type(key)) |
| 223 end | 223 end |
| 224 mediatype = mediatype:lower() | 224 mediatype = mediatype:lower() |
| 225 if mediatype == lib.MediaType.FONT and ((langmask and band(langmask, LOCALE_MASK) == 0) or not (langmask or locale_is_western)) then return false end | 225 if mediatype == lib.MediaType.FONT and ((langmask and band(langmask, LOCALE_MASK) == 0) or not (langmask or locale_is_western)) then return false end |
| 226 if mediatype == lib.MediaType.SOUND and type(data) == "string" then | |
| 227 local path = data:lower() | |
| 228 -- Only ogg and mp3 are valid sounds. | |
| 229 if not path:find(".ogg", nil, true) and not path:find(".mp3", nil, true) then | |
| 230 return false | |
| 231 end | |
| 232 end | |
| 226 if not mediaTable[mediatype] then mediaTable[mediatype] = {} end | 233 if not mediaTable[mediatype] then mediaTable[mediatype] = {} end |
| 227 local mtable = mediaTable[mediatype] | 234 local mtable = mediaTable[mediatype] |
| 228 if mtable[key] then return false end | 235 if mtable[key] then return false end |
| 229 | 236 |
| 230 mtable[key] = data | 237 mtable[key] = data |
