arma7x / kaimusic

KaiOS music player
MIT License
35 stars 6 forks source link

Kaimusic does recognize .m3u playlist files #7

Closed helotbc closed 2 years ago

helotbc commented 3 years ago

I have an Alcatel Flip 3 running KaiOS 2.5.2. The kaimusic app doesn't recognize the .m3u playlist files on the SD card. Can this feature be added?

Thanks, Brendan

arma7x commented 3 years ago

K-Music v1.1.0 support folder playlist. You can organize songs by using folder.

helotbc commented 3 years ago

Ahmad, You didn't address my question. Does the app support .m3u files? Can this be added as a feature? I find it easier to create the playlist on my computer and save the file on to the SD chip. On Tue, 2021-01-12 at 13:36 -0800, Ahmad Malik wrote:

Closed #7.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. --

Thanks,

Brendan Carroll 617.794.8801

arma7x commented 3 years ago
helotbc commented 3 years ago

I have attached an .m3u file. I hope it helps. On Tue, 2021-01-12 at 22:07 -0800, Ahmad Malik wrote:

Not support m3u i need to understand how m3u works before adding this features to k- music

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. --

Thanks,

Brendan Carroll 617.794.8801

cyan-2048 commented 2 years ago

I have attached an .m3u file. I hope it helps. On Tue, 2021-01-12 at 22:07 -0800, Ahmad Malik wrote: Not support m3u i need to understand how m3u works before adding this features to k- music — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. -- Thanks, Brendan Carroll 617.794.8801

where is the .m3u file provided? i cannot find it in this github issue.... I am making a music player and would like to understand how m3u works... Only "reliable" examples i could find is from wikipedia....

arma7x commented 2 years ago

@cyan-2048 can you create M3U playlist using your computer. Below is mine on lubuntu, audacious, mtp mode. But i can't save the M3U file on mtp mode

file:///run/user/1000/gvfs/mtp%3Ahost%3D%255Busb%253A002%252C005%255D/Internal%20Storage/Musics/test2/ALAC_test.alac.m4a
file:///run/user/1000/gvfs/mtp%3Ahost%3D%255Busb%253A002%252C005%255D/Internal%20Storage/Musics/test2/FLA_test.flac
file:///run/user/1000/gvfs/mtp%3Ahost%3D%255Busb%253A002%252C005%255D/Internal%20Storage/Musics/test2/M4A_test.m4a
file:///run/user/1000/gvfs/mtp%3Ahost%3D%255Busb%253A002%252C005%255D/Internal%20Storage/Musics/test2/MP3_test.mp3
file:///run/user/1000/gvfs/mtp%3Ahost%3D%255Busb%253A002%252C005%255D/Internal%20Storage/Musics/test2/MP4_audio.m4a
file:///run/user/1000/gvfs/mtp%3Ahost%3D%255Busb%253A002%252C005%255D/Internal%20Storage/Musics/test2/WAV_test.wav
file:///run/user/1000/gvfs/mtp%3Ahost%3D%255Busb%253A002%252C005%255D/Internal%20Storage/Musics/test2/WMA_test.wma
arma7x commented 2 years ago

https://medium.com/@morgan.dev.ops.it/playlist-compatibility-how-to-get-your-music-playlist-from-one-platform-to-another-951422536971

cyan-2048 commented 2 years ago

i don't know how to make m3u files... i don't use it at all.....

helotbc commented 2 years ago

Guys, I've used the Clementine app to create .m3u files. One trick is that you have to: open the file in a text editor, Save As, choose the line ending as WINDOWS. My phones couldn't interpret the file otherwise. --

Thanks,

Brendan Carroll 617.794.8801

On Fri, 2022-04-22 at 04:51 -0700, Cyan wrote:

I have attached an .m3u file. I hope it helps. On Tue, 2021-01-12 at 22:07 -0800, Ahmad Malik wrote: Not support m3u i need to understand how m3u works before adding this features to k- music — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. -- Thanks, Brendan Carroll 617.794.8801 where is the .m3u file provided? i cannot find it in this github issue.... I am making a music player and would like to understand how m3u works... Only "reliable" examples i could find is from wikipedia.... — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

