Quantcast
Download
(15 Kb)
Download
Updated: 08/24/20 01:04 AM
Compatibility:
Stonethorn (6.1.5)
Updated:08/24/20 01:04 AM
Created:03/13/14 10:38 PM
Monthly downloads:104,733
Total downloads:591,190
Favorites:456
MD5:
6.1.5
LibMediaProvider  Popular! (More than 5000 hits)
Version: 1.0 r15
by: psypanda, ArtOfShred, Seerah
LibMediaProvider is inspired by and borrows from LibSharedMedia-3.0, written for World of Warcraft.

This library facilitates the sharing of media (fonts, textures, etc) between addons. An addon can register media with LibMediaProvider, which then turns around and provides that media to any addon requesting media of that type.

LibMediaProvider is also available on GitHub.

Things To Know:
  • The "None" option for borders/backgrounds was removed, as ESO displays a white default texture if no file path is provided. Addons should handle hiding borders/backgrounds on their own through the alpha channel.
  • ESO currently does not support addon custom sounds to the game. Some sounds from the default UI have been provided as choices for your addons to use.
  • Label:SetFont("font") may be used with more than just a pre-defined font from the default UI. It may also take a string that is a combination of a file path, font size, and font style.
    Ex: label:SetFont("MyAddon/Font/path.ttf|18|soft-shadow-thin")
  • There is currently only one statusbar texture in the game. If you wish to have access to more, they must be provided and registered by an addon.
  • Currently supported media types: background, border, font, statusbar, sound
API Documentation:

:Register(mediatype, key, data)
Registers a new handle of given type.
Arguments
mediatype
string - the type of the data, eg. font or statusbar
key
string - the handle to get the data from the lib
data
string - the data to associate with the handle; normaly a filename
Returns
boolean - false if data for the given mediatype-key pair already existes, true else
:Fetch(mediatype, key)
Fetches the data for the given handle and type.
Arguments
mediatype
string - the type of the data, eg. font or statusbar
key
string - the handle to get the data from the lib
Returns
string or nil - the data for the given handle or nil
:IsValid(mediatype [, key])
Checks if the given type (and handle) is valid.
Arguments
mediatype
string - the type of the data, eg. font or statusbar
[key]
string - the handle of the data
Returns
boolean - true if the type (and handle) is valid
:HashTable(mediatype)
Gets a hash table {data -> handle} to eg. iterate over.
Arguments
mediatype
string - the type of the data, eg. font or statusbar
Returns
table - hash table for the given type
:List(mediatype)
Gets a sorted list of handles.
Arguments
mediatype
string - the type of the data, eg. font or statusbar
Returns
table - list of handles for the given type
:GetDefault(mediatype)
Returns the default return value for nonexistant handles.
Arguments
mediatype
string - the type of the data, eg. font or statusbar
Returns
string or nil - default return value for nonexistant handles for the given type
:SetDefault(type, handle)
Sets a default return value for nonexistant handles. Won't replace an already set default.
Arguments
type
string - the type of the data, eg. font or statusbar
handle
string - the handle of the data
Returns
none
Callback:

LibMediaProvider_Registered
fires when a new handle was successfully registered
Argumentss
name
"LibSharedMedia_Registered"
mediatype
the type of the new handle
key
the name of the handle
Predefined Data:
Media from the default UI of the 5 main types is already pre-registered with the library.
1.0 r15
- Updated API version for Stonethorn.

1.0 r14
- Updated the font media table to properly support backup fonts for languages with missing glyphs not included in Western fonts, thanks to the efforts of Calamath!

1.0 r13
- LMP now functions without LibStub but supports loading in with LibStub for compatibility.
- LMP no longer includes an embedded LibStub. For older addons that may still require LibStub you will have to manually download it.

1.0 r12
- Embedded LibStub for dependency
- LMP wasn't working without LibStub so no longer creates an empty table if LibStub is not loaded

1.0 r11
- Fix nested folders on zip creating (oopsie)

1.0 r10
- LibMediaProvider works now with and w/o LibStub

1.0 r9
- updated API version number to 100027
- added IsLibrary directive to manifest
- added global variable "LibMediaProvider" for direct access without using LibStub

1.0 r8
- updated API Version number to 100011
- updated fonts for patch 1.6

1.0 r7
- updated API Version number to 100010
- removed fonts that are no longer contained in the game files (they have been added to the MediaStash addon, however)
- changed default font from Arial Narrow (removed) to Univers 55

1.0 r6
- preserve externally registered media types through library upgrades

1.0 r5
- preserve externally registered media through library upgrades

