How do I use Conky with Pogo and Cover Art?
A friend of mine asked me to create a Conky with Album Cover Art for the desktop..
This is what I created
There are three files that will need to be created and saved to your /home directory
I will have three separate answers to this question with each file and explanation in the answer
NOTE : You WILL need the latest version of Pogo from trunk:
If you want to run the latest code from the trunk repository follow those steps in a terminal:
# Move into your home directory
cd
# Install bazaar if you don't have it
sudo apt-get install bazaar
bzr branch lp:pogo
cd pogo
./pogo.py
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Pogo Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- VastOne
- Solved:
- Last query:
- Last reply:
Revision history for this message
|
#1 |
Save everything below the solid line as conkyPogo.py and make sure it is executable. This is the engine to pull the MPRIS data from Pogo
_______
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#######
# conkyPogo.py is a simple python script to gather
# details from Pogo for use in conky.
#
# Author: VastOne
# Based on Kaivalagi Python Scripts
# Created: 09/022/2011
from datetime import datetime
from optparse import OptionParser
import sys
import traceback
import codecs
import os
import htmllib
import re
from htmlentitydefs import name2codepoint
import shutil
import urllib
try:
import dbus
DBUS_AVAIL = True
except ImportError:
# Dummy D-Bus library
class _Connection:
get_object = lambda *a: object()
class _Interface:
__init__ = lambda *a: None
ListNames = lambda *a: []
class Dummy: pass
dbus = Dummy()
dbus.Interface = _Interface
dbus.service = Dummy()
dbus.
dbus.
dbus.SessionBus = _Connection
DBUS_AVAIL = False
class CommandLineParser:
parser = None
def __init__(self):
self.parser = OptionParser()
def parse_args(self):
(options, args) = self.parser.
return (options, args)
def print_help(self):
return self.parser.
class MusicData:
def __init_
self.status = status
self.title = title
self.album = album
self.length = length
self.artist = artist
self.genre = genre
self.year = year
self.rating = rating
self.volume = volume
class PogoInfo:
error = u""
musicData = None
def __init__(self, options):
def testDBus(self, bus, interface):
obj = bus.get_
dbus_iface = dbus.Interface(obj, 'org.freedeskto
avail = dbus_iface.
return interface in avail
def getOutputData(self, datatype, ratingchar, statustext, nounknownoutput, maxlength):
output = u""
if nounknownoutput == True:
else:
try:
bus = dbus.SessionBus()
if self.musicData == None:
if self.testDBus(bus, 'org.mpris.pogo'):
if self.musicData != None:
if datatype == "ST": #status
if output == None or self.musicData == None:
if datatype in ["LE","PT"]:
if maxlength > 0 and len(output) > maxlength:
return output
except SystemExit:
return u""
except Exception, e:
return u""
def getStatusText(self, status, statustext):
if status != None:
if status == 0:
elif status == 1:
elif status == 2:
else:
return status
def getTemplateItem
# keys to template data
datatype = None
ratingchar = self.options.
statustext = self.options.
maxlength = self.options.
for option in template_
if len(option) == 0 or option.isspace():
# not using split here...it can't assign both key and value in one call, this should be faster
x = option.find('=')
if (x != -1):
key = option[:x].strip()
if value == "":
else:
key = option.strip()
try:
if key == DATATYPE_KEY:
except (TypeError, ValueError):
if datatype != None:
return self.getOutputD
else:
return u""
def getOutputFromTe
output = u""
end = False
a = 0
# a and b are indexes in the template string
# moving from left to right the string is processed
# b is index of the opening bracket and a of the closing bracket
# everything between b and a is a template that needs to be parsed
while not end:
b = template.find('[', a)
if b == -1:
b = len(template)
end = True
# if there is something between a and b, append it straight to output
if b > a:
# check for the escape char (if we are not at the end)
if template[b - 1] == '\\' and not end:
if end:
a = template.find(']', b)
if a == -1:
# if there is some template text...
if a > b + 1:
a = a + 1
return output
def writeOutput(self):
if self.options.
#load the file
try:
except Exception, e:
else:
else:
output = self.getOutputD
print output.
def isNumeric(
try:
temp = int(value)
return True
except:
return False
def logInfo(self, text):
if self.options.
print >> sys.stdout, "INFO: " + text
if self.options.
def logError(self, text):
print >> sys.stderr, "ERROR: " + text
if self.options.
def unEscape(
parser = htmllib.
return parser.save_end()
def htmlentitydecod
return re.sub('&(%s);' % '|'.join(
def main():
parser = CommandLineParser()
(options, args) = parser.parse_args()
if options.version == True:
print >> sys.stdout,
else:
if options.verbose == True:
print >> sys.stdout, "*** INITIAL OPTIONS:"
print >> sys.stdout, " datatype:", options.datatype
print >> sys.stdout, " template:", options.template
print >> sys.stdout, " ratingchar:", options.ratingchar
print >> sys.stdout, " nounknownoutput:", options.
print >> sys.stdout, " secondsoutput:", options.
print >> sys.stdout, " maxlength:", options.maxlength
print >> sys.stdout, " verbose:", options.verbose
print >> sys.stdout, " errorlogfile:
print >> sys.stdout, " infologfile:
pogoinfo = PogoInfo(options)
if __name__ == '__main__':
main()
sys.exit()
Revision history for this message
|
#2 |
Save everything below the solid line as conkyPogo.template and make sure it is executable. This is the file that you would edit to your tastes in the appearance, size and location of the conky on your desktop
_______
${color #F6F6F6}
${#F6F6F6}
${#F6F6F6}
${#F6F6F6}
${color #F6F6F6}${execibar 1 ~/conkyPogo.py --datatype=PP}
Pogo ${color sky blue} - ${#F6F6F6}
${image ~/.config/
Revision history for this message
|
#3 |
Save everything below the solid line as .conkypogorc and make sure it is executable. Note the spaces at the end of this and make sure you include them... They are necessary for the image to fit within the conky.. You can adjust these to your tastes...
This is the conky rc file that you would start this way
conky -c ~/.conkypogorc -q -d &
_______
# .conkypogorc - Edited from various examples across the 'net
# Used by VastOne on #! Debian Wheezy
use_xft yes
xftfont Sans:size=12
alignment top_right
xftalpha 0.9
own_window yes
own_window_
own_window_type desktop
own_window_
own_window_class Conky
own_window_hints undecorated,
double_buffer yes
draw_shades no
draw_outline no
draw_borders no
stippled_borders 10
border_outer_margin 40
border_width 1
default_shade_color grey
default_
default_color white
use_spacer yes
no_buffers yes
uppercase no
imlib_cache_size 0
text_buffer_size 2048
default_bar_size 335 9
total_run_times 0
update_interval 1
cpu_avg_samples 1
net_avg_samples 1
override_
minimum_size 375 5
maximum_width 335
#minimum_size 375
gap_x 5
gap_y 30
# colors
color1 B9CDD4
color2 white
color3 white
color4 BAF58B
TEXT
${execp ~/conkyPogo.py --template=
Revision history for this message
|
#4 |
In the above file there is to be 19 blank lines after:
${execp ~/conkyPogo.py --template=
It did not show up on the post