arma7x commented 2 years ago

@helotbc please share your m3u playlist. Paste it on pastebin.com

helotbc commented 2 years ago

Done. Let me know if you need anything further. --

Thanks,

Brendan Carroll 617.794.8801

On Fri, 2022-04-22 at 07:58 -0700, Ahmad Malik wrote:

@helotbc please share your m3u playlist. Paste it on pastebin.com — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

arma7x commented 2 years ago

Done. Let me know if you need anything further. -- Thanks, Brendan Carroll 617.794.8801 On Fri, 2022-04-22 at 07:58 -0700, Ahmad Malik wrote: @helotbc please share your m3u playlist. Paste it on pastebin.com — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

link to pastebin.com ?

helotbc commented 2 years ago

I've never used pastebin and not sure what you need. I've attached the file to this email. --

Thanks,

Brendan Carroll 617.794.8801

On Fri, 2022-04-22 at 08:03 -0700, Ahmad Malik wrote:

Done. Let me know if you need anything further. -- Thanks, Brendan Carroll 617.794.8801 … On Fri, 2022-04-22 at 07:58 -0700, Ahmad Malik wrote: @helotbc please share your m3u playlist. Paste it on pastebin.com — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.> link to pastebin.com ? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.>

arma7x commented 2 years ago

@helotbc Github comment section and my email inbox does not show any file attachment

cyan-2048 commented 2 years ago

@helotbc please cooperate and upload the file somewhere else other than your email provider

helotbc commented 2 years ago

Please find the file attached...

helotbc commented 2 years ago

Change the file extension to .m3u

Boroque-test.m3u.txt

helotbc commented 2 years ago

Uploaded to github. Let me know if you can't see it. Remove the .txt in the file name. --

Thanks,

Brendan Carroll 617.794.8801

On Fri, 2022-04-22 at 08:16 -0700, Cyan wrote:

@helotbc please cooperate and upload the file somewhere else other than your email provider — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

cyan-2048 commented 2 years ago

@helotbc do you mind sending a picture of one of the folders the music found in the m3u file is located at?

arma7x commented 2 years ago

Change the file extension to .m3u

Boroque-test.m3u.txt

thanks

helotbc commented 2 years ago

Here's an image of the file on my OS: --

Thanks,

Brendan Carroll 617.794.8801

On Fri, 2022-04-22 at 08:28 -0700, Cyan wrote:

@helotbc do you mind sending a picture of one of the folders the music found in the m3u file is located at? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

helotbc commented 2 years ago

I put this file on my device in the /Music folder with the .mp3 files. In past experience the music player identifies the .m3u and lists it under the PlayList category. --

Thanks,

Brendan Carroll 617.794.8801

On Fri, 2022-04-22 at 08:28 -0700, Cyan wrote:

@helotbc do you mind sending a picture of one of the folders the music found in the m3u file is located at? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

cyan-2048 commented 2 years ago

@helotbc please stop trying to send attachments through email, no one in github can see it

arma7x commented 2 years ago

@helotbc please stop trying to send attachments through email, no one in github can see it

https://pastebin.com/raw/z5qN1MWT

cyan-2048 commented 2 years ago

i saw that already, @helotbc sent an image through email

cyan-2048 commented 2 years ago

anyways, i think i have understood how m3u works thanks @helotbc

helotbc commented 2 years ago

Good luck guys! --

Thanks,

Brendan Carroll 617.794.8801

On Sat, 2022-04-23 at 06:47 -0700, Cyan wrote:

anyways, i think i have understood how m3u works thanks @helotbc — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

cyan-2048 commented 2 years ago

Tested out Phonograph app for android, i get this.... so far my brain can only implement:

