martpie / museeks

🎵 A simple, clean and cross-platform music player
https://museeks.io
MIT License
1.62k stars 195 forks source link

Allow usage of samba shares / folders using smb:// protocol #564

Open franktopel opened 3 years ago

franktopel commented 3 years ago

My music library resides on a Zyxel NAS (Zyxel NSA 325). As of now I cannot add smb://filegott/music/flac as the source of my music files. Dragging the folder from Nautilus results in An error occurred when scanning the library.

martpie commented 3 years ago

If you open the file URI with Chrome, does it work?

franktopel commented 3 years ago

On Linux (Ubuntu 20.10): No, instead it searches google.

On Mac: No, but asks to open the URL in Finder, which works.

So, on Mac, I actually can add the NAS folder as source of my library. On Linux, I cannot.

martpie commented 3 years ago

There is unfortunately much I can do on my side. My recommendation would be to not use samba and try to sync the files on your device, sorry :(

lightdj commented 3 years ago

@franktopel You can mount the smb as a folder, which will allow the app to interpret it as such. There is one issue, however. The LibraryActions.ts file pattern will throw an error Error: EINVAL: invalid argument, stat '/run/user/1000/gvfs/smb-share:server=192.168.2.150,share=music/**/*.*'

@martpie I ended up tracing the error all the way to https://github.com/sindresorhus/path-type/blob/main/index.js, which had an issue with how the application passes the pattern variable with an appended /**/*.*. This causes path-type to throw the error I shared. To my knowledge, this error only happens for mounted smb point. I have not tested mounting an external drive to rule out only smb being the issue.

I will say that removing /**/*.* from the pattern variable in LibraryActions.ts allowed the parsing on the mounted smb share. So, I am not entirely sure where to go from here. Maybe there is a way to rework how globs are being read by passing some options to parse all files and directories so that there is not need to append the /**/*.* pattern to the end of the root directory you select in the UI.

Anyhow, I just spent a few hours working through this because I like this player and wanted to use my smb share to listen to my media :). I was able to get it working, but only locally. It would require some more discussion, I assume, to get something more correct together.

-djfight

martpie commented 3 years ago

Really interesting investigation,thank you!

Maybe I can do some more research, the problem comes probably from either the Glob library or Node.js itself.

Surely we are not the first with this problem.

franktopel commented 2 years ago

So any news on this? Without being able to play music from the NAS, how is this application any useful?

This time I'm on Fedora 34.

martpie commented 2 years ago

The way to do this right now is to sync your files between your devices. I understand this is not the optimal solution, but this is what we have.

I did not investigate yet how to use Samba as this is something I don't use and know very well. Keep on 👍 the first post so I can know which feature I should focus on next.

franktopel commented 2 years ago

The way to do this right now is to sync your files between your devices.

To avoid just that people buy NAS. On a standard Macbook/notebook you have 256 to 512 Gigs of Hard Drive space. No way does anyone have the space to sync 1 or 2 TB of flac music library.

martpie commented 2 years ago

Again, I understand the frustration.

Feel free to wait until I start working on it (not soon), implement the feature yourself, or use another player.

raphial commented 2 years ago

@franktopel You can mount the smb as a folder, which will allow the app to interpret it as such. There is one issue, however. The LibraryActions.ts file pattern will throw an error Error: EINVAL: invalid argument, stat '/run/user/1000/gvfs/smb-share:server=192.168.2.150,share=music/**/*.*'

@martpie I ended up tracing the error all the way to https://github.com/sindresorhus/path-type/blob/main/index.js, which had an issue with how the application passes the pattern variable with an appended /**/*.*. This causes path-type to throw the error I shared. To my knowledge, this error only happens for mounted smb point. I have not tested mounting an external drive to rule out only smb being the issue.

I will say that removing /**/*.* from the pattern variable in LibraryActions.ts allowed the parsing on the mounted smb share. So, I am not entirely sure where to go from here. Maybe there is a way to rework how globs are being read by passing some options to parse all files and directories so that there is not need to append the /**/*.* pattern to the end of the root directory you select in the UI.

