jonniek / mpv-playlistmanager

Mpv lua script to create and manage playlists
The Unlicense
537 stars 42 forks source link

Magnet links handling #138

Open yyakko opened 5 months ago

yyakko commented 5 months ago

Hello. Thank you for the great script.

I am trying to modify it slightly so that it handles magnet-links same way as http/https and other protocols. I added the following condition to the is_protocol function:

... or path:match('^magnet:[^%s]+') ~= nil)

And it works for the "stripfilename" function. But the following problem remains: if I add a magnet-link to playlist, save playlist to file, close mpv and open it again, the script adds path of current working directory to the beginning of the link, e.g. ... .config/mpv/watch_later/magnet:? ..., if the current file has been opened before, or /home/user/magnet:? ..., if the file is played for the first time.

If it is important, the operating system is Debian 12.

jonniek commented 1 month ago

Seems like the is_protocol should fix it. Is it writing the wrong path into the m3u file?