Re: Conky Rhythmbox Python Script
Quote:
Originally Posted by
DarkTide
Hi all,
kaivalagi this script print this in python >= 2.7:
conkyRhythmbox.py", line 45
self.parser.add_option("-t", "--template", dest="template", type="string", metavar="FILE", help=u"define a template file to generate output in one call. A displayable item in the file is in the form [--datatype=TI]. The following are possible options within each item: --datatype,--ratingchar. Note that the short forms of the options are not currently supported! None of these options are applicable at command line when using templates.")
I think that optparse module is deprecated, more info in:
http://docs.python.org/library/optparse.html
I don't a python programmer.
Thanks for the great script !!!
I am using python v2.7.1...no issues here. Are you using an up-to-date script? I recall an issue in the past but can't remember if I fixed it or it was python 3.0 related issues...
Code:
[USER@towerpc1 ~]$ python --version
Python 2.7.1
[USER@towerpc1 ~]$ conkyRhythmbox --version
conkyRhythmbox v.2.17
[USER@towerpc1 ~]$ conkyRhythmbox -h
Usage: conkyRhythmbox.py [options]
Options:
-h, --help show this help message and exit
-t FILE, --template=FILE
define a template file to generate output in one call.
A displayable item in the file is in the form
[--datatype=TI]. The following are possible options
within each item: --datatype,--ratingchar. Note that
the short forms of the options are not currently
supported! None of these options are applicable at
command line when using templates.
-d DATATYPE, --datatype=DATATYPE
[default: TI] The data type options are: ST (status),
CA (coverart), TI (title), AL (album), AR (artist), GE
(genre), YR (year), TN (track number), FN (file name),
BR (bitrate k/s), LE (length), PP (current position in
percent), PT (current position in time), VO (volume),
RT (rating). Not applicable at command line when using
templates.
-c PATH, --coverartpath=PATH
[default: /tmp/cover] The file where coverart gets
copied to if found when using the --datatype=CA
option. Note that if set to an empty string i.e. ""
the original file path is provided for the coverart
path.
-r CHAR, --ratingchar=CHAR
[default: *] The output character for the ratings
scale. Command line option overridden if used in
templates.
-s TEXT, --statustext=TEXT
[default: Playing,Paused,Stopped] The text must be
comma delimited in the form 'A,B,C'. Command line
option overridden if used in templates.
-n, --nounknownoutput
Turn off unknown output such as "Unknown" for title
and "0:00" for length. Command line option overridden
if used in templates.
-S, --secondsoutput Force all position and length output to be in seconds
only.
-m LENGTH, --maxlength=LENGTH
[default: 0] Define the maximum length of any
datatypes output, if truncated the output ends in
"..."
-v, --verbose Request verbose output, not a good idea when running
through conky!
-V, --version Displays the version of the script.
--errorlogfile=FILE If a filepath is set, the script appends errors to the
filepath.
--infologfile=FILE If a filepath is set, the script appends info to the
filepath.
Re: Conky Rhythmbox Python Script
Quote:
Originally Posted by
kaivalagi
I am using python v2.7.1...no issues here. Are you using an up-to-date script? I recall an issue in the past but can't remember if I fixed it or it was python 3.0 related issues...
Code:
[USER@towerpc1 ~]$ python --version
Python 2.7.1
[USER@towerpc1 ~]$ conkyRhythmbox --version
conkyRhythmbox v.2.17
HMMMMMMMMMMMM!!!!!!!
Code:
14:27 ~
$ python --version
Python 2.6.6
14:27 ~
$ conkyRhythmbox --version
conkyRhythmbox v.2.18
14:28 ~
$
Less Python more conkyRhythmbox :D
Re: Conky Rhythmbox Python Script
can someone tell me how to apply this script.... everything is installed but i dont know how to use the script...
Re: Conky Rhythmbox Python Script
I've installed 11.10 and got everything in my old Maverick conky working except for Rhythmbox
Code:
RHYTHMBOX (ELEVATOR MUSIC) ${hr 1}
${font Arial:size=8}
${voffset 4}Artist:${alignr}${exec conkyRhythmbox --datatype=AR}${font}
${voffset 4}${alignr}${exec conkyRhythmbox --datatype=TI}${font}
${voffset 4}Duration:${alignr}${exec conkyRhythmbox --datatype=PT}#${font}
${endif}
I've reinstalled it with no result - is there something missing from the code perchance? Thanks!
Re: Conky Rhythmbox Python Script
Quote:
Originally Posted by
von Stalhein
I've installed 11.10 and got everything in my old Maverick conky working except for Rhythmbox
Code:
RHYTHMBOX (ELEVATOR MUSIC) ${hr 1}
${font Arial:size=8}
${voffset 4}Artist:${alignr}${exec conkyRhythmbox --datatype=AR}${font}
${voffset 4}${alignr}${exec conkyRhythmbox --datatype=TI}${font}
${voffset 4}Duration:${alignr}${exec conkyRhythmbox --datatype=PT}#${font}
${endif}
I've reinstalled it with no result - is there something missing from the code perchance? Thanks!
Try running a conkyRhythmbox command in the console with the verbose option on so you see what is happening e.g.
Code:
conkyRhythmbox --datatype=TI --verbose
This should explain things a little better...
Re: Conky Rhythmbox Python Script
Thanks kaivalagi - I should have remembered that from re-setting up my Conky script in the fresh install of 11.10 :(
Anyway, it's calling the wrong interface (I think?) - any suggestions on what/how to adjust?
Code:
*** INITIAL OPTIONS:
datatype: TI
template: None
ratingchar: *
nounknownoutput: False
secondsoutput: False
maxlength: 0
verbose: True
errorlogfile: None
infologfile: None
INFO: Calling dbus interface for music data
INFO: Setting up dbus interface
INFO: Calling dbus interface for music data
ERROR: Issue calling the dbus service:org.freedesktop.DBus.Error.UnknownMethod: Method "getVolume" with signature "" on interface "org.gnome.Rhythmbox.Player" doesn't exist
Unknown
Re: Conky Rhythmbox Python Script
Please help with conky Rhythmbox. Basically, the album art is not showing in conky.
It IS showing in my /home/davejr/.album directory.
I do have conky Rhythmbox installed via synaptic.
Terminal is spitting this out:
Quote:
sh: ret: not found
sh: albumart: not found
Conky: Unable to load image '/home/davejr/.album'
Conky: Unable to load image '/home/davejr/.album'
Conky: Unable to load image '/home/davejr/.album'
sh: ret: not found
sh: albumart: not found
Conky: Unable to load image '/home/davejr/.album'
Here is relevant section:
Code:
${voffset -110}${font Arial:bold:size=10}${color5}RHYTHMBOX ${color8}${hr 2}
${goto 100}${font Arial:bold:size=8}${color0}${exec rhythmbox-client --print-playing-format %tt}
${goto 100}${font Arial:bold:size=8}${color0}${exec rhythmbox-client --print-playing-format %ta}$font${exec ret}
${execi 1 albumart}${image /home/davejr/.album -p 0,500 -s 64x64}
Re: Conky Rhythmbox Python Script
Quote:
Originally Posted by
kaivalagi
Thought this would get you started, any more mpd posts need to go elsewhere though, PM me if you want :)
Here's part of my conkyrc for mpd:
Code:
.
.
.
mpd_host <IP ADDRESS_OF_SERVICE>
mpd_password <PASSWORD>
mpd_port 6600
TEXT
${image $HOME/.scripts/conky/opaque.png -p -1,-1 -s 260x329}
$if_mpd_playing${font Liberation Sans:style=Bold:size=6}${alignr 10}${if_match "$mpd_repeat" == "On"}REPEAT$endif
${alignr 10}${if_match "$mpd_random" == "On"}SHUFFLE$endif
${voffset 200}
${color2}${font}${mpd_bar 10,256}
${voffset 5}${color2}${font}${goto 15}${mpd_elapsed}/${mpd_length} - ${mpd_percent}%${alignr 5}${mpd_status} ${mpd_bitrate}k/s
${voffset 5}${color1}${font Liberation Sans:style=Bold:size=9}${alignc}${mpd_title}
${font}${alignc}${color2} from the album ${color1}${font Liberation Sans:style=Bold:size=9}${mpd_album}
${color2}${font}${alignc} by ${color1}${font Liberation Sans:style=Bold:size=9}${mpd_artist}
${color2}${hr}
${if_existing /tmp/lyrics}${image $HOME/.scripts/conky/opaque.png -p -1,330 -s 260x565}
${color1}${font Liberation Sans:style=Bold:size=9}${exec fold -s -w 40 /tmp/lyrics | sed 's/^/ /'}
${color2}${hr}$endif
${if_existing /tmp/cover}${image /tmp/cover -p 4,4 -s 254x254 -n}$endif
$endif
And here are the 2 scripts I use with mpdcron, for me they need to live in $HOME/.mpdcron/hooks/ to get fired on track changes. Note the red text is what is made available by mpdcron
coverart.sh:
Code:
#!/usr/bin/env sh
##### get coverart linked #####
coverfile="$HOME/.covers/$MPD_SONG_TAG_ARTIST-$MPD_SONG_TAG_ALBUM.jpg"
outputcoverfile="/tmp/cover"
if [ -f "$coverfile" ]; then
rm -f "$outputcoverfile"
echo "coverart.sh - Linking '$outputcoverfile' to cover file '$coverfile'"
ln -s "$coverfile" "$outputcoverfile"
else
echo "coverart.sh - No matching cover art file found here: '$coverfile'"
rm -f "$outputcoverfile"
fi
lyrics.sh:
Code:
#!/usr/bin/env sh
# get lyrics (if found) and copy it to /tmp/lyrics
lyricsfile="$HOME/.lyrics/$MPD_SONG_TAG_ARTIST-$MPD_SONG_TAG_TITLE.txt"
outputlyricsfile="/tmp/lyrics"
if [ -f "$lyricsfile" ]; then
rm -f "$outputlyricsfile"
echo "lyrics.sh - Linking '$outputlyricsfile' to cover file '$lyricsfile'"
ln -s "$lyricsfile" "$outputlyricsfile"
else
rm -f "$outputlyricsfile"
fi
Hi kaivalagi, Can I ask for your help with mpdcron?
I use it "standalone", not for conky purposes, but I adapt your script for displaying the album cover in the notification...However I cannot get it work.
mpdcron reads the album art in the format Artist - Album from a selected folder.
With the script, I successfully create a symbolic link of the cover in the folder ~/.covers but mpdcron does not show the album art anyway.
Here's the modified script:
Code:
#!/usr/bin/env sh
# get cover (if found) and link it to /tmp/cover
coverfile="$HOME/Musica/Album/$MPD_SONG_TAG_ARTIST/$MPD_SONG_TAG_ALBUM/cover.jpg"
outputcoverfile="$HOME/.covers/$MPD_SONG_TAG_ARTIST - $MPD_SONG_TAG_ALBUM"
if [ -f "$coverfile" ]; then
#rm -f "$outputcoverfile"
echo "coverart.sh - Linking '$outputcoverfile' to cover file '$coverfile'"
ln -s "$coverfile" "$outputcoverfile"
else
echo "coverart.sh - No matching cover art file found here: '$coverfile'"
rm -f "$outputcoverfile"
fi
Here's mpdcron config file:
Code:
# mpdcron example configuration
# vim: set et sw=4 sts=4 tw=80 ft=desktop :
# Copy this file to MPDCRON_DIR/mpdcron.conf where MPDCRON_DIR is
# ~/.mpdcron by default.
# mpdcron related options are specified in the main group
[main]
# Location of the pid file.
# pidfile = /var/run/mpdcron.pid
# Wait this many seconds after sending signal to kill the daemon
killwait = 3
# Mpd related options are specified in the mpd group.
[mpd]
# The list of events to wait for
events = database;stored_playlist;playlist;player;mixer;output;options;update
# Inverval in seconds for reconnecting to Mpd.
reconnect = 5
# Timeout in milliseconds for Mpd timeout, 0 for default timeout of
# libmpdclient.
timeout = 0
[player]
# modules is a semicolon delimited list of modules to load.
modules = notification;scrobbler
[main]
modules = notification
[notification]
# Covers path, defaults to ~/.covers
cover_path = ~/.covers
# Cover suffix, defaults to jpg
cover_suffix =
# Notification timeout in milliseconds.
timeout = 50000
# Notification type
type = mpd
# Notification urgency, one of low, normal, critical
urgency = normal
# Notification hints in format TYPE:NAME:VALUE, specifies basic extra data
# to pass. Valid types are int, double, string and byte
hints =
Finally, here's the error that mpdcron gives me:
Code:
Sending status & currentsong commands to Mpd server
[notification] Failed to find cover for album (Tool - 10,000 Days), suffix:
[notification] Sending notify for song (Tool - Jambi), id: 517, pos: 1
Setting environment variable MC_CALLS_PLAYER=1
Running hook: hooks/player home directory: /home/milo/.mpdcron
Sending idle command with mask 0xff
As you can see, mpdcron complains about not finding the cover for the album, but I can assure you that in ~/.covers I've got a jpg file named Tool - 10,000 Days.
I searched up and down for a solution but nothing...
So, having used your script, I try here but feel free to say if I am too much OT or if I bothered you.
Thank you very much.
Re: Conky Rhythmbox Python Script
mmmmmm, I am not sure I can be of help but what you are trying to do seems a big wrong to me as you are attempting to feed one function of mpdcron (notification) using another (script to link cover art)...maybe mpdcron is attempting to notify before the sym linking is done?
Some more thoughts which could well lead nowhere:
The output indicates there is no known suffix even though it should be jpg by default:
Code:
Sending status & currentsong commands to Mpd server
[notification] Failed to find cover for album (Tool - 10,000 Days), suffix:
Code:
# Cover suffix, defaults to jpg
cover_suffix =
So what happens if you use, any difference?:
Code:
# Cover suffix, defaults to jpg
cover_suffix = jpg
Also what happens if instead of sym linking the cover art you copy it?
Re: Conky Rhythmbox Python Script
First of all, let me thank you for your help, you are very kind...
Quote:
Originally Posted by
kaivalagi
maybe mpdcron is attempting to notify before the sym linking is done?
Exactly the first thing I thought. However, If i manually put the cover with the correct filename in the correct path, previous to start reproducing it I get the same error anyway.
Quote:
The output indicates there is no known suffix even though it should be jpg by default:
...
So what happens if you use, any difference?:
I tried several combination, no suffix, suffix specified, filename with suffix, filename without it...always the same error!
Quote:
Also what happens if instead of sym linking the cover art you copy it?
Same error again...
Thank you anyway!!