mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 23:47:20 +00:00
release 1.5.3
This commit is contained in:
parent
0d3aacdec7
commit
a3a5ebf2af
19
PKGBUILD
19
PKGBUILD
@ -3,13 +3,13 @@
|
||||
|
||||
pkgname=kdeplasma-applets-pytextmonitor
|
||||
_pkgname=py-text-monitor
|
||||
pkgver=1.5.2
|
||||
pkgver=1.5.3
|
||||
pkgrel=1
|
||||
_dtengine=ext-sysmon
|
||||
_dtver=1.5
|
||||
_dtver=1.6
|
||||
pkgdesc="Minimalistic Plasmoid script written on Python2. It looks like widgets in awesome-wm"
|
||||
arch=('i686' 'x86_64')
|
||||
url="https://github.com/arcan1s/pytextmonitor"
|
||||
url="http://arcanis.name/projects/pytextmonitor"
|
||||
license=('GPL')
|
||||
depends=('kdebase-workspace' 'kdebindings-python2' 'lm_sensors' 'net-tools' 'sysstat')
|
||||
optdepends=("hddtemp: for HDD temperature monitor"
|
||||
@ -22,25 +22,24 @@ makedepends=('automoc4' 'cmake')
|
||||
source=(https://github.com/arcan1s/pytextmonitor/releases/download/V.${pkgver}/${_pkgname}-${pkgver}.plasmoid
|
||||
https://github.com/arcan1s/pytextmonitor/releases/download/V.${pkgver}/${_dtengine}-${_dtver}.zip)
|
||||
install=${pkgname}.install
|
||||
md5sums=('62a83e665d5a60e40891357a237cea1c'
|
||||
'e8c0e40298facf6f515f3c72c66b2aa0')
|
||||
md5sums=('7fef048a8e000ccf9a1e5f0924f59cc2'
|
||||
'74f42444a2bddce898d462045c3dbd44')
|
||||
backup=('usr/share/config/extsysmon.conf')
|
||||
|
||||
build ()
|
||||
{
|
||||
build () {
|
||||
# build dataengine
|
||||
if [[ -d ${srcdir}/${_dtengine}/build ]]; then
|
||||
rm -rf "${srcdir}/${_dtengine}/build"
|
||||
fi
|
||||
mkdir "${srcdir}/${_dtengine}/build"; cd "${srcdir}/${_dtengine}/build"
|
||||
mkdir "${srcdir}/${_dtengine}/build"
|
||||
cd "${srcdir}/${_dtengine}/build"
|
||||
cmake -DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` \
|
||||
../
|
||||
make
|
||||
}
|
||||
|
||||
package()
|
||||
{
|
||||
package() {
|
||||
# install dataengine
|
||||
cd "${srcdir}/${_dtengine}/build"
|
||||
make DESTDIR="${pkgdir}" install
|
||||
|
@ -31,6 +31,8 @@ For edited output you must open Settings window and setup output format in lines
|
||||
* label `$bat` - battery charge, <i>%</i>. Battery device may be set below. File (`/sys/class/power_supply/BAT0/capacity` by default) must contain only battery charge in percent
|
||||
* label `$ac` - status AC device. Return <i>(*)</i> if AC device is online or <i>( )</i> if offline. AC device may be set below. FIle (`/sys/class/power_supply/AC/online` by default) must contain `1` if AC is online
|
||||
* label `$artist` - current song artist. One of supported music players must be installed
|
||||
* label `$progress` - current song progress. One of supported music players must be installed (mpd does not support yet)
|
||||
* label `$time` - current song duration. One of supported music players must be installed
|
||||
* label `$title` - current song title. One of supported music players must be installed
|
||||
|
||||
Label order will changed if you change slider position. HTML tags in label work normally.
|
||||
|
Binary file not shown.
BIN
ext-sysmon-1.6.zip
Normal file
BIN
ext-sysmon-1.6.zip
Normal file
Binary file not shown.
@ -1,4 +1,4 @@
|
||||
# Configuration file for Extended Systemmonitor DataEngine (v.1.5)
|
||||
# Configuration file for Extended Systemmonitor DataEngine (v.1.6)
|
||||
# Uncomment needed lines
|
||||
|
||||
# Set GPU device
|
||||
|
@ -1,26 +1,27 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2013 by Evgeniy Alekseev <esalekseev@gmail.com> *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
|
||||
***************************************************************************/
|
||||
* Copyright (C) 2013 by Evgeniy Alekseev <esalekseev@gmail.com> *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
|
||||
***************************************************************************/
|
||||
|
||||
#include "extsysmon.h"
|
||||
|
||||
#include <Plasma/DataContainer>
|
||||
#include <QFile>
|
||||
#include <QProcess>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -52,22 +53,20 @@ bool ExtendedSysMon::readConfiguration()
|
||||
f_out = popen("lspci 2> /dev/null", "r");
|
||||
char device[256];
|
||||
QString dev;
|
||||
while (fgets(device, 256, f_out) != NULL)
|
||||
{
|
||||
while (fgets(device, 256, f_out) != NULL) {
|
||||
dev = QString(device);
|
||||
if (dev.toLower().contains("nvidia"))
|
||||
gpudev = QString("nvidia");
|
||||
gpuDev = QString("nvidia");
|
||||
else if (dev.toLower().contains("radeon"))
|
||||
gpudev = QString("ati");
|
||||
gpuDev = QString("ati");
|
||||
}
|
||||
pclose(f_out);
|
||||
|
||||
f_out = popen("ls -1 /dev/sd[a-z] 2> /dev/null ; ls -1 /dev/hd[a-z] 2> /dev/null", "r");
|
||||
while (fgets(device, 256, f_out) != NULL)
|
||||
{
|
||||
while (fgets(device, 256, f_out) != NULL) {
|
||||
dev = QString(device).split("\n")[0];
|
||||
if (dev[0] == '/')
|
||||
hdddev.append(dev);
|
||||
hddDev.append(dev);
|
||||
}
|
||||
pclose(f_out);
|
||||
|
||||
@ -79,8 +78,7 @@ bool ExtendedSysMon::readConfiguration()
|
||||
QString confFileName = QString(getenv("HOME")) + QString("/.kde4/share/config/extsysmon.conf");
|
||||
QFile confFile(confFileName);
|
||||
bool exists = confFile.open(QIODevice::ReadOnly);
|
||||
if (!exists)
|
||||
{
|
||||
if (!exists) {
|
||||
confFileName = QString("/usr/share/config/extsysmon.conf");
|
||||
confFile.setFileName(confFileName);
|
||||
exists = confFile.open(QIODevice::ReadOnly);
|
||||
@ -88,32 +86,24 @@ bool ExtendedSysMon::readConfiguration()
|
||||
return false;
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
while (true) {
|
||||
fileStr = QString(confFile.readLine());
|
||||
if (confFile.atEnd())
|
||||
break;
|
||||
else if (fileStr[0] != '#')
|
||||
{
|
||||
if (fileStr.split(QString("="), QString::SkipEmptyParts).count() == 2)
|
||||
{
|
||||
if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("GPUDEV"))
|
||||
{
|
||||
if (fileStr[0] != '#') {
|
||||
if (fileStr.split(QString("="), QString::SkipEmptyParts).count() == 2) {
|
||||
if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("GPUDEV")) {
|
||||
if (fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0] == QString("ati"))
|
||||
gpudev = fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
gpuDev = fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
else if (fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0] == QString("nvidia"))
|
||||
gpudev = fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
gpuDev = fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
else if (fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0] != QString("auto"))
|
||||
gpudev = QString("ignore");
|
||||
gpuDev = QString("ignore");
|
||||
}
|
||||
else if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("HDDDEV"))
|
||||
{
|
||||
if (fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0] != QString("all"))
|
||||
{
|
||||
hdddev.clear();
|
||||
else if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("HDDDEV")) {
|
||||
if (fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0] != QString("all")) {
|
||||
hddDev.clear();
|
||||
for (int i=0; i<fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), \
|
||||
QString::SkipEmptyParts)[0].split(QString(","), QString::SkipEmptyParts).count(); i++)
|
||||
hdddev.append(fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), \
|
||||
hddDev.append(fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), \
|
||||
QString::SkipEmptyParts)[0].split(QString(","), QString::SkipEmptyParts)[i]);
|
||||
}
|
||||
}
|
||||
@ -123,6 +113,8 @@ bool ExtendedSysMon::readConfiguration()
|
||||
mpdPort = fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
}
|
||||
}
|
||||
if (confFile.atEnd())
|
||||
break;
|
||||
}
|
||||
|
||||
confFile.close();
|
||||
@ -140,41 +132,35 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
|
||||
QString key, out, tmp_out, value;
|
||||
bool ok = false;
|
||||
char output[256], val[5];
|
||||
if (source == QString("gpu"))
|
||||
{
|
||||
if (source == QString("gpu")) {
|
||||
key = QString("GPU");
|
||||
if (gpudev == QString("nvidia"))
|
||||
{
|
||||
if (gpuDev == QString("nvidia")) {
|
||||
f_out = popen("nvidia-smi -q -d UTILIZATION 2> /dev/null | grep Gpu | tail -n1", "r");
|
||||
fgets (output, 256, f_out);
|
||||
if ((output[0] == '\0') ||
|
||||
(QString(output).split(QString(" "), QString::SkipEmptyParts).count() < 2))
|
||||
value = QString(" N\\A");
|
||||
else
|
||||
{
|
||||
else {
|
||||
out = QString(output).split(QString(" "), QString::SkipEmptyParts)[2];
|
||||
sprintf (val, "%5.1f", out.left(out.count()-2).toFloat(&ok));
|
||||
value = QString(val);
|
||||
}
|
||||
pclose(f_out);
|
||||
}
|
||||
else if (gpudev == QString("ati"))
|
||||
{
|
||||
else if (gpuDev == QString("ati")) {
|
||||
f_out = popen("aticonfig --od-getclocks 2> /dev/null | grep load | tail -n1", "r");
|
||||
fgets (output, 256, f_out);
|
||||
if ((output[0] == '\0') ||
|
||||
(QString(output).split(QString(" "), QString::SkipEmptyParts).count() < 3))
|
||||
value = QString(" N\\A");
|
||||
else
|
||||
{
|
||||
else {
|
||||
out = QString(output).split(QString(" "), QString::SkipEmptyParts)[3];
|
||||
sprintf (val, "%5.1f", out.left(out.count()-2).toFloat(&ok));
|
||||
value = QString(val);
|
||||
}
|
||||
pclose(f_out);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
value = QString(" N\\A");
|
||||
}
|
||||
if (ok == false)
|
||||
@ -182,41 +168,35 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
|
||||
value = value.split(QString(","), QString::SkipEmptyParts).join(QString("."));
|
||||
setData(source, key, value);
|
||||
}
|
||||
else if (source == QString("gputemp"))
|
||||
{
|
||||
else if (source == QString("gputemp")) {
|
||||
key = QString("GPUTemp");
|
||||
if (gpudev == QString("nvidia"))
|
||||
{
|
||||
if (gpuDev == QString("nvidia")) {
|
||||
f_out = popen("nvidia-smi -q -d TEMPERATURE 2> /dev/null | grep Gpu | tail -n1", "r");
|
||||
fgets (output, 256, f_out);
|
||||
if ((output[0] == '\0') ||
|
||||
(QString(output).split(QString(" "), QString::SkipEmptyParts).count() < 2))
|
||||
value = QString(" N\\A");
|
||||
else
|
||||
{
|
||||
else {
|
||||
out = QString(output).split(QString(" "), QString::SkipEmptyParts)[2];
|
||||
sprintf (val, "%4.1f", out.toFloat(&ok));
|
||||
value = QString(val);
|
||||
}
|
||||
pclose(f_out);
|
||||
}
|
||||
else if (gpudev == QString("ati"))
|
||||
{
|
||||
else if (gpuDev == QString("ati")) {
|
||||
f_out = popen("aticonfig --od-gettemperature 2> /dev/null | grep Temperature | tail -n1", "r");
|
||||
fgets (output, 256, f_out);
|
||||
if ((output[0] == '\0') ||
|
||||
(QString(output).split(QString(" "), QString::SkipEmptyParts).count() < 4))
|
||||
value = QString(" N\\A");
|
||||
else
|
||||
{
|
||||
else {
|
||||
out = QString(output).split(QString(" "), QString::SkipEmptyParts)[4];
|
||||
sprintf (val, "%4.1f", out.toFloat(&ok));
|
||||
value = QString(val);
|
||||
}
|
||||
pclose(f_out);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
value = QString(" N\\A");
|
||||
}
|
||||
if (ok == false)
|
||||
@ -224,22 +204,19 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
|
||||
value = value.split(QString(","), QString::SkipEmptyParts).join(QString("."));
|
||||
setData(source, key, value);
|
||||
}
|
||||
else if (source == QString("hddtemp"))
|
||||
{
|
||||
else if (source == QString("hddtemp")) {
|
||||
char command[256], *dev;
|
||||
QByteArray qb;
|
||||
for (int i=0; i<hdddev.count(); i++)
|
||||
{
|
||||
qb = hdddev[i].toUtf8();
|
||||
for (int i=0; i<hddDev.count(); i++) {
|
||||
qb = hddDev[i].toUtf8();
|
||||
dev = qb.data();
|
||||
sprintf(command, "hddtemp %s 2> /dev/null", dev);
|
||||
sprintf(command, "sudo hddtemp %s 2> /dev/null", dev);
|
||||
f_out = popen(command, "r");
|
||||
fgets(output, 256, f_out);
|
||||
if ((output[0] == '\0') ||
|
||||
(QString(output).split(QString(":"), QString::SkipEmptyParts).count() < 3))
|
||||
value = QString(" N\\A");
|
||||
else
|
||||
{
|
||||
else {
|
||||
out = QString(output).split(QString(":"), QString::SkipEmptyParts)[2];
|
||||
sprintf (val, "%4.1f", out.left(out.count()-4).toFloat(&ok));
|
||||
value = QString(val);
|
||||
@ -248,74 +225,120 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
|
||||
if (ok == false)
|
||||
value = QString(" N\\A");
|
||||
value = value.split(QString(","), QString::SkipEmptyParts).join(QString("."));
|
||||
setData(source, hdddev[i], value);
|
||||
setData(source, hddDev[i], value);
|
||||
}
|
||||
}
|
||||
else if (source == QString("player"))
|
||||
{
|
||||
else if (source == QString("player")) {
|
||||
QProcess player;
|
||||
QString qoutput;
|
||||
QString value_album, value_artist, value_progress, value_duration, qstr;
|
||||
// qmmp
|
||||
output[0] = '\0';
|
||||
qoutput = QString("");
|
||||
value = QString("N\\A");
|
||||
value_album = QString("N\\A");
|
||||
value_artist = QString("N\\A");
|
||||
value_progress = QString("0");
|
||||
value_duration = QString("0");
|
||||
player.start("qmmp --status");
|
||||
player.waitForFinished(-1);
|
||||
qoutput = player.readAllStandardOutput();
|
||||
for (int i=0; i<qoutput.split(QString("\n"), QString::SkipEmptyParts).count(); i++) {
|
||||
qstr = qoutput.split(QString("\n"), QString::SkipEmptyParts)[i];
|
||||
if (qstr.split(QString(" = "), QString::SkipEmptyParts)[0] == QString("ALBUM"))
|
||||
value_album = qstr.split(QString(" = "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
else if (qstr.split(QString(" = "), QString::SkipEmptyParts)[0] == QString("ARTIST"))
|
||||
value_artist = qstr.split(QString(" = "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
else if (qstr.at(0) == QChar('[')) {
|
||||
QString time = qstr.split(QString(" "), QString::SkipEmptyParts)[2].split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
value_progress = QString::number(time.split(QString("/"), QString::SkipEmptyParts)[0].split(QString(":"), QString::SkipEmptyParts)[0].toInt() * 60 +
|
||||
time.split(QString("/"), QString::SkipEmptyParts)[0].split(QString(":"), QString::SkipEmptyParts)[1].toInt());
|
||||
value_duration = QString::number(time.split(QString("/"), QString::SkipEmptyParts)[1].split(QString(":"), QString::SkipEmptyParts)[0].toInt() * 60 +
|
||||
time.split(QString("/"), QString::SkipEmptyParts)[1].split(QString(":"), QString::SkipEmptyParts)[1].toInt());
|
||||
}
|
||||
else if (qstr.split(QString(" = "), QString::SkipEmptyParts)[0] == QString("TITLE"))
|
||||
value = qstr.split(QString(" = "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
}
|
||||
key = QString("qmmp_album");
|
||||
setData(source, key, value_album);
|
||||
key = QString("qmmp_artist");
|
||||
f_out = popen("qmmp --nowplaying '%if(%p,%p,Unknown)' 2> /dev/null", "r");
|
||||
fgets(output, 256, f_out);
|
||||
if (output[0] == '\0')
|
||||
value = QString("N\\A");
|
||||
else
|
||||
value = QString(output).split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
pclose(f_out);
|
||||
setData(source, key, value);
|
||||
output[0] = '\0';
|
||||
setData(source, key, value_artist);
|
||||
key = QString("qmmp_progress");
|
||||
setData(source, key, value_progress);
|
||||
key = QString("qmmp_duration");
|
||||
setData(source, key, value_duration);
|
||||
key = QString("qmmp_title");
|
||||
f_out = popen("qmmp --nowplaying '%if(%t,%t,Unknown)' 2> /dev/null", "r");
|
||||
fgets(output, 256, f_out);
|
||||
if (output[0] == '\0')
|
||||
value = QString("N\\A");
|
||||
else
|
||||
value = QString(output).split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
pclose(f_out);
|
||||
setData(source, key, value);
|
||||
// amarok
|
||||
output[0] = '\0';
|
||||
qoutput = QString("");
|
||||
value = QString("N\\A");
|
||||
value_album = QString("N\\A");
|
||||
value_artist = QString("N\\A");
|
||||
value_progress = QString("0");
|
||||
value_duration = QString("0");
|
||||
player.start("qdbus org.kde.amarok /Player GetMetadata");
|
||||
player.waitForFinished(-1);
|
||||
qoutput = player.readAllStandardOutput();
|
||||
for (int i=0; i<qoutput.split(QString("\n"), QString::SkipEmptyParts).count(); i++) {
|
||||
qstr = qoutput.split(QString("\n"), QString::SkipEmptyParts)[i];
|
||||
if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("album"))
|
||||
value_album = qstr.split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("artist"))
|
||||
value_artist = qstr.split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("time"))
|
||||
value_duration = qstr.split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("title"))
|
||||
value = qstr.split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
}
|
||||
player.start("qdbus org.kde.amarok /Player PositionGet");
|
||||
player.waitForFinished(-1);
|
||||
qoutput = player.readAllStandardOutput();
|
||||
for (int i=0; i<qoutput.split(QString("\n"), QString::SkipEmptyParts).count(); i++) {
|
||||
qstr = qoutput.split(QString("\n"), QString::SkipEmptyParts)[i];
|
||||
int time = qstr.toInt() / 1000;
|
||||
value_progress = QString::number(time);
|
||||
}
|
||||
key = QString("amarok_album");
|
||||
setData(source, key, value_album);
|
||||
key = QString("amarok_artist");
|
||||
f_out = popen("qdbus org.kde.amarok /Player GetMetadata 2> /dev/null | grep albumartist: | cut -c14-", "r");
|
||||
fgets(output, 256, f_out);
|
||||
if (output[0] == '\0')
|
||||
value = QString("N\\A");
|
||||
else
|
||||
value = QString(output).split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
pclose(f_out);
|
||||
setData(source, key, value);
|
||||
output[0] = '\0';
|
||||
setData(source, key, value_artist);
|
||||
key = QString("amarok_progress");
|
||||
setData(source, key, value_progress);
|
||||
key = QString("amarok_duration");
|
||||
setData(source, key, value_duration);
|
||||
key = QString("amarok_title");
|
||||
f_out = popen("qdbus org.kde.amarok /Player GetMetadata 2> /dev/null | grep title: | cut -c8-", "r");
|
||||
fgets(output, 256, f_out);
|
||||
if (output[0] == '\0')
|
||||
value = QString("N\\A");
|
||||
else
|
||||
value = QString(output).split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
pclose(f_out);
|
||||
setData(source, key, value);
|
||||
// mpd
|
||||
QString value_artist;
|
||||
value = QString("N\\A");
|
||||
value_album = QString("N\\A");
|
||||
value_artist = QString("N\\A");
|
||||
value_progress = QString("0");
|
||||
value_duration = QString("0");
|
||||
char commandStr[512];
|
||||
sprintf (commandStr, "echo 'currentsong\nclose' | curl --connect-timeout 1 -fsm 3 telnet://%s:%s 2> /dev/null", \
|
||||
mpdAddress.toUtf8().data(), mpdPort.toUtf8().data());
|
||||
f_out = popen(commandStr, "r");
|
||||
while (true)
|
||||
{
|
||||
fgets(output, 256, f_out);
|
||||
if (feof (f_out))
|
||||
break;
|
||||
if (QString(output).split(QString(": "), QString::SkipEmptyParts)[0] == QString("Artist"))
|
||||
value_artist = QString(output).split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
else if (QString(output).split(QString(": "), QString::SkipEmptyParts)[0] == QString("Title"))
|
||||
value = QString(output).split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
qoutput = QString("");
|
||||
player.start(QString(commandStr));
|
||||
player.waitForFinished(-1);
|
||||
qoutput = player.readAllStandardOutput();
|
||||
for (int i=0; i<qoutput.split(QString("\n"), QString::SkipEmptyParts).count(); i++) {
|
||||
qstr = qoutput.split(QString("\n"), QString::SkipEmptyParts)[i];
|
||||
if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("Album"))
|
||||
value_album = qstr.split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("Artist"))
|
||||
value_artist = qstr.split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("Time"))
|
||||
value_duration = qstr.split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("Title"))
|
||||
value = qstr.split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
}
|
||||
pclose(f_out);
|
||||
key = QString("mpd_album");
|
||||
setData(source, key, value_album);
|
||||
key = QString("mpd_artist");
|
||||
setData(source, key, value_artist);
|
||||
key = QString("mpd_progress");
|
||||
setData(source, key, value_progress);
|
||||
key = QString("mpd_duration");
|
||||
setData(source, key, value_duration);
|
||||
key = QString("mpd_title");
|
||||
setData(source, key, value);
|
||||
}
|
||||
|
@ -35,8 +35,8 @@ protected:
|
||||
bool readConfiguration();
|
||||
QStringList sources() const;
|
||||
// main configuration
|
||||
QStringList hdddev;
|
||||
QString gpudev;
|
||||
QStringList hddDev;
|
||||
QString gpuDev;
|
||||
// configuration
|
||||
QString mpdAddress;
|
||||
QString mpdPort;
|
||||
|
@ -13,7 +13,7 @@ X-Plasma-EngineName=ext-sysmon
|
||||
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
|
||||
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
||||
X-KDE-PluginInfo-Name=ext-sysmon
|
||||
X-KDE-PluginInfo-Version=1.5
|
||||
X-KDE-PluginInfo-Version=1.6
|
||||
X-KDE-PluginInfo-Category=System Information
|
||||
X-KDE-PluginInfo-Depends=
|
||||
X-KDE-PluginInfo-License=GPL
|
||||
|
@ -10,13 +10,16 @@ post_install()
|
||||
{
|
||||
func_update
|
||||
cat << EOF
|
||||
Make sure that \`hddtemp\` can be run as non-root
|
||||
Make sure that \`hddtemp\` can be run with sudo without password
|
||||
EOF
|
||||
}
|
||||
|
||||
post_upgrade()
|
||||
{
|
||||
func_update
|
||||
cat << EOF
|
||||
Make sure that \`hddtemp\` can be run with sudo without password
|
||||
EOF
|
||||
}
|
||||
|
||||
post_remove()
|
||||
|
Binary file not shown.
BIN
py-text-monitor-1.5.3.plasmoid
Normal file
BIN
py-text-monitor-1.5.3.plasmoid
Normal file
Binary file not shown.
@ -21,6 +21,7 @@ from PyQt4.QtGui import *
|
||||
from PyKDE4.plasma import Plasma
|
||||
from PyKDE4 import plasmascript
|
||||
|
||||
import datetime
|
||||
|
||||
|
||||
class DataEngine:
|
||||
@ -255,21 +256,34 @@ class DataEngine:
|
||||
self.parent.label_hddtemp.setText(text)
|
||||
elif (sourceName == "player"):
|
||||
if (self.parent.player_name == 0):
|
||||
title = str(data[QString(u'amarok_title')])
|
||||
album = str(data[QString(u'amarok_album')])
|
||||
artist = str(data[QString(u'amarok_artist')])
|
||||
progress = str(data[QString(u'amarok_progress')])
|
||||
time = str(data[QString(u'amarok_duration')])
|
||||
title = str(data[QString(u'amarok_title')])
|
||||
elif (self.parent.player_name == 1):
|
||||
title = str(data[QString(u'mpd_title')])
|
||||
album = str(data[QString(u'mpd_album')])
|
||||
artist = str(data[QString(u'mpd_artist')])
|
||||
progress = str(data[QString(u'mpd_progress')])
|
||||
time = str(data[QString(u'mpd_duration')])
|
||||
title = str(data[QString(u'mpd_title')])
|
||||
elif (self.parent.player_name == 2):
|
||||
title = str(data[QString(u'qmmp_title')])
|
||||
album = str(data[QString(u'qmmp_album')])
|
||||
artist = str(data[QString(u'qmmp_artist')])
|
||||
if (self.parent.playerFormat.split('$artist')[0] != self.parent.playerFormat):
|
||||
if ((len(artist) + len(title)) > 10):
|
||||
line = self.parent.playerFormat.split('$artist')[0] + artist[:5] + u"…" + self.parent.playerFormat.split('$artist')[1]
|
||||
else:
|
||||
line = self.parent.playerFormat.split('$artist')[0] + artist + self.parent.playerFormat.split('$artist')[1]
|
||||
else:
|
||||
progress = str(data[QString(u'qmmp_progress')])
|
||||
time = str(data[QString(u'qmmp_duration')])
|
||||
title = str(data[QString(u'qmmp_title')])
|
||||
line = self.parent.playerFormat
|
||||
if (line.split('$album')[0] != line):
|
||||
line = line.split('$album')[0] + album + line.split('$album')[1]
|
||||
if (line.split('$artist')[0] != line):
|
||||
line = line.split('$artist')[0] + artist + line.split('$artist')[1]
|
||||
if (line.split('$progress')[0] != line):
|
||||
timeText = '%02i:%02i' % (int(time)/60, int(time)%60)
|
||||
line = line.split('$progress')[0] + timeText + line.split('$progress')[1]
|
||||
if (line.split('$time')[0] != line):
|
||||
timeText = '%02i:%02i' % (int(time)/60, int(time)%60)
|
||||
line = line.split('$time')[0] + timeText + line.split('$time')[1]
|
||||
if (line.split('$title') != line):
|
||||
line = line.split('$title')[0] + title + line.split('$title')[1]
|
||||
text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1]
|
||||
|
@ -116,6 +116,7 @@ class pyTextWidget(plasmascript.Applet):
|
||||
# setup number of cores
|
||||
commandOut = commands.getoutput("grep -c '^processor' /proc/cpuinfo")
|
||||
self.numCores = int(commandOut)
|
||||
self.tempdev = "tempdevice"
|
||||
|
||||
# create dictionaries
|
||||
self.dict_orders = {'6':'bat', '1':'cpu', '7':'cpuclock', '9':'gpu', 'a':'gputemp',
|
||||
|
@ -298,12 +298,17 @@ class Reinit():
|
||||
self.parent.playerFormat = str(settings.get('playerFormat', '[$artist - $title]'))
|
||||
self.parent.player_name = settings.get('player_name', 0).toInt()[0]
|
||||
self.parent.label_player = NewPlasmaLabel(self.parent.applet, self.parent)
|
||||
if (self.parent.playerFormat.split('$artist')[0] != self.parent.playerFormat):
|
||||
line = self.parent.playerFormat.split('$artist')[0] + '----------' + self.parent.playerFormat.split('$artist')[1]
|
||||
else:
|
||||
line = self.parent.playerFormat
|
||||
if (line.split('$album')[0] != line):
|
||||
line = line.split('$album')[0] + 'N\\A' + line.split('$album')[1]
|
||||
if (line.split('$artist')[0] != line):
|
||||
line = line.split('$artist')[0] + 'N\\A' + line.split('$artist')[1]
|
||||
if (line.split('$progress')[0] != line):
|
||||
line = line.split('$progress')[0] + '00:00' + line.split('$progress')[1]
|
||||
if (line.split('$title') != line):
|
||||
line = line.split('$title')[0] + '----------' + line.split('$title')[1]
|
||||
line = line.split('$title')[0] + 'N\\A' + line.split('$title')[1]
|
||||
if (line.split('$time') != line):
|
||||
line = line.split('$time')[0] + '00:00' + line.split('$time')[1]
|
||||
text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1]
|
||||
self.parent.label_player.setText(text)
|
||||
self.parent.layout.addItem(self.parent.label_player)
|
||||
|
@ -948,8 +948,11 @@ $ac - AC status</string>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_player">
|
||||
<property name="toolTip">
|
||||
<string notr="true">$title - song title
|
||||
$artist - song artist</string>
|
||||
<string notr="true">$album - song album
|
||||
$artist - song artist
|
||||
$progress - song progress
|
||||
$time - song duration
|
||||
$title - song title</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
|
@ -12,7 +12,7 @@ X-Plasma-RequiredExtensions=LaunchApp,LocalIO,FileDialog
|
||||
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
|
||||
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
||||
X-KDE-PluginInfo-Name=py-text-monitor
|
||||
X-KDE-PluginInfo-Version=1.5.2
|
||||
X-KDE-PluginInfo-Version=1.5.3
|
||||
X-KDE-PluginInfo-Website=http://kde-look.org/
|
||||
X-KDE-PluginInfo-Category=System Information
|
||||
X-KDE-PluginInfo-Depends=
|
||||
|
Loading…
Reference in New Issue
Block a user