1.0 r4
- changed file path for solid textures to "" (since ESO treats an empty path as a solid color)
- updated LibStub.lua

1.0 r3
- fixed bug where default handle was not returned if handle provided in :Fetch() was not found

1.0 r2
- changed the default for backgrounds and borders since I removed the "none" option
Archived Files (14)
File Name
Version
Size
Uploader
Date
1.0 r14
15kB
ArtOfShred
05/19/20 08:19 PM
1.0 r13
14kB
ArtOfShred
03/03/20 05:45 PM
1.0 r12
4kB
ArtOfShred
05/21/19 05:49 AM
1.0 r11
3kB
psypanda
05/20/19 01:30 AM
1.0 r10
3kB
psypanda
05/19/19 03:49 PM
1.0 r9
4kB
psypanda
05/02/19 03:58 PM
1.0 r8
4kB
Garkin
02/23/15 08:41 PM
1.0 r7
4kB
Seerah
11/06/14 11:13 PM
1.0 r6
4kB
Seerah
07/20/14 08:02 PM
1.0 r5
4kB
Seerah
07/17/14 08:49 PM
1.0 r4
4kB
Seerah
07/13/14 09:26 PM
1.0 r3
4kB
Seerah
03/15/14 01:29 PM
1.0 r2
4kB
Seerah
03/14/14 07:26 PM
1.0 r1
4kB
Seerah
03/13/14 10:38 PM


Post A Reply Comment Options
Unread 05/19/20, 08:22 PM  
ArtOfShred
 
ArtOfShred's Avatar
AddOn Author - Click to view AddOns

Forum posts: 99
File comments: 736
Uploads: 2
Re: Improvements to support the backup font feature

Originally Posted by Calamath
Hi, this is Calamath.
Before making a pull request, I'll post this for improvements to support the new backup fonts feature.

>Backup Font
It is the function to specify the fallback font file in GuiXML for each font, introduced in update 25.
In other words, it is a function to search for missing glyphs not included in Western fonts from another file.

Unfortunately, the behavior of fallback fonts has changed since update 25, and the default fallback font is gone.
At least if you specify a font filename with SetFont method, the fallback font feature doesn't seem to work properly.

Therefore, some add-ons using LibMediaProvider have a problem that localized Japanese text is not displayed correctly in Japanese language mode.
This is a niche issue, but I wanted to solve it so that it would not affect users who only use Western fonts.

so, I forked recent version and made a patch on my github repository.
I would be happy if you could check it in your spare time.


[modifiation details]
I modified the font media table of LibMediaProvider and defined a font string like '$(MEDIUM_FONT)' for western font files embedded in ESO.
This is because the backup font cannot be directly linked to the font filename at this time.

In the patched version, the optional definitions of backup fonts will only be loaded in two language modes, jp and ru.
Therefore, there are no operational changes to the en, de, and fr language modes, I think.

- Calamath
Thanks for your efforts!

I never noticed you posted on here too. I had originally decided I was just going to wait for Greymoor to push an update, but there's absolutely no reason not to just add the API version in there and release it now.

Updated to revision 14!
Last edited by ArtOfShred : 05/19/20 at 08:23 PM.
Report comment to moderator  
Reply With Quote
Unread 04/27/20, 03:58 AM  
Calamath
AddOn Author - Click to view AddOns

Forum posts: 6
File comments: 33
Uploads: 3
Improvements to support the backup font feature

Hi, this is Calamath.
Before making a pull request, I'll post this for improvements to support the new backup fonts feature.

>Backup Font
It is the function to specify the fallback font file in GuiXML for each font, introduced in update 25.
In other words, it is a function to search for missing glyphs not included in Western fonts from another file.

Unfortunately, the behavior of fallback fonts has changed since update 25, and the default fallback font is gone.
At least if you specify a font filename with SetFont method, the fallback font feature doesn't seem to work properly.

Therefore, some add-ons using LibMediaProvider have a problem that localized Japanese text is not displayed correctly in Japanese language mode.
This is a niche issue, but I wanted to solve it so that it would not affect users who only use Western fonts.

so, I forked recent version and made a patch on my github repository.
I would be happy if you could check it in your spare time.


[modifiation details]
I modified the font media table of LibMediaProvider and defined a font string like '$(MEDIUM_FONT)' for western font files embedded in ESO.
This is because the backup font cannot be directly linked to the font filename at this time.

In the patched version, the optional definitions of backup fonts will only be loaded in two language modes, jp and ru.
Therefore, there are no operational changes to the en, de, and fr language modes, I think.

