kamek-pf/ntfd

two issues. one with running mpd and ntfd simultaneously conflicts and standard linux binary build.

onlyvip opened this issue · 37 comments

1.if i run mpd first or ntfd first then enable mpd later on. one or the other wont start later on as the socket is preoccupied for the latter.
2.the binary currently available is for musl and the biuld process is convoluted. i use debian so it would be great if you have a standard build process available for it(glibc if im not wrong). in which case i would be able to maintain in the mpr which is a rather new, aur like central repo for debian and ubuntu.
mpr

I've been meaning to do some serious refactoring on this project, this code base is a mess. Sadly I don't have much time to spare these days :/

Anyway, you're definitely supposed to start ntfd after mpd. mpd acts as a server and ntfd as a client, if it doesn't work in that order, something else is probably wrong. Are you using the default port for mpd ?

The build process is messy because my goal was to be able to distribute a statically linked binary, which turned out to be pretty cumbersome and not very useful.
To build manually for a different distro, I would just use Stack directly (stack build should do, it should pull in all the required toolchain, including GHC), use ldd to find out what it's linking against and include that as dependencies of your final package, should be pretty straightforward.

Anyway, you're definitely supposed to start ntfd after mpd. mpd acts as a server and ntfd as a client, if it doesn't work in that order, something else is probably wrong. Are you using the default port for mpd ?

How do I check the port for mpd
Here is the error I get. I'm running ntfd after mpd had started its daemon.
https://termbin.com/h3kn

Regarding the build process . How would I use ldd exactly? And what's the dependency in order to get stack working properly for the building

Default port is 6600, try this:

λ ~ ss -tulpn | grep LISTEN | grep mpd
tcp   LISTEN 0      5                  *:6600             *:*    users:(("mpd",pid=923,fd=10))

For ldd you just run it on the output binary, it'll tell you what it's linking against. Stack is self sufficient, if it's not available in your repos, the official docs provide a magical shell pipe: https://docs.haskellstack.org/en/stable/install_and_upgrade/

Default port is 6600, try this:

λ ~ ss -tulpn | grep LISTEN | grep mpd
tcp   LISTEN 0      5                  *:6600             *:*    users:(("mpd",pid=923,fd=10))

Here's the mpd port info

https://termbin.com/lbdp

For ldd you just run it on the output binary, it'll tell you what it's linking against. Stack is self sufficient, if it's not available in your repos, the official docs provide a magical shell pipe: https://docs.haskellstack.org/en/stable/install_and_upgrade/

I'll test it out and see how it comes about. Thanks

For your socket error, it looks like your mpd instance binds to 127.0.0.1 instead of 0.0.0.0, try adding this at the bottom of your ~/.config/mpd/mpd.conf:

bind_to_address		"0.0.0.0"

For your socket error, it looks like your mpd instance binds to 127.0.0.1 instead of 0.0.0.0, try adding this at the bottom of your ~/.config/mpd/mpd.conf:

bind_to_address		"0.0.0.0"

This is my mod config mpd.conf
https://termbin.com/tzex
Here's what I did after changing the config.
Restarted the mpd service and then restarted the ntfd daemon
I still get the same error
https://termbin.com/82dc

Weird, what does it say now if you run ss -tulpn | grep LISTEN | grep mpd again ?

Weird, what does it say now if you run ss -tulpn | grep LISTEN | grep mpd again ?

I did a restart. Then ran this later on
Img

Ah I managed to reproduce, use this:

bind_to_address		"any"

instead of 0.0.0.0 and it should work

Ah I managed to reproduce, use this:

bind_to_address		"any"

instead of 0.0.0.0 and it should work

Ok now ntfd runs and starts without any error but,
When songs change there's no notification of it

Songs do have album art I can confirm that. And they are in the directory mentioned in the config.toml

Is Dunst running ?

Is Dunst running ?

Yes. I have Dunst running.
However there's no special service needed to be enabled for Dunst and no daemon needed as well. It looks at dbus and responds in case of it needs to. So I don't know what you mean by running. But Dunst is working for me. It's 1.6.1 version

