mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 23:47:20 +00:00
update notifications
This commit is contained in:
parent
f588c9af8d
commit
03574461a9
@ -86,7 +86,7 @@ QString ExtendedSysMon::getAutoGpu()
|
||||
if (qoutput.toLower().contains("nvidia"))
|
||||
gpu = QString("nvidia");
|
||||
else if (qoutput.toLower().contains("radeon"))
|
||||
gpu = QString("ati");
|
||||
gpu = QString("ati");
|
||||
if (debug) qDebug() << "[DE]" << "[getAutoGpu]" << ":" << "Device" << gpu;
|
||||
|
||||
return gpu;
|
||||
@ -97,17 +97,18 @@ QString ExtendedSysMon::getAutoMpris()
|
||||
{
|
||||
if (debug) qDebug() << "[DE]" << "[getAutoMpris]";
|
||||
|
||||
QProcess command;
|
||||
QString mpris;
|
||||
QString cmd = QString("bash -c \"qdbus 'org.mpris.MediaPlayer2.*'\"");
|
||||
if (debug) qDebug() << "[DE]" << "[getAutoMpris]" << ":" << "Run cmd" << cmd;
|
||||
command.start(cmd);
|
||||
command.waitForFinished(-1);
|
||||
QString cmdOutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput()).trimmed();
|
||||
mpris = cmdOutput.split(QChar('\n'))[0].split(QChar('.'))[3];
|
||||
QProcess command;
|
||||
QString mpris;
|
||||
QString cmd = QString("bash -c \"qdbus 'org.mpris.MediaPlayer2.*'\"");
|
||||
if (debug) qDebug() << "[DE]" << "[getAutoMpris]" << ":" << "Run cmd" << cmd;
|
||||
command.start(cmd);
|
||||
command.waitForFinished(-1);
|
||||
QString cmdOutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput()).trimmed();
|
||||
if (cmdOutput.split(QChar('\n'))[0].split(QChar('.')).count() > 3)
|
||||
mpris = cmdOutput.split(QChar('\n'))[0].split(QChar('.'))[3];
|
||||
|
||||
if (debug) qDebug() << "[DE]" << "[getAutoMpris]" << ":" << "Player found" << mpris;
|
||||
return mpris;
|
||||
if (debug) qDebug() << "[DE]" << "[getAutoMpris]" << ":" << "Player found" << mpris;
|
||||
return mpris;
|
||||
}
|
||||
|
||||
|
||||
|
@ -144,24 +144,15 @@ class PTMNotify:
|
||||
artist = "N\\A"
|
||||
album = "N\\A"
|
||||
title = "N\\A"
|
||||
if (len(commands.getoutput("pgrep amarok")) > 0):
|
||||
player = "amarok"
|
||||
elif (len(commands.getoutput("pgrep clementine")) > 0):
|
||||
player = "clementine"
|
||||
elif (len(commands.getoutput("pgrep mpd")) > 0):
|
||||
if (len(commands.getoutput("pgrep mpd")) > 0):
|
||||
player = "mpd"
|
||||
elif (len(commands.getoutput("pgrep qmmp")) > 0):
|
||||
player = "qmmp"
|
||||
else:
|
||||
player = ""
|
||||
if (player == "amarok"):
|
||||
artist = commands.getoutput("qdbus org.kde.amarok /Player GetMetadata 2> /dev/null | grep albumartist: | cut -c14-")
|
||||
album = commands.getoutput("qdbus org.kde.amarok /Player GetMetadata 2> /dev/null | grep album: | cut -c8-")
|
||||
title = commands.getoutput("qdbus org.kde.amarok /Player GetMetadata 2> /dev/null | grep title: | cut -c8-")
|
||||
elif (player == "clementine"):
|
||||
artist = commands.getoutput("qdbus org.mpris.clementine /Player GetMetadata 2> /dev/null | grep albumartist: | cut -c14-")
|
||||
album = commands.getoutput("qdbus org.mpris.clementine /Player GetMetadata 2> /dev/null | grep album: | cut -c8-")
|
||||
title = commands.getoutput("qdbus org.mpris.clementine /Player GetMetadata 2> /dev/null | grep title: | cut -c8-")
|
||||
player = "mpris"
|
||||
if (player == "mpris"):
|
||||
name = commands.getoutput("qdbus 'org.mpris.MediaPlayer2.*'").split('\n')[0].split('.')[3]
|
||||
artist = commands.getoutput("qdbus org.mpris." + name + " /Player GetMetadata 2> /dev/null | grep albumartist: | cut -c14-")
|
||||
album = commands.getoutput("qdbus org.mpris." + name + " /Player GetMetadata 2> /dev/null | grep album: | cut -c8-")
|
||||
title = commands.getoutput("qdbus org.mpris." + name + " /Player GetMetadata 2> /dev/null | grep title: | cut -c8-")
|
||||
elif (player == "mpd"):
|
||||
output = commands.getoutput("echo 'currentsong\nclose' | curl --connect-timeout 1 -fsm 3 telnet://localhost:6600 2> /dev/null")
|
||||
for line in output.split("\n"):
|
||||
@ -171,10 +162,6 @@ class PTMNotify:
|
||||
album = line.split(": ")[1]
|
||||
elif (line.split(": ")[0] == "Title"):
|
||||
title = line.split(": ")[1]
|
||||
elif (player == "qmmp"):
|
||||
artist = commands.getoutput("qmmp --nowplaying '%if(%p,%p,Unknown)' 2> /dev/null")
|
||||
album = commands.getoutput("qmmp --nowplaying '%if(%a,%a,Unknown)' 2> /dev/null")
|
||||
title = commands.getoutput("qmmp --nowplaying '%if(%t,%t,Unknown)' 2> /dev/null")
|
||||
text = text + "Artist: %s\nAlbum: %s\nTitle: %s" % (artist, album, title)
|
||||
except:
|
||||
text = "Something wrong"
|
||||
|
Loading…
Reference in New Issue
Block a user