Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvements #3

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions etc/systemd/user/irssi-notification-client.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
Description=irssi mqtt push notification client
After=user-session.target

[Service]
ExecStart=/usr/bin/python /usr/share/irssi-notification-client/irssi-notification-client.py

[Install]
WantedBy=post-user-session.target
74 changes: 74 additions & 0 deletions rpm/irssi-notification-client.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#
# irssi-notification-client
#

%define __spec_install_post %{nil}
%define debug_package %{nil}
%define __os_install_post %{_dbpath}/brp-compress

Summary: irssi mqtt push notification client
Name: irssi-notification-client
Version: 1.0.2
Release: 2
License: LICENSE
Group: Utilities
Source0: %{name}-%{version}.tar.bz2
BuildArch: noarch
URL: https://wiki.merproject.org/wiki/Middleware/PushNotifications
Requires: python
Requires: python-mosquitto
Requires: dbus-python

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

%description
%{summary}

%prep
%setup -q

%build
# Empty section.

%install
rm -rf %{buildroot}
mkdir -p %{buildroot}

# in builddir
cp -a * %{buildroot}
mv %{buildroot}/LICENSE %{buildroot}/usr/share/%{name}/
mv %{buildroot}/README.md %{buildroot}/usr/share/%{name}/


%clean
rm -rf %{buildroot}


%files
%defattr(-,root,root,-)
%config /etc/systemd/user/%{name}.service
%config /usr/share/lipstick/notificationcategories/x-nemo.messaging.irssi.conf
/usr/share/%{name}/%{name}.py
/usr/share/%{name}/LICENSE
/usr/share/%{name}/README.md
/usr/share/%{name}/itsme.wav
/usr/share/%{name}

%post
systemctl-user start %{name}.service
systemctl-user enable %{name}.service


%pre
# In case of update, stop and disable first
if [ "$1" = "2" ]; then
systemctl-user stop %{name}.service
systemctl-user disable %{name}.service
fi

%preun
# in case of complete removal, stop and disable
if [ "$1" = "0" ]; then
systemctl-user stop %{name}.service
systemctl-user disable %{name}.service
fi
5 changes: 4 additions & 1 deletion irssi-notification-client.py → ...ation-client/irssi-notification-client.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def on_message(mosq, obj, msg):
try:
interface.Notify("irssi",
0,
"icon-m-notifications",
"",
notification[0],
notification[1],
dbus.Array(["default", ""]),
Expand All @@ -64,6 +64,9 @@ def on_message(mosq, obj, msg):
except dbus.exceptions.DBusException:
print("Failed sending DBus notification.")

if "itsme"+mqtt_password[-3:] in notification[1]:
os.system("gst-launch-0.10 filesrc location=/usr/share/irssi-notification-client/itsme.wav ! wavparse ! audioconvert ! alsasink")

mqttc.on_message = on_message

bus = dbus.SessionBus()
Expand Down
Binary file added usr/share/irssi-notification-client/itsme.wav
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
appIcon=icon-lock-sms
urgency=2
x-nemo-icon=icon-lock-sms
x-nemo-priority=120
x-nemo-max-content-lines=6
x-nemo-feedback=chat
x-nemo-led-disabled-without-body-and-summary=false
9 changes: 0 additions & 9 deletions x-nemo.messaging.irssi.conf

This file was deleted.