- Calamath
Report comment to moderator  
Reply With Quote
Unread 03/03/20, 05:47 PM  
ArtOfShred
 
ArtOfShred's Avatar
AddOn Author - Click to view AddOns

Forum posts: 99
File comments: 736
Uploads: 2
Updated to revision 13. This removes the embedded LibStub and allows LMP to function without LibStub.

Loading in with LibStub is still supported if it is enabled in order to provide backwards compatibility for older addons.
Report comment to moderator  
Reply With Quote
Unread 12/30/19, 05:10 PM  
Edorenel
 
Edorenel's Avatar

Forum posts: 0
File comments: 10
Uploads: 0
I'm uncertain about the workings of add-ons and libraries. So, forgive me for my noob question. *Blushes* But will this add-on update to The Elder Scrolls Online v5.2.11 (or 5.2.5, according to some of the current, most popular add-ons)?
__________________
“Tomorrow may be hell, but today was a good writing day, and on the good writing days nothing else matters.” - Neil Gaiman


Like my writings? Support me on Ko-Fi!
Website: Edorenel
Report comment to moderator  
Reply With Quote
Unread 09/30/19, 03:36 AM  
Baertram
 
Baertram's Avatar
AddOn Author - Click to view AddOns

Forum posts: 3088
File comments: 3715
Uploads: 63
But you could prepare it for this already today?
Hybrid version without and with LibStub.
You can even ship LibStub with it but it currently ONLY loads with LibStub.

Why not do it like this already today and you are automatically set for the future, and ppl who do not want to use LibStub anymore are not forced to use it?

And defintaley a NO GO (at least for other libraries): Do not load libraries hardcoded from your txt file but let them use their own txt file!
-Reason is described here-

Include LibStub in the library here BUT include the total LibStub with it's own LibStub.ttx file so it will be loaded ingame properly and all other addons can benefit from it please.

Where LibStub shouldn't be a problem if loaded like this as it will be gone one day, but even this lib could need an update before this happens , which could break the addons then as it got no own ## AddOnVersion: tag and own txt file in this library here.

TXT manifest file:
Code:
## Title: LibMediaProvider-1.0
## Author: Seerah
## Version: 1.0 r13
## APIVersion: 100028 100029
## AddOnVersion: 13
## IsLibrary: true
## OptionalDependsOn: LibStub
## Description: Facilitates shared media between addons.  Inspired by and borrowed from LibSharedMedia World of Warcraft.

# This Add-on is not created by, affiliated with or sponsored by ZeniMax Media Inc. or its affiliates.
# The Elder Scrolls® and related logos are registered trademarks or trademarks of ZeniMax Media Inc. in the United States and/or other countries.
# All rights reserved
#
# You can read the full terms at https://account.elderscrollsonline.com/add-on-terms

LibMediaProvider-1.0\LibMediaProvider-1.0.lua

Lua Code:
  1. --LibMediaProvider-1.0 is inspired by and borrows from LibSharedMedia-3.0 for World of Warcraft by Elkano
  2. --LibSharedMedia-3.0 and LibMediaProvider-1.0 are under the LGPL-2.1 license
  3.  
  4. --Register LMP with LibStub
  5. local MAJOR, MINOR = "LibMediaProvider-1.0", 12
  6. local LMP, oldminor
  7. if LibStub then
  8.     LMP, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
  9. else
  10.     LMP = {}
  11. end
  12. if not LMP then return end --the same or newer version of this lib is already loaded into memory
  13. LibMediaProvider = LMP

That's all you should need to make it hybrid and support all cases properly today already.
Last edited by Baertram : 10/01/19 at 10:15 AM.
Report comment to moderator  
Reply With Quote
Unread 09/23/19, 04:32 PM  
ArtOfShred
 
ArtOfShred's Avatar
AddOn Author - Click to view AddOns

Forum posts: 99
File comments: 736
Uploads: 2
Re: Re: Re: Directory structure is screwy

Originally Posted by Baertram
Why is this lib not working properly without LibStub?
There should be a way to make it compatible with and without LibStub, isn't it?
We were waiting for sirinsidiator to remove LibStub support from LAM before making this move. Once LAM makes that move a lot of old addons will break and it will be the ideal time to force everyone to update everything. That's why the embedded LibStub is still used.
Last edited by ArtOfShred : 09/23/19 at 04:41 PM.
Report comment to moderator  
Reply With Quote
Unread 09/22/19, 06:56 AM  
Baertram
 
Baertram's Avatar
AddOn Author - Click to view AddOns

Forum posts: 3088
File comments: 3715
Uploads: 63
Re: Re: Directory structure is screwy

