Manually create a playlist - Criar uma playlist manualmente (Linux)

Hey there. Here is a step-by-step guide for those who are struggling to create their non supported playlists in Linux, like the Dreamcast playlist, for example.

I’m using Retroarch 1.7.5 and right click does not work on Desktop Menu to add a game to a new playlist. If that is your case or if you want to do things faster, follow these steps:

Open a terminal window and use the command find to list all the folders inside your Dreamcast ISOs directory filtering the CDI and GDI extensions in those absolute paths and store in a new text file:

find ./ $(pwd) | grep -i '\.cdi\|\.gdi' > games-absolute-path.txt

The text file content will be something like this:

./Dreamcast-Games/Beats of Rage Collection - v1/Borcollection1.cdi

./Dreamcast-Games/Beats of Rage Collection - v2/Borcollection2.cdi

./Dreamcast-Games/Beats of Rage Collection - v3/Borcollection3.cdi

/home/user/Dreamcast-Games/Beats of Rage Collection - v1/Borcollection1.cdi

/home/user/Dreamcast-Games/Beats of Rage Collection - v2/Borcollection2.cdi

/home/user/Dreamcast-Games/Beats of Rage Collection - v3/Borcollection3.cdi

As you can see, the text file will store two lists: The first one shows the relative path, the latter one, the absolute path. Open this file in a text editor and remove the first list manually. Save and close.

Now, use the find again to create the games list without the file path or extensions. This list will not store duplicated entries like the first one. Type this:

find ./ -type f -printf '%f\n'| grep -i '\.cdi\|\.gdi' | sed 's/\.[^.]*$//' > games-titles.txt

This is how the content of games-titles.txt should look like:

Borcollection1

Borcollection2

Borcollection3

First tricky part: You must merge those two text files intercalating their lines. For that you use the paste command. Type this:

paste -d"\n" games-absolute-path.txt games-titles.txt > games-path-titles.txt

The new file, games-path-titles, shoud a content similar to this:

/home/user/Dreamcast-Games/Beats of Rage Collection - v1/Borcollection1.cdi

Borcollection1

/home/user/Dreamcast-Games/Beats of Rage Collection - v1/Borcollection2.cdi

Borcollection2

/home/user/Dreamcast-Games/Beats of Rage Collection - v1/Borcollection3.cdi

Borcollection3

Now use awk to insert the information about cores, crc and playlist every two lines in the new file:

awk '1;!(NR%2){print "DETECT\nDETECT\n0|CRC\nSega - Dreamcast.lpl";}' games-path-titles.txt > 'Sega - Dreamcast.lpl'

The file “Sega - Dreamcast.lpl” should look like this:

/home/user/Dreamcast-Games/Beats of Rage Collection - v1/Borcollection1.cdi

Borcollection1

DETECT

DETECT

0|CRC

Sega - Dreamcast.lpl

/home/user/Dreamcast-Games/Beats of Rage Collection - v1/Borcollection2.cdi

Borcollection2

DETECT

DETECT

0|CRC

Sega - Dreamcast.lpl

/home/user/Dreamcast-Games/Beats of Rage Collection - v1/Borcollection3.cdi

Borcollection3

DETECT

DETECT

0|CRC

Sega - Dreamcast.lpl

Copy or move the file Sega - Dreamcast.lpl to your playlist folder, in my case ~/.config/retroarch/playlists .

You’re set.

PS: I couldn’t get rid of the line breaks in this post, but your file will not store any of those.


Same post in portuguese, just in case:

Estou utilizando o Retroarch 1.7.5 e o click com o botão direito do mouse não funciona no Desktop Menu para adicionar jogos à playlist . Se este é o seu caso ou você quer criar sua playlist de forma mais rápida, siga estes passos:

Abra uma janela do terminal e utilize o comando para varrer suas pastas de Dreamcast filtrando as extensões CDI e GDI e armazendo o caminho absoluto de cada imagem num arquivo texto:

find ./ $(pwd) | grep -i '\.cdi\|\.gdi' > jogos-caminho-absoluto.txt

O conteúdo do seu arquivo texto deve ser parecido com isso:

./Dreamcast-Games/Beats of Rage Collection - v1/Borcollection1.cdi

./Dreamcast-Games/Beats of Rage Collection - v2/Borcollection2.cdi

./Dreamcast-Games/Beats of Rage Collection - v3/Borcollection3.cdi

/home/user/Dreamcast-Games/Beats of Rage Collection - v1/Borcollection1.cdi

/home/user/Dreamcast-Games/Beats of Rage Collection - v2/Borcollection2.cdi

/home/user/Dreamcast-Games/Beats of Rage Collection - v3/Borcollection3.cdi

Como você pode reparar, a lista está duplicada. A primeira contém o caminho relativo para o arquivo, a outra o caminho absoluto. Abra o arquivo texto num editor e remova a primeira parte da lista, que contém os caminhos relativos. Salve e feche.

Agora utilize o comando find novamente para criar uma nova lista sem os caminhos ou extensão dos arquivos. Esta listagem não sairá duplicada como a primeira. Digite:

find ./ -type f -printf '%f\n'| grep -i '\.cdi\|\.gdi' | sed 's/\.[^.]*$//' > jogos-titulos.txt

O conteúdo de jogos-titulos.txt deve ser similar ao visto abaixo:

Borcollection1

Borcollection2

Borcollection3

Primeira parte mais complicada. Você precisa mesclar as listas contidas nos dois arquivos intercalando as linhas. Para isso use o comando paste. Digite:

paste -d"\n" jogos-caminho-absoluto.txt jogos-titulos.txt > jogos-caminho-titulos.txt

O conteúdo de jogos-caminho-titulos.txt deve ser mais ou menos assim:

/home/user/Dreamcast-Games/Beats of Rage Collection - v1/Borcollection1.cdi

Borcollection1

/home/user/Dreamcast-Games/Beats of Rage Collection - v1/Borcollection2.cdi

Borcollection2

/home/user/Dreamcast-Games/Beats of Rage Collection - v1/Borcollection3.cdi

Borcollection3

Agora utilize o comando awk para inserir a informação referente aos cores, crc e playlist a cada duas linhas do novo arquivo texto:

awk '1;!(NR%2){print "DETECT\nDETECT\n0|CRC\nSega - Dreamcast.lpl";}' jogos-caminho-titulos.txt > 'Sega - Dreamcast.lpl'

O arquivo “Sega - Dreamcast.lpl” deve ficar mais ou menos assim:

/home/user/Dreamcast-Games/Beats of Rage Collection - v1/Borcollection1.cdi

Borcollection1

DETECT

DETECT

0|CRC

Sega - Dreamcast.lpl

/home/user/Dreamcast-Games/Beats of Rage Collection - v1/Borcollection2.cdi

Borcollection2

DETECT

DETECT

0|CRC

Sega - Dreamcast.lpl

/home/user/Dreamcast-Games/Beats of Rage Collection - v1/Borcollection3.cdi

Borcollection3

DETECT

DETECT

0|CRC

Sega - Dreamcast.lpl

Copie ou mova o arquivo Sega - Dreamcast.lpl para sua pasta de playlists, no meu caso ~/.config/retroarch/playlists.

Feito.

PS: Não consegui postar sem o pulo de linhas, mas os arquivos texto não terão nenhum.

I hope it helps! Espero que ajude!

1 Like

muito bom. valeu pela dica.