# Generate playlist Genres ?!?

**URL:** https://community.mp3tag.de/t/generate-playlist-genres/16518
**Category:** Export
**Created:** [January 18, 2015, 2:06pm UTC](https://community.mp3tag.de/t/generate-playlist-genres/16518 "2015-01-18T14:06:42Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![pierrotori](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/85e7bf/32.png) [@pierrotori](https://community.mp3tag.de/u/pierrotori)
#### Post date: [January 18, 2015, 2:06pm UTC](https://community.mp3tag.de/t/generate-playlist-genres/16518/1 "2015-01-18T14:06:42Z")

</div>

Hi all,  
i have a lot of mp3 directories , i try to generate the genre playlist with the script

$filename(%genre%.m3u)#EXTM3U  
$loop(%genre%)#EXTINF:%\_length\_seconds%,%track% - %title%  
%\_filename\_rel%  
$loopend()

I have as genre (see the screen) "Blues", "Dance", "Dance, Club, House" Divers", "Jazz"

When i execute the export if the order by of the list is **"Jazz", Divers", "Dance, Club, House", "Dance","Blues"**  
I have two playlists **Jazz and Divers**

When i execute the export if the order by of the list is **"Blues", "Dance", "Dance, Club, House", Divers",  
"Jazz"**  
 I have two playlists **Jazz and Blues**

i have two problems  
the first : the field content "Dance, Club, House" stop the process  
the second , can i update the order by in the script ?

Thanks  
Pierrotori

![](https://community.mp3tag.de/uploads/default/original/2X/b/b10326c216dd68914e22aa038d2290715d640460.JPG)

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [January 18, 2015, 2:51pm UTC](https://community.mp3tag.de/t/generate-playlist-genres/16518/2 "2015-01-18T14:51:13Z")

</div>

> [@pierrotori](#):
>
> ...  
> the second , can i update the order by in the script ?
> 
> Thanks  
> Pierrotori

You might want to clean up the $loop() with  
$loop($replace(%genre%,',',\_))#EXTINF

as I am not sure if the commas in the genre upset the sorting.

Also, you should take care that the track number does not contain the total tracks data as this produces a slash, e.g. 2/18 which might upset the search for a file.  
If this cannot be avoided, use the $num() function.
