Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check existence of media file #10389

Open
Bastrabun opened this issue Sep 14, 2020 · 6 comments
Open

check existence of media file #10389

Bastrabun opened this issue Sep 14, 2020 · 6 comments
Labels
Feature request Issues that request the addition or enhancement of a feature @ Script API

Comments

@Bastrabun
Copy link

Problem

Currently there is no way to see whether a texture, sound or other media file is available to the server. There is dynamic_add_media which indicates duplicates as "error", but that's about it.

Solutions

Similar to the registered definition tables like minetest.registered_items we could have a minetest.registered_media which holds at least the name, even better the path

Alternatives

One could try to create such an index by going over all mods and worldmods and scrape the media files from there or use dynamic_add_media to check the presence and guess that "errorr" means the file in question is already present.

@Bastrabun Bastrabun added the Feature request Issues that request the addition or enhancement of a feature label Sep 14, 2020
@sfan5
Copy link
Member

sfan5 commented Sep 14, 2020

Media collection currently runs after all mods were loaded, but I assume you'd want to query the existence of a media file at mod load time, is that correct?

@pyrollo
Copy link
Contributor

pyrollo commented Sep 14, 2020

Media collection currently runs after all mods were loaded

Interesting, is there any technical constraints doing it so ? Lua code execution during load time is not creating any media files IIRC. So I guess it would be possible to change that order.

@rubenwardy
Copy link
Member

Lua code execution could make media files

@Bastrabun
Copy link
Author

My current use case is that my quest creators need to attach textures onto a bunch of entities. But because there are so many textures, I do not want to use a dropdown list. I want them to insert a string into a normal text field, then search among the known media for a fitting texture. When there's none, they'll upload it by providing a URL string. After it got uploaded, I'd like it be findable, too. Since it goes into a worldmod folder, it will be available next time the server starts, but until then it needs to be added to some list.

This way, among other uses, I'd like to avoid the gnarly "Texture does not exist! Will create dummy texture!!" message shown to players.

@rubenwardy
Copy link
Member

You can use get_dir_list to list files in a directory

@sorcerykid
Copy link
Contributor

I'm curious, are there mods that currently generate media files on the fly? I wasn't aware that this was possible. Is it documented somewhere?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature request Issues that request the addition or enhancement of a feature @ Script API
Projects
None yet
Development

No branches or pull requests

5 participants