if user imports playlist which uses relative folder directories, i will not include ../ because b2g does not support directories like this..... having to implement my own way of getting file using ../ is too much... i will i skip filepath structure that's not supported like C:\

if user will export playlist and all the music is found in the same folder(aka /Music) will export using relative directories, else if user exports playlist with folders not in the same directory, use File object filename property(will use fullpath but only accessable for the same kaios device, some kaios device have different filepath structure).

MNL48 no-inst.m3u.txt MNL48 no-inst(relative).m3u.txt

cyan-2048 commented 2 years ago

actually maybe i will not implement a way to export with relative filepath, because i am too lazy to implement a way to export file to a directory ahahhahaha

cyan-2048 commented 2 years ago
function parseM3U(file) {
    if (file.constructor.name !== "File") return console.error("Not a File object");
    if (!file.name) return console.error("No filename");
    let text = blob2text(file);
    let array = text.split("\n");
    if (array[0] !== "#EXTM3U") return console.error("Not an M3U file");
    let filepath = file.name.split("/").slice(0, -1).join("/") + "/";
    array = array
        .map((a) => a.replace(/\\/g, "/"))
        .filter((a) => {
            if (a.startsWith("#")) return false;
            if (/^(.*):\//.test(a)) return false;
            if (a.includes("../")) return false;
            if (a == "") return false;
            return true;
        })
        .map((a) => (a.startsWith("/") ? a : filepath + a));
    return array;
}

var text = `#EXTM3U
Alternative\\Band - Song.mp3
Classical\\Other Band - New Song.mp3
Stuff.mp3
D:\\More Music\\Foo.mp3
..\\Other Music\\Bar.mp3
http://www.example.com:8000/Listen.mp3
http://www.example.com/~user/Mine.mp3
/storage/6912-2BCA/Music/MNL48/River - Disk 1/MNL48 - River.mp3`

parseM3U(new File([text],"/sdcard/music/test.m3u"))
/* 
returns:
[
    "/sdcard/music/Alternative/Band - Song.mp3",
    "/sdcard/music/Classical/Other Band - New Song.mp3",
    "/sdcard/music/Stuff.mp3",
    "/storage/6912-2BCA/Music/MNL48/River - Disk 1/MNL48 - River.mp3",
]
*/
cyan-2048 commented 2 years ago
// sync xmlhttp is acceptable for things stored in ram i guess
function blob2text(b) {
    var blob = b.slice(0, b.size, "text/plain"),
        uri = URL.createObjectURL(blob),
        xhr = new XMLHttpRequest();
    xhr.open("GET", uri, false);
    xhr.send();
    URL.revokeObjectURL(uri);
    return xhr.responseText;
}

sync blob2text

arma7x commented 2 years ago

The issues was closed. Please duplicate this issue on your repository and i will follow up the discussion

arma7x commented 2 years ago

Maybe you can use 3rd party libraries to parse m3u files, https://github.com/nickdesaulniers/javascript-playlist-parser

http://www.example.com/~user/Mine.mp3 // if path is valid http then use the path as stream src
/storage/6912-2BCA/Music/MNL48/River - Disk 1/MNL48 - River.mp3 // find "MNL48 - River.mp3" in local files registry, if exist use local path as stream src else skip from playlist
arma7x commented 2 years ago

re-open the issues and WIP[DONE]

arma7x commented 2 years ago

DONE External Playlist(only support m3u) @helotbc Please test the latest version

helotbc commented 2 years ago

I'm sorry, I can't test. I no longer have that device. --

Thanks,

Brendan Carroll 617.794.8801

On Tue, 2022-04-26 at 14:06 -0700, Ahmad Malik wrote:

DONE External Playlist(only support m3u) @helotbc Please test the latest version — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

helotbc commented 2 years ago

Please send me the link to your github site and I'll upload. --

Thanks,

Brendan Carroll 617.794.8801

On Fri, 2022-04-22 at 08:11 -0700, Ahmad Malik wrote:

@helotbc Github comment section and my email inbox does not show any file attachment — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>