Anyhow, I just spent a few hours working through this because I like this player and wanted to use my smb share to listen to my media :). I was able to get it working, but only locally. It would require some more discussion, I assume, to get something more correct together.

-djfight

I also found this exact issue today, searched for hours online and debugging using the dev console.. Can't add anything without it being in the home folder or a mounted drive. Has a fix been looked at yet by chance? I have all of our music on our large NAS setup. It simply just doesn't like the path.

martpie commented 2 years ago

It would appear Samba support is baked in Chromium, would anyone have a public samba server I could try things on? (connection, file streaming etc)

davidawad commented 2 months ago

My recommendation is similar, I'd just setup a mounted folder on the filesystem and don't' make this the media player's problem.

djfight commented 2 months ago

@franktopel You can mount the smb as a folder, which will allow the app to interpret it as such. There is one issue, however. The LibraryActions.ts file pattern will throw an error Error: EINVAL: invalid argument, stat '/run/user/1000/gvfs/smb-share:server=192.168.2.150,share=music/**/*.*'

@martpie I ended up tracing the error all the way to https://github.com/sindresorhus/path-type/blob/main/index.js, which had an issue with how the application passes the pattern variable with an appended /**/*.*. This causes path-type to throw the error I shared. To my knowledge, this error only happens for mounted smb point. I have not tested mounting an external drive to rule out only smb being the issue.

I will say that removing /**/*.* from the pattern variable in LibraryActions.ts allowed the parsing on the mounted smb share. So, I am not entirely sure where to go from here. Maybe there is a way to rework how globs are being read by passing some options to parse all files and directories so that there is not need to append the /**/*.* pattern to the end of the root directory you select in the UI.

Anyhow, I just spent a few hours working through this because I like this player and wanted to use my smb share to listen to my media :). I was able to get it working, but only locally. It would require some more discussion, I assume, to get something more correct together.

-djfight

Hello all!

DJFight here with a new account that I made since my university locked me out of my old Github by disabling our email.

As @davidawad said, if you mount your networkshare under you /mnt/<some_share> and add that to your /etc/fstab configuration file to mount it on boot, then you will be good to go. The app functions normally with no workarounds by simply mount your network share using samba. Here is an example of my music share that I have on my NAS using the smb protocol to treat it like a directory:

In my /etc/fstab I have an entry like this //media.lights.home/music /mnt/music cifs _netdev,credentials=/etc/samba/credentials/<your_networkshare_creds_file> 0 0. This tells kernel to mount this share on boot, which adds it to the /mnt/music directory. In Museeks, simply add the /mnt/music directory, in my case, to the folder. You can find more information on how to mount a networkshare using samba here: https://wiki.archlinux.org/title/Samba. I am using Arch, but I assume it is relatively similar to figure out on other distributions.

image

Thanks @martpie for the awesome media player!

martpie commented 2 months ago

Thank you everyone for testing this method, truly appreciated :) I have a quick favor to ask anyone with a samba setup. I am currently porting Museeks to Tauri (#753) to make it more lightweight (size, cpu, memory, etc).

Could anyone with some time test that the mounted folder solution still works with this beta version? I can provide you a test binary if you tell me on which platform you are (window, mac or linux)

djfight commented 2 months ago

Thank you everyone for testing this method, truly appreciated :) I have a quick favor to ask anyone with a samba setup. I am currently porting Museeks to Tauri (#753) to make it more lightweight (size, cpu, memory, etc).

Could anyone with some time test that the mounted folder solution still works with this beta version? I can provide you a test binary if you tell me on which platform you are (window, mac or linux)

Is there a branch where this code is located? I can just pull the code and build from source and test things out. -djfight

martpie commented 2 months ago

Awesome, thank you! You can checkout the tauri branch #753. You will need Node.js and rustup set-up. Then you can build it with the following:

sudo apt install --no-install-recommends -y libopenjp2-tools rpm gcc-multilib g++-multilib
npm install
cargo test --manifest-path src-tauri/Cargo.toml
npm run tauri build

The binaries will be located in src-tauri/target/release :)