I have set up a mediatomb-server on my ubuntu machine and bought my little daugher an audio renderer for christmas. She wants to listen her audio dramas when going to bed.
Basically it works fine, but there is one issue left:
I have a lot of music mp3 and the audio dramas of my daughter get lost in the standard "Audio" tree. I read that you can customize the media tree to your own needs with some scripting. Sadly I'm not really experienced with that. So maybe anyone could give me a hand...
What I'm thinking about is a tree called "Audio Drama" and another called "Music" instead of the standard "Audio" tree.
If a mp3 has a certain genre (e.g. "children" or "drama") then it should be assigned to the "Audio drama" tree. All other mp3s are assigned to the "Music" tree.
Finally it would be nice, if the "Audio drama" tree is partitioned a slightly different as usual. Instead of "artist" and "album", what is still fine for the "music" tree, it would be better to have something like "serial" and "episode". Of course these information are stored in the mp3 tags.
If anyone has a script, that can do what I have described, it would be great if he wants to share.
What you want is not difficult to do, however your vision is so specific that I doubt that you will find an existing script for it.
Please have a look at the scripting documentation, it gives a very detailed explanation on the default import script, after reading it you should be able to understand the basics and adapt the script to fit your needs, you don't need to be a JS expert to do it.
I can help you if you get stuck or have questions, but I will not do it for you :>
As a first hint, you probably want something similar in the addAudio() function:
if ((genre == 'drama') || ((genre == 'children'))
// create the custom chain and add the object to it
And don't forget to enable js layout in config.xml
thanks for your offer and for your first hint. I think I have an idea now how it should work.
I started with renaming the "Audio" chain in "Musik" chain and also translated some expressions like 'Artist', 'Year', ... to german. It works like expected, except one thing:
There is still one mp3 which will not appear withing the 'Musik' chain. Instead it will still appear within the outdated "Audio" chain in the web frontend.
This must be some refresh/rescan-issue. Can you point me to the right direction, why this is happening?
First of all, if you want to apply the scripting changes you need to remove old items from the database, the important thing there is to use the "linked remove" function (that's the X icon with the chains).
If you did that and if you really replaced all 'Audio' strings in the chain arrays - then this should never happen :)
If you still have both containers in your script (i.e. part of the stuff goes to 'Audio' and part of it to 'Musik'), then you should have a closer look on the tags of that particular song (i.e., maybe your if clause is not working because the data you get is something that is not expected).
You can use the print function in the scripts to debug them.
You were right. It was really a easy job to do. Mediatomb now serves a music and a separate drama chain :-)
Thanks again for your support!