Thank you! I'm a fan of the app for months now. The "Car Production Year Based" option is a great benefit for immersion.
In my specific case, however, it's not really a solution, because:
Let's say I want to race the "Nissan Fairlady Z 'Akuma no Zetto'" from the anime series "Wangan Midnight".
I want to listen to suitable 1990s/2000s music, but as the car has the production date "1969", only 1960s music would be played.
The same applies to over 1000 affected cars that were built in a different decade, but have been modified with modern technology (and "require" modern music).
Changing every car e.g. from "1969" to "1990" would not be an option for me (with over 2200 cars in total).
In my case, however, all the cars in question are assigned with appropriate TAGs (in the "ui_car.json"), like "-Wangan_Midnight" or "-Initial_D", and so on.
If your player queries the year of manufacture, can't it also read TAGS, or at least "brand", "name", "class"?
I've spent the last few hours renaming an mp3 music file with the TAG #-Wangan_Midnight, and then modifying the "DynamicMusicPlayer.lua" by first inserting the TAG at "local trimmedWords = {" (from line 485). Then I played around (from line 681) with those lines:
local carProductionYear = ac.getCar(ac.getSim().focusedCar).year
if string.find(filename, "#YearMin1900") and carProductionYear <= 1900 or
...
I tried to replace e.g. "year" with other terms, like "tag", or "tags". Unfortunately, nothing worked so far... Do you have any ideas? I think that many in the AC community could benefit from this!
but i'm not sure if it returns a table of tags, or a long string with all tags listed.
you can check it by running ac.log(ac.getCarTags(0)) and looking into Lua Debug app.
I thought about adding car tags into options but I couldn't figure out a way to do it without false positives... maybe make it so it's #CarTag-whatever... Will see. It's certainly a good idea.
Something you could do, is put the specific music in additional folder (You can create extra folders in the Music folder and the app won't mind), and then add that extra folder into playlists in ExternalMusicPaths file under an 'if' condition. I've recently explained how to do that in the Discussions here. https://www.overtake.gg/threads/dynamic-music-player.266290/post-3797911
If you need any more help you can find me on Discord under `damgam` nickname, or ask questions in the Discussions here. I'm happy to help.