If there really is a cover.jpg in the same directory as the song currently playing (this is important, if the cover is in a parent or child directory, it won't work) then I can't reproduce

If there really is a cover.jpg in the same directory as the song currently playing (this is important, if the cover is in a parent or child directory, it won't work) then I can't reproduce

I am sorry but how do I check that? I have used the --embed-thumbnail and used that to download the song in MP3 using youtubedl let me share the exact commands
alias yt-audio-and-art="youtube-dl --extract-audio --add-metadata --xattrs --embed-thumbnail --audio-quality 0 --audio-format mp3"

Just list one of your directories to see what the structure looks like:

.rwxrwxrwx@  13M kamek  2 May  2013 song1.ogg
.rwxrwxrwx@  16M kamek  2 May  2013 song2.ogg
.rwxrwxrwx@  17M kamek  2 May  2013 song3.ogg
.rwxrwxrwx@  14M kamek  2 May  2013 song4.ogg
.rwxrwxrwx@ 3.3M kamek  2 May  2013 cover.jpg

The cover.jpg just needs to be in the same directory as the tracks for each albums.

Just list one of your directories to see what the structure looks like:

.rwxrwxrwx@  13M kamek  2 May  2013 song1.ogg
.rwxrwxrwx@  16M kamek  2 May  2013 song2.ogg
.rwxrwxrwx@  17M kamek  2 May  2013 song3.ogg
.rwxrwxrwx@  14M kamek  2 May  2013 song4.ogg
.rwxrwxrwx@ 3.3M kamek  2 May  2013 cover.jpg

The cover.jpg just needs to be in the same directory as the tracks for each albums.

Ok I have the album art embedded with the songs. I'm doomed ig. Damn

I have the cover art working in ncmpcpp if use the albumart script
I have it working if I use kunst as well but they work in ncmpcpp only. Just to show that it can happen if the art is embedded

regarding the stack build method,
i did the following

wget https://github.com/kamek-pf/ntfd/archive/refs/tags/0.2.2.tar.gz
tar -xf ntfd-0.2.2.tar.gz
cd ntfd-0.2.2.tar.gz
stack build

now here's the error i get. i am not sure whats causing it, thats why i am sharing it in here.
error

It's trying to link against OpenSSL, you need libssl-dev 1.1.x for this to work.

It's trying to link against OpenSSL, you need libssl-dev 1.1.x for this to work.

Apparently that's solved but now I have encountered a major hurdle. I can't compile it because I have a ram of 4 gb. So system freezes while building aeson control.lens.wrapped

Yeah, the Haskell compiler yields efficient binaries, but it needs a lot of memory :s

Yeah, the Haskell compiler yields efficient binaries, but it needs a lot of memory :s

So here's my question,
If I want to package ntfd for debian via mpr is using the musl binary enough?

Yeah, the Haskell compiler yields efficient binaries, but it needs a lot of memory :s

So as I can't build it,
Is it ok if I use the musl binary in the package used for debian and ubuntu in MPR?

Yeah it should work as-is on any distribution, this is why I went with a fully static binary

Yeah it should work as-is on any distribution, this is why I went with a fully static binary

And suppose you were to package it for say aur or mpr what would you suggest I add?
A man page?
License?
Anything else?

man page and license sounds good, I can't think of anything else

man page and license sounds good, I can't think of anything else

so, what document should i use a manual?

README from this repo should be ok, or just link to it

so,
install -Dm path-to-Readme.md /usr/local/man/ntfd
this is all i can do, however it wont work if they run man ntfd after its installed so ig i should add it as a doc file and mention about its exitence while the package gets installed and link to this repo. and install the license as well on their system.
ill share the pkgbuild and other details in in some time.

here's how the package will be unpacked and uninstalled on the users file tree,
https://ezup.dev/p/6hjjkl
and heres the PKGBUILD,
https://ezup.dev/p/3dduc9
do confirm if it is ok or not. if it is as you want it to be. i would go ahead and make it available.

looks good to me !

looks good to me !

https://mpr.hunterwittenborn.com/packages/ntfd/
all cool then. :)
oh i forgot to add the config.toml. where should i add it except the ~ of the user?

/etc/ntfd/config.toml or /etc/ntfd.toml would both be fine. Pick either, I don't have a preference :)

/etc/ntfd/config.toml or /etc/ntfd.toml would both be fine. Pick either, I don't have a preference :)

I have included it under /usr/local/share/doc/ntfd/config.toml
Should be ok. Now all I have to do is that image isn't displayed in the Dunst notification.
What solution do you recommend for that?

That I'm not sure, I can't reproduce your issue.
It works on 3 different machines I use, if you're positive music_directory and cover_name are both correct, then I don't know what's happening, sorry :(

That I'm not sure, I can't reproduce your issue.
It works on 3 different machines I use, if you're positive music_directory and cover_name are both correct, then I don't know what's happening, sorry :(

I mean how should i download a song from YouTube so that ntfd works as it should while giving it a notification?

There could be a way to extract embedded images in a song and add it to dunst as output. If it the song has a embedded song. This step will be done if no art is found then skip.
I would consider this as a feature request and I am officially closing thread. For now I am not using NTFD for doing notification and am using a custom mpdaemon script to achieve this behaviour. However I would continue using NTFD for weather module. As it's good for that.