View previous topic :: View next topic |
Author |
Message |
nightm4re Guru
Joined: 20 Jun 2004 Posts: 519 Location: Providence, RI, USA
|
Posted: Sun Dec 05, 2004 4:25 pm Post subject: |
|
|
Swoosh wrote: | use one of those free proxies?
http://www.the-cloak.com/
nightmare, how can i fix the script by pmazer so that it doesn't have the '&' problem? |
i don't know python. in perl, it would be:
Code: |
$title =~ s/&/&/g;
|
i don't know how python works at all _________________ Nitrogen - GtkMM based background setter/restorer, please test!
Minuslab | d.minuslab.net |
|
Back to top |
|
|
Swoosh Apprentice
Joined: 19 Sep 2004 Posts: 203
|
Posted: Thu Dec 09, 2004 5:19 pm Post subject: |
|
|
Could someone with python knowledge fix this please? |
|
Back to top |
|
|
pmazer n00b
Joined: 09 Oct 2004 Posts: 22
|
Posted: Fri Dec 10, 2004 1:20 am Post subject: Try this |
|
|
Try this edited version. I haven't tried it, because I have no songs with a "&" as far as I know, but it should work as far as I can tell:
Code: |
#! /usr/bin/python
__license__ = """
pyobmpc, a Python client for mpd (Music Player Daemon) in OpenBox menus based on Nick Welch's py-libmpdclient
Copyright (C) 2004 Parker McGee <pmazer at gmail.com>
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2.1 of the License, or (at your option) any
later version.
This library 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 Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License along
with this library; if not, write to the Free Software Foundation, Inc., 59
Temple Place, Suite 330, Boston, MA 02111-1307 USA"""
import mpdclient
import sys
import re
## Edit this line ##
controller = mpdclient.MpdController("localhost", 6600)
this_file = sys.argv[0]
if len(sys.argv) == 1 or sys.argv[1] == "menu":
status = controller.status()
print '<?xml version="1.0" encoding="UTF-8"?>'
print "<openbox_pipe_menu>"
if controller.getCurrentSong():
print '<item label="' + re.sub("&", "&", controller.getCurrentSong().artist) + " - " + re.sub("&", "&", controller.getCurrentSong().title) + '"></item>'
elif controller.playlist():
print '<item label="No Song Being Played"></item>'
else:
print '<item label="No Playlist"></item>'
print "<separator />"
if status.state == 1 or status.state == 3:
print '<item label="Play"><action name="Execute"><execute>' + this_file + ' play</execute></action></item>'
if status.state == 2:
print '<item label="Stop"><action name="Execute"><execute>' + this_file + ' stop</execute></action></item>'
print '<item label="Pause"><action name="Execute"><execute>' + this_file + ' pause</execute></action></item>'
print "<separator />"
print '<item label="Next Song"><action name="Execute"><execute>' + this_file + ' next</execute></action></item>'
print '<item label="Previous Song"><action name="Execute"><execute>' + this_file + ' prev</execute></action></item>'
print "<separator />"
if status.random == True:
print '<item label="Set Not Random"><action name="Execute"><execute>' + this_file + ' random</execute></action></item>'
else:
print '<item label="Set Random"><action name="Execute"><execute>' + this_file + ' random</execute></action></item>'
if status.repeat == True:
print '<item label="Set Not Repeat"><action name="Execute"><execute>' + this_file + ' repeat</execute></action></item>'
else:
print '<item label="Set Repeat"><action name="Execute"><execute>' + this_file + ' repeat</execute></action></item>'
print "</openbox_pipe_menu>"
elif sys.argv[1] == "play":
controller.play()
elif sys.argv[1] == "stop":
controller.stop()
elif sys.argv[1] == "pause":
controller.pause()
elif sys.argv[1] == "next":
controller.next()
elif sys.argv[1] == "prev":
controller.prev()
elif sys.argv[1] == "random":
controller.random()
elif sys.argv[1] == "repeat":
controller.repeat()
|
Last edited by pmazer on Fri Dec 10, 2004 1:25 am; edited 1 time in total |
|
Back to top |
|
|
grad_guy Tux's lil' helper
Joined: 16 Nov 2004 Posts: 109 Location: UCSD, La Jolla, CA
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|