Why is this lib not working properly without LibStub?
There should be a way to make it compatible with and without LibStub, isn't it?
Report comment to moderator  
Reply With Quote
Unread 05/20/19, 01:26 AM  
psypanda
AddOn Author - Click to view AddOns

Forum posts: 2
File comments: 11
Uploads: 0
Re: Directory structure is screwy

Originally Posted by AssemblerManiac
Main folder in the zip is listed as being LibMediaProvider-1.0r10, which is empty of files, with LibMediaProvider-1.0 as a directory under it.

Was this intentional?
Ah damn seems like I nested the folders by accident while creating the zip.
I'll fix this asap. Sorry for the inconvenience.
Report comment to moderator  
Reply With Quote
Unread 05/19/19, 11:09 PM  
AssemblerManiac
AddOn Author - Click to view AddOns

Forum posts: 51
File comments: 313
Uploads: 1
Directory structure is screwy

Main folder in the zip is listed as being LibMediaProvider-1.0r10, which is empty of files, with LibMediaProvider-1.0 as a directory under it.

Was this intentional?
Report comment to moderator  
Reply With Quote
Unread 02/06/17, 02:48 PM  
Imiona
 
Imiona's Avatar

Forum posts: 11
File comments: 45
Uploads: 0
Is it possible to register my own custom Fonts with this, and if so, how do i get Addons to use it?

Thx
Report comment to moderator  
Reply With Quote
Unread 02/23/15, 08:54 PM  
Garkin
 
Garkin's Avatar
AddOn Author - Click to view AddOns

Forum posts: 853
File comments: 1120
Uploads: 33
LibMediaProvider-1.0 r8

Even if patch 1.6 is not on live server yet, I have updated this library in advance. Actually there was just one small change - all Futura fonts were replaced with different font files which includes previously unsupported special characters (for example ñ). As those new font files doesn't exist in 1.5 game files, I do not recommend using r8 with patch 1.5.
__________________
@Garkin (retired from ESO)
My addons: SkyShards, LoreBooks, Dustman, Map Coordinates, No, thank you!, ... (full list)
Report comment to moderator  
Reply With Quote
Unread 08/23/14, 10:11 PM  
skyraker
AddOn Author - Click to view AddOns

Forum posts: 154
File comments: 129
Uploads: 4
Originally Posted by Garkin
Only reason I can imagine is that you use old version of LMP and register font before library is updated. There was an issue where all registered media files were removed when library was updated.
To avoid this issue update LMP to the latest version and/or make sure that you do not register media types before library is fully updated. It means from EVENT_ADD_ON_LOADED handler or later.
Can't believe I hadn't updated it. Thanks!
Report comment to moderator  
Reply With Quote
Unread 08/17/14, 09:27 AM  
Garkin
 
Garkin's Avatar
AddOn Author - Click to view AddOns

Forum posts: 853
File comments: 1120
Uploads: 33
Originally Posted by skyraker
Would there be any reason why LMP (or the game) would stop displaying a monospaced font properly? When I first added the font to my addon, it was displaying properly monospaced. But I do not know if a game update changed that or if it something with how LMP interacts with the UI.
Only reason I can imagine is that you use old version of LMP and register font before library is updated. There was an issue where all registered media files were removed when library was updated.
To avoid this issue update LMP to the latest version and/or make sure that you do not register media types before library is fully updated. It means from EVENT_ADD_ON_LOADED handler or later.
__________________
@Garkin (retired from ESO)
My addons: SkyShards, LoreBooks, Dustman, Map Coordinates, No, thank you!, ... (full list)
Report comment to moderator  
Reply With Quote
Unread 08/17/14, 08:33 AM  
skyraker
AddOn Author - Click to view AddOns

Forum posts: 154
File comments: 129
Uploads: 4
Would there be any reason why LMP (or the game) would stop displaying a monospaced font properly? When I first added the font to my addon, it was displaying properly monospaced. But I do not know if a game update changed that or if it something with how LMP interacts with the UI.
Report comment to moderator  
Reply With Quote
Unread 06/03/14, 11:48 AM  
Kraeius
 
Kraeius's Avatar
AddOn Author - Click to view AddOns

Forum posts: 25
File comments: 248
Uploads: 3
Originally Posted by Seerah
Okay, so LibMediaProvider is just a library that uses LibStub. It is quite possible that the copy of the library you are editing is not even the copy of the library being loaded into memory.

You shouldn't edit the library itself. You need to use the API to register a font. That, or use LMP MediaStash.

/edit: Sorry I didn't get that right away...
OK I get it now, thank you for your time
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: