Author Topic: Artwork-files - change filename with regular expression  (Read 809 times)

Alsvartr

  • Newbie
  • *
  • Posts: 1
    • View Profile
Artwork-files - change filename with regular expression
« on: October 30, 2017, 07:06:45 AM »
Hello everybody,

is it possible that the file name of an artwork-file (for example video-snap) could be overwritten BEFORE the video is loaded?

Thus, it would be possible to remove everything that comes after the first parenthesis to make the content files uniform.
This would help in particular with multilanguage roms and tagging.


For example, the german and english version of Zelda
Legend of Zelda, The - A Link to the Past (Germany).mp4
Legend of Zelda, The - A Link to the Past (English).mp4

could be
Legend of Zelda, The - A Link to the Past.mp4


As a result, the compressed multilanguage rom file could be renamed without renaming the artwork-files.
You could still install a switch on a theme, whether the regular expression is active or not.



The function of reading the current file name as well as changing it with an regular expression is already done.
However, I can not make it that Atttract-Mode changes the filename before the loading of the artwork.
AM always reads the default filename before using my regexed filename.

Have tried it with Transition.EndNavigation, .ToNewSelection and .ToNewList , but without success.


Would be nice if someone could help.

Thank you very much

Regards
Alsvartr

8bitsdeep

  • Full Member
  • ***
  • Posts: 49
    • View Profile
Re: Artwork-files - change filename with regular expression
« Reply #1 on: November 11, 2017, 11:21:51 AM »
You should be able to do this if you use add_image instead of add_artwork. You just have to manually update the file_name for add_image since it's not automatic like add_artwork.

Something like this:
Code: [Select]
local video = fe.add_image("", 0, 0, 320, 240);

fe.add_transition_callback( "my_transition" );
function my_transition( ttype, var, ttime )
{
    local art_path = fe.get_art("snap");

    process_filename( art_path ); //strip out everything after first parenthesis or whatever you want to do

    video.file_path = art_path;
}