ports/90627: [NEW PORTS] multimedia/quodlibet

Byung-Hee HWANG bh at izb.knu.ac.kr
Thu Dec 22 03:20:13 UTC 2005


The following reply was made to PR ports/90627; it has been noted by GNATS.

From: Byung-Hee HWANG <bh at izb.knu.ac.kr>
To: bug-followup at FreeBSD.org
Cc: edwin at FreeBSD.org
Subject: Re: ports/90627: [NEW PORTS] multimedia/quodlibet
Date: Thu, 22 Dec 2005 12:15:01 +0900

 --5mCyUwZo2JvN/JJP
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 On Wed, Dec 21, 2005 at 10:10:07PM +0000, Byung-Hee HWANG wrote:
 > The following reply was made to PR ports/90627; it has been noted by GNATS.
 > 
 > From: Byung-Hee HWANG <bh at izb.knu.ac.kr>
 > To: bug-followup at FreeBSD.org
 > Cc: edwin at FreeBSD.org
 > Subject: Re: ports/90627: [NEW PORTS] multimedia/quodlibet
 > Date: Thu, 22 Dec 2005 07:08:29 +0900
 > 
 >  On Wed, Dec 21, 2005 at 10:00:19AM +0000, Byung-Hee HWANG wrote:
 >  >  On Wed, Dec 21, 2005 at 04:37:38AM +0000, Edwin Groothuis wrote:
 >  >  >   File "./check.py", line 20, in ?
 >  >  >     import gtk
 >  >  >   File "/usr/local/lib/python2.4/site-packages/gtk-2.0/gtk/__init__.py", line 37, in ?
 >  >  >     from _gtk import *
 >  >  > RuntimeError: could not open display
 >  >  > 
 >  >  > I take it this is an X issue. Wonder how other ports which require
 >  >  > X and sometimes require a terminal handle this on the package
 >  >  > building system.
 [...snip...]
 
 Reference: PR 53489
 
 viola# echo $DISPLAY
 DISPLAY: Undefined variable.
 viola# make configure
 ===>  Vulnerability check disabled, database not found
 ...
 ...
 ...
 ===>  Configuring for quodlibet-0.15
 /usr/X11R6/bin/Xvfb :1001 -screen 0 800x600x24 > /dev/null 2>&1 & echo
 $! >  /usr/ports/multimedia/quodlibet/work/.Xvfb.pid
 Checking Python version: 2.4
 Checking for PyGTK >= 2.6: found
 Checking for PyGSt >= 0.8.2: found
 ...
 ...
 ...
 
 Okay, it works fine. I reattach updated shar file.
 
 Sincerely,
 
 -- 
 Byung-Hee
 
 --5mCyUwZo2JvN/JJP
 Content-Type: application/x-shar
 Content-Disposition: attachment; filename="ports-quodlibet-20051221.shar"
 Content-Transfer-Encoding: quoted-printable
 
 # This is a shell archive.  Save it in a file, remove anything before=0A# t=
 his line, and then unpack it by entering "sh file".  Note, it may=0A# creat=
 e directories; files and directories will be owned by you and=0A# have defa=
 ult permissions.=0A#=0A# This archive contains:=0A#=0A#	/usr/ports/multimed=
 ia/quodlibet=0A#	/usr/ports/multimedia/quodlibet/Makefile=0A#	/usr/ports/mu=
 ltimedia/quodlibet/files=0A#	/usr/ports/multimedia/quodlibet/files/patch-Ma=
 kefile=0A#	/usr/ports/multimedia/quodlibet/files/qlscrobbler.py=0A#	/usr/po=
 rts/multimedia/quodlibet/distinfo=0A#	/usr/ports/multimedia/quodlibet/pkg-d=
 escr=0A#	/usr/ports/multimedia/quodlibet/pkg-plist=0A#=0Aecho c - /usr/port=
 s/multimedia/quodlibet=0Amkdir -p /usr/ports/multimedia/quodlibet > /dev/nu=
 ll 2>&1=0Aecho x - /usr/ports/multimedia/quodlibet/Makefile=0Ased 's/^X//' =
 >/usr/ports/multimedia/quodlibet/Makefile << 'END-of-/usr/ports/multimedia/=
 quodlibet/Makefile'=0AX# New ports collection makefile for:	quodlibet=0AX# =
 Date created:			19 December 2005=0AX# Whom:				Byung-Hee HWANG <bh at izb.knu.=
 ac.kr>=0AX#=0AX# $FreeBSD$=0AX#=0AX=0AXPORTNAME=3D	quodlibet=0AXPORTVERSION=
 =3D	0.15=0AXCATEGORIES=3D	multimedia audio=0AXMASTER_SITES=3D	http://www.sa=
 credchao.net/~piman/software/ \=0AX		http://izb.knu.ac.kr/~bh/software/=0AX=
 DISTNAME=3D	${PORTNAME}-${PORTVERSION}=0AX=0AXMAINTAINER=3D	bh at izb.knu.ac.k=
 r=0AXCOMMENT=3D	A GTK+-based audio player written in Python=0AX=0AXBUILD_DE=
 PENDS=3D	${PYTHON_SITELIBDIR}/gst/__init__.py:${PORTSDIR}/multimedia/py-gst=
 reamer \=0AX		${PYTHON_SITELIBDIR}/ogg/_ogg.so:${PORTSDIR}/audio/py-ogg \=
 =0AX		${PYTHON_SITELIBDIR}/ogg/vorbis.so:${PORTSDIR}/audio/py-vorbis \=0AX	=
 	${PYTHON_SITELIBDIR}/madmodule.so:${PORTSDIR}/audio/py-mad \=0AX		${PYTHON=
 _SITELIBDIR}/gtk-2.0/egg/__init__.py:${PORTSDIR}/x11-toolkits/py-gnome-extr=
 as=0AXRUN_DEPENDS=3D	${BUILD_DEPENDS}=0AX=0AXUSE_PYTHON=3D	2.3+=0AXUSE_GNOM=
 E=3D	pygtk2=0AXUSE_GMAKE=3D	yes=0AXUSE_X_PREFIX=3D	yes=0AXNO_BUILD=3D	yes=
 =0AX=0AX.if !defined(DISPLAY)=0AXBUILD_DEPENDS+=3D	Xvfb:${X_VFBSERVER_PORT}=
 =0AXDISPLAYHACK=3D	localhost:1001=0AX.endif=0AX=0AXpre-configure:=0AX.if !d=
 efined(DISPLAY)=0AX.if exists(${WRKDIR}/.Xvfb.pid)=0AX	@-${CAT} ${WRKDIR}/.=
 Xvfb.pid | ${XARGS} kill=0AX	@${RM} -f ${WRKDIR}/.Xvfb.pid=0AX.endif=0AX	${=
 X11BASE}/bin/Xvfb :1001 -screen 0 800x600x24 > /dev/null 2>&1 & ${ECHO_CMD}=
  $$! > \=0AX		${WRKDIR}/.Xvfb.pid=0AX.endif=0AX=0AXdo-configure:=0AX.if !de=
 fined(DISPLAY)=0AX	@${SETENV} DISPLAY=3D${DISPLAYHACK} ${PYTHON_CMD} ${WRKS=
 RC}/check.py=0AX.else=0AX	@${PYTHON_CMD} ${WRKSRC}/check.py=0AX.endif=0AX=
 =0AXpost-configure:=0AX.if !defined(DISPLAY)=0AX	@${CAT} ${WRKDIR}/.Xvfb.pi=
 d | ${XARGS} kill=0AX	@${RM} ${WRKDIR}/.Xvfb.pid=0AX.endif=0AX=0AXpost-inst=
 all:=0AX.if !defined(WITHOUT_PLUGINS)=0AX	@${MKDIR} ${PREFIX}/lib/${PORTNAM=
 E}/plugins=0AX	@${INSTALL_SCRIPT} ${FILESDIR}/qlscrobbler.py ${PREFIX}/lib/=
 ${PORTNAME}/plugins=0AX.endif=0AX=0AX.include <bsd.port.mk>=0AEND-of-/usr/p=
 orts/multimedia/quodlibet/Makefile=0Aecho c - /usr/ports/multimedia/quodlib=
 et/files=0Amkdir -p /usr/ports/multimedia/quodlibet/files > /dev/null 2>&1=
 =0Aecho x - /usr/ports/multimedia/quodlibet/files/patch-Makefile=0Ased 's/^=
 X//' >/usr/ports/multimedia/quodlibet/files/patch-Makefile << 'END-of-/usr/=
 ports/multimedia/quodlibet/files/patch-Makefile'=0AX--- Makefile.orig	2005-=
 11-11 08:06:26.000000000 -0700=0AX+++ Makefile	2005-12-21 17:30:49.44734188=
 5 -0700=0AX@@ -28,9 +28,9 @@=0AX install-%: make-install-dirs=0AX 	install =
 -m 755 $*.py $(DESTDIR)$(PREFIX)/$(TO)=0AX 	install -m 644 $*.1 $(DESTDIR)$=
 (PREFIX)/share/man/man1/$*.1=0AX-	install -D -m 644 $*.png $(DESTDIR)$(PREF=
 IX)/share/pixmaps/$*.png=0AX+	install -m 644 $*.png $(DESTDIR)$(PREFIX)/sha=
 re/pixmaps/$*.png=0AX 	install -m 644 $*.png $(DESTDIR)$(PREFIX)/$(TO)=0AX-=
 	install -D -m 644 $*.desktop $(DESTDIR)$(PREFIX)/share/applications/$*.des=
 ktop=0AX+	install -m 644 $*.desktop $(DESTDIR)$(PREFIX)/share/applications/=
 $*.desktop=0AX 	ln -sf ../$(TO)/$*.py $(DESTDIR)$(PREFIX)/bin/$*=0AX =0AX c=
 lean:=0AEND-of-/usr/ports/multimedia/quodlibet/files/patch-Makefile=0Aecho =
 x - /usr/ports/multimedia/quodlibet/files/qlscrobbler.py=0Ased 's/^X//' >/u=
 sr/ports/multimedia/quodlibet/files/qlscrobbler.py << 'END-of-/usr/ports/mu=
 ltimedia/quodlibet/files/qlscrobbler.py'=0AX# QLScrobbler: an Audioscrobble=
 r client plugin for Quod Libet.=0AX# version 0.7=0AX# (C) 2005 by Joshua Kw=
 an <joshk at triplehelix.org>,=0AX#             Joe Wreschnig <piman at sacredcha=
 o.net>=0AX# Licensed under GPLv2. See Quod Libet's COPYING for more informa=
 tion.=0AX=0AXimport random=0AXimport md5, urllib, urllib2, time, threading,=
  os=0AXimport player, config, const=0AXimport gobject, gtk=0AXfrom qltk imp=
 ort Message=0AXfrom util import to=0AX=0AXclass QLScrobbler(object):=0AX	# =
 session invariants=0AX	PLUGIN_NAME =3D "QLScrobbler"=0AX	PLUGIN_DESC =3D "A=
 udioscrobbler client for Quod Libet"=0AX	PLUGIN_ICON =3D gtk.STOCK_CONNECT=
 =0AX	PLUGIN_VERSION =3D "0.7"=0AX	CLIENT =3D "qlb"=0AX	PROTOCOL_VERSION =3D=
  "1.1"=0AX	DUMP =3D os.path.join(const.DIR, "scrobbler_cache")=0AX=0AX	# th=
 ings that could change=0AX	=0AX	username =3D ""=0AX	password =3D ""=0AX	pwh=
 ash =3D ""=0AX	=0AX	timeout_id =3D -1=0AX	submission_tid =3D -1=0AX=0AX	cha=
 llenge =3D ""=0AX	submit_url =3D ""=0AX	=0AX	# state management=0AX	waiting=
  =3D False=0AX	challenge_sent =3D False=0AX	broken =3D False=0AX	need_confi=
 g =3D False=0AX	need_update =3D False=0AX	already_submitted =3D False=0AX	l=
 ocked =3D False=0AX	flushing =3D False=0AX	disabled =3D False=0AX=0AX	# we =
 need to store this because not all events get the song=0AX	song =3D None=0A=
 X=0AX	queue =3D []=0AX=0AX	def __init__(self):=0AX		# Read dumped queue and=
  delete it=0AX		try:=0AX			dump =3D open(self.DUMP, 'r')=0AX			self.read_du=
 mp(dump)=0AX		except: pass=0AX		=0AX		# Set up exit hook to dump queue=0AX	=
 	gtk.quit_add(0, self.dump_queue)=0AX=0AX	def read_dump(self, dump):=0AX		p=
 rint "Loading dumped queue."=0AX	=0AX		current =3D {}=0AX=0AX		for line in =
 dump.readlines():=0AX			key =3D ""=0AX			value =3D ""=0AX			=0AX			line =3D=
  line.rstrip()=0AX			try: (key, value) =3D line.split(" =3D ", 1)=0AX			exc=
 ept:=0AX				if line =3D=3D "-":=0AX					for key in ["album", "mbid"]:=0AX		=
 				if key not in current:=0AX							current[key] =3D ""=0AX					=0AX					f=
 or reqkey in ["artist", "title", "length", "stamp"]:=0AX						# discard if =
 somehow invalid=0AX						if reqkey not in current:=0AX							current =3D {}=
 =0AX=0AX					if current !=3D {}:=0AX						self.queue.append(current)=0AX			=
 			current =3D {}=0AX				continue=0AX				=0AX			if key =3D=3D "length": cur=
 rent[key] =3D int(value)=0AX			else: current[key] =3D value=0AX=0AX		dump.c=
 lose()=0AX=0AX		os.remove(self.DUMP)=0AX=0AX#		print "Queue contents:"=0AX#=
 		for item in self.queue:=0AX#			print "\t%s - %s" % (item['artist'], item[=
 'title'])=0AX=0AX		# Try to flush it immediately=0AX		if len(self.queue) > =
 0:=0AX			self.flushing =3D True=0AX			self.submit_song()=0AX		else: print "=
 Queue was empty!"=0AX=0AX	def dump_queue(self):=0AX		if len(self.queue) =3D=
 =3D 0: return 0=0AX		=0AX		print "Dumping offline queue, will submit next t=
 ime."=0AX=0AX		dump =3D open(self.DUMP, 'w')=0AX		=0AX		for item in self.qu=
 eue:=0AX			for key in item:=0AX				dump.write("%s =3D %s\n" % (key, item[ke=
 y]))=0AX=0AX		dump.close()=0AX=0AX		return 0=0AX		=0AX	def plugin_on_remove=
 d(self, songs):=0AX		try:=0AX			if self.song in songs:=0AX				self.already_=
 submitted =3D True=0AX		except:=0AX			# Older version compatibility.=0AX			=
 if self.song is songs:=0AX				self.already_submitted =3D True=0AX=0AX	def p=
 lugin_on_song_ended(self, song, stopped):=0AX		if song is None: return=0AX=
 =0AX		if self.timeout_id > 0:=0AX			gobject.source_remove(self.timeout_id)=
 =0AX			self.timeout_id =3D -1=0AX	=0AX	def plugin_on_song_started(self, son=
 g):=0AX		if song is None: return=0AX		=0AX		self.already_submitted =3D Fals=
 e=0AX		if self.timeout_id > 0:=0AX			gobject.source_remove(self.timeout_id)=
 =0AX		=0AX		self.timeout_id =3D -1=0AX=0AX		# Protocol stipulation:=0AX		#	=
 * don't submit when length < 00:30=0AX		#     NOTE: >30:00 stipulation has =
 been REMOVED as of Protocol1.1=0AX		#	* don't submit if artist and title ar=
 e not available=0AX		if song["~#length"] < 30: return=0AX		elif 'title' not=
  in song: return=0AX		elif "artist" not in song:=0AX			if ("composer" not i=
 n song) and ("performer" not in song): return=0AX=0AX		self.song =3D song=
 =0AX		if player.playlist.paused =3D=3D False:=0AX			self.prepare()=0AX=0AX	=
 def plugin_on_paused(self):=0AX		if self.timeout_id > 0:=0AX			gobject.sour=
 ce_remove(self.timeout_id)=0AX			# special value that will tell on_unpaused=
  to check song length=0AX			self.timeout_id =3D -2=0AX=0AX	def plugin_on_un=
 paused(self):=0AX		if self.already_submitted =3D=3D False and self.timeout_=
 id =3D=3D -1: self.prepare()=0AX		=0AX	def plugin_on_seek(self, song, msec)=
 :=0AX		if self.timeout_id > 0:=0AX			gobject.source_remove(self.timeout_id)=
 =0AX			self.timeout_id =3D -1=0AX			=0AX		if msec =3D=3D 0: #I think this i=
 s okay!=0AX			self.prepare()=0AX		else:=0AX			self.already_submitted =3D Tr=
 ue # cancel=0AX		=0AX	def prepare(self):=0AX		if self.song is None: return=
 =0AX=0AX		# Protocol stipulations:=0AX		#	* submit 240 seconds in or at 50%=
 , whichever comes first=0AX		delay =3D int(min(self.song["~#length"] / 2, 2=
 40))=0AX=0AX		if self.timeout_id =3D=3D -2: # change delta based on current=
  progress=0AX			# assumption is that self.already_submitted =3D=3D 0, there=
 fore=0AX			# delay - progress > 0=0AX			progress =3D int(player.playlist.in=
 fo.time[0] / 1000)=0AX			delay -=3D progress=0AX=0AX		self.timeout_id =3D g=
 object.timeout_add(delay * 1000, self.submit_song)=0AX	=0AX	def read_config=
 (self):=0AX		username =3D ""=0AX		password =3D ""=0AX		try:=0AX			username =
 =3D config.get("plugins", "scrobbler_username")=0AX			password =3D config.g=
 et("plugins", "scrobbler_password")=0AX		except:=0AX			if self.need_config =
 =3D=3D False:=0AX				self.quick_info("Please visit the Preferences window t=
 o set QLScrobbler up. Until then, songs will not be submitted.")=0AX				sel=
 f.need_config =3D True=0AX				return=0AX		=0AX		self.username =3D username=
 =0AX		=0AX		hasher =3D md5.new()=0AX		hasher.update(password);=0AX		self.pa=
 ssword =3D hasher.hexdigest()=0AX		self.need_config =3D False=0AX=0AX	def _=
 _destroy_cb(self, dialog, response_id):=0AX		dialog.destroy()=0AX=0AX	def q=
 uick_error_helper(self, str):=0AX		dialog =3D Message(gtk.MESSAGE_ERROR, No=
 ne, "QLScrobbler", str)=0AX		dialog.connect('response', self.__destroy_cb)=
 =0AX		dialog.show()=0AX=0AX	def quick_error(self, str):=0AX		gobject.idle_a=
 dd(self.quick_error_helper, str)=0AX	=0AX	def quick_info_helper(self, str):=
 =0AX		dialog =3D Message(gtk.MESSAGE_INFO, widgets.widgets.main, "QLScrobbl=
 er", str).run()=0AX		dialog.connect('response', self.__destroy_cb)=0AX		dia=
 log.show()=0AX=0AX	def quick_info(self, str):=0AX		gobject.idle_add(self.qu=
 ick_info_helper, str)=0AX	=0AX	def clear_waiting(self):=0AX		self.waiting =
 =3D False=0AX=0AX	def send_handshake(self):=0AX		# construct url=0AX		url =
 =3D "http://post.audioscrobbler.com/?hs=3Dtrue&p=3D%s&c=3D%s&v=3D%s&u=3D%s"=
  % ( self.PROTOCOL_VERSION, self.CLIENT, self.PLUGIN_VERSION, self.username=
  )=0AX		=0AX		print "Sending handshake to Audioscrobbler."=0AX=0AX		resp =
 =3D None=0AX=0AX		try:=0AX			resp =3D urllib2.urlopen(url);=0AX		except:=0A=
 X			print "Server not responding, handshake failed."=0AX			return # challen=
 ge_sent is NOT set to 1=0AX			=0AX		# check response=0AX		lines =3D resp.re=
 ad().rstrip().split("\n")=0AX		status =3D lines.pop(0)=0AX=0AX		print "Hand=
 shake status: %s" % status=0AX			=0AX		if status =3D=3D "UPTODATE" or statu=
 s.startswith("UPDATE"):=0AX			if status.startswith("UPDATE"):=0AX				self.q=
 uick_info("A new plugin is available at %s! Please download it, or your Aud=
 ioscrobbler stats may not be updated, and this message will be displayed ev=
 ery session." % status.split()[1])=0AX				self.need_update =3D True=0AX=0AX=
 			# Scan for submit URL and challenge.=0AX			self.challenge =3D lines.pop(=
 0)=0AX=0AX			print "Challenge: %s" % self.challenge=0AX=0AX			# determine p=
 assword=0AX			hasher =3D md5.new()=0AX			hasher.update(self.password)=0AX		=
 	hasher.update(self.challenge)=0AX			self.pwhash =3D hasher.hexdigest()=0AX=
 =0AX			self.submit_url =3D lines.pop(0)=0AX			=0AX			self.challenge_sent =
 =3D True=0AX		elif status =3D=3D "BADUSER":=0AX			self.quick_error("Authent=
 ication failed: invalid username %s or bad password." % self.username)=0AX	=
 			=0AX			self.broken =3D True=0AX=0AX		# Honor INTERVAL if available=0AX		=
 try: interval =3D int(lines.pop(0).split()[1])=0AX		except: interval =3D 0=
 =0AX=0AX		if interval > 1:=0AX			self.waiting =3D True=0AX			gobject.timeou=
 t_add(interval * 1000, self.clear_waiting)=0AX			print "Server says to wait=
  for %d seconds." % interval=0AX	=0AX	def submit_song(self):=0AX		bg =3D th=
 reading.Thread(None, self.submit_song_helper)=0AX		bg.setDaemon(True)=0AX		=
 bg.start()=0AX=0AX	def submit_song_helper(self):=0AX		enabled =3D getattr(s=
 elf, 'PMEnFlag', False)=0AX		if enabled and self.disabled:=0AX			print "Plu=
 gin re-enabled - accepting new songs."=0AX			self.disabled =3D False=0AX			=
 if self.submission_tid !=3D -1:=0AX				gobject.source_remove(self.submissio=
 n_tid);=0AX				self.submission_tid =3D -1=0AX		elif not enabled and not sel=
 f.disabled: #if we've already printed=0AX			print "Plugin disabled - not ac=
 cepting any new songs."=0AX			self.disabled =3D True=0AX			if len(self.queu=
 e) > 0:=0AX				self.submission_tid =3D gobject.timeout_add(120 * 1000, self=
 .submit_song_helper)=0AX				print "Attempts will continue to submit the las=
 t %d songs." % len(self.queue)=0AX=0AX		if self.already_submitted =3D=3D Tr=
 ue or self.broken =3D=3D True: return=0AX=0AX		if self.flushing =3D=3D Fals=
 e:=0AX			stamp =3D time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime())=0AX	=
 =0AX			store =3D {=0AX				"title": self.song.comma("title"),=0AX				"length=
 ": str(self.song["~#length"]),=0AX				"album": self.song.comma("album"),=0A=
 X				"mbid": "", # will be correctly set if available=0AX				"stamp": stamp=
 =0AX			}=0AX=0AX			if "artist" in self.song:=0AX				store["artist"] =3D sel=
 f.song.comma("artist")=0AX			elif "composer" in self.song:=0AX				store["ar=
 tist"] =3D self.song.comma("composer")=0AX			elif "performer" in self.song:=
 =0AX				performer =3D self.song.comma('performer')=0AX				if performer[-1] =
 =3D=3D ")" and "(" in performer:=0AX					store["artist"] =3D performer[:per=
 former.rindex("(")].strip()=0AX				else:=0AX					store["artist"] =3D perfor=
 mer=0AX			elif "musicbrainz_trackid" in self.song:=0AX				store["mbid"] =3D=
  self.song["musicbrainz_trackid"]=0AX=0AX			self.queue.append(store)=0AX		e=
 lse: self.flushing =3D False=0AX		=0AX		if self.locked =3D=3D True:=0AX			#=
  another instance running, let it deal with this=0AX			return=0AX=0AX		self=
 .locked =3D True=0AX=0AX		while self.waiting =3D=3D True: time.sleep(1)=0AX=
 =0AX		# Read config, handshake, and send challenge if not already done=0AX	=
 	if self.challenge_sent =3D=3D False:=0AX			self.read_config()=0AX			if sel=
 f.broken =3D=3D False and self.need_config =3D=3D False:=0AX				self.send_h=
 andshake()=0AX		=0AX		# INTERVAL may have been set during handshake.=0AX		w=
 hile self.waiting =3D=3D True: time.sleep(1)=0AX			=0AX		if self.challenge_=
 sent =3D=3D False:=0AX			self.locked =3D False=0AX			return=0AX		=0AX		data=
  =3D {=0AX			'u': self.username,=0AX			's': self.pwhash=0AX		}=0AX		=0AX		#=
  Flush the cache=0AX		for i in range(len(self.queue)):=0AX			print to("Send=
 ing song: %s - %s" % (self.queue[i]['artist'], self.queue[i]['title']))=0AX=
 			data["a[%d]" % i] =3D self.queue[i]['artist'].encode('utf-8')=0AX			data=
 ["t[%d]" % i] =3D self.queue[i]['title'].encode('utf-8')=0AX			data["l[%d]"=
  % i] =3D str(self.queue[i]['length'])=0AX			data["b[%d]" % i] =3D self.que=
 ue[i]['album'].encode('utf-8')=0AX			data["m[%d]" % i] =3D self.queue[i]['m=
 bid']=0AX			data["i[%d]" % i] =3D self.queue[i]['stamp']=0AX		=0AX		(host, =
 file) =3D self.submit_url[7:].split("/") =0AX=0AX		resp =3D None=0AX		=0AX	=
 	try:=0AX			data_str =3D urllib.urlencode(data)=0AX			resp =3D urllib2.urlo=
 pen("http://" + host + "/" + file, data_str)=0AX		except:=0AX			print "Audi=
 oscrobbler server not responding, will try later."=0AX			self.locked =3D Fa=
 lse=0AX			return # preserve the queue, yadda yadda=0AX=0AX		resp_save =3D r=
 esp.read()=0AX		lines =3D resp_save.rstrip().split("\n")=0AX		=0AX		try: (s=
 tatus, interval) =3D lines=0AX		except:=0AX			try: status =3D lines[0]=0AX	=
 		except:=0AX				print "Truncated server response, will try later..."=0AX		=
 		self.locked =3D False=0AX				return=0AX			interval =3D None=0AX		=0AX		pr=
 int "Submission status: %s" % status=0AX=0AX		if status =3D=3D "BADAUTH":=
 =0AX			print "Attempting to re-authenticate."=0AX			self.challenge_sent =3D=
  False=0AX			self.send_handshake()=0AX			if self.challenge_sent =3D=3D Fals=
 e:=0AX				self.quick_error("Your Audioscrobbler login data is incorrect, so=
  you must re-enter it before any songs will be submitted.\n\nThis message w=
 ill not be shown again.")=0AX				self.broken =3D True=0AX		elif status =3D=
 =3D "OK":=0AX			self.queue =3D []=0AX		elif status.startswith("FAILED"):=0A=
 X			if status.startswith("FAILED Plugin bug"):=0AX				print "Plugin bug!? R=
 idiculous! Dumping queue contents."=0AX				for item in self.queue:=0AX					=
 for key in item:=0AX						print "%s =3D %s" % (key, item[key])=0AX			# poss=
 ibly handle other specific cases here for debugging later=0AX		else:=0AX			=
 print "Unknown response from server: %s" % status=0AX			print "Dumping full=
  response:"=0AX			print resp_save=0AX=0AX		if interval !=3D None: interval_=
 secs =3D int(interval.split()[1])=0AX		else: interval_secs =3D 0=0AX=0AX		i=
 f interval_secs > 1:=0AX			self.waiting =3D True=0AX			gobject.timeout_add(=
 interval_secs * 1000, self.clear_waiting)=0AX			print "Server says to wait =
 for %d seconds." % interval_secs=0AX=0AX		if self.disabled and len(self.que=
 ue) =3D=3D 0 and self.submission_tid !=3D -1:=0AX			print "All songs submit=
 ted, disabling retries."=0AX			gobject.source_remove(self.submission_tid)=
 =0AX			self.submission_tid =3D -1=0AX=0AX		self.already_submitted =3D True=
 =0AX		self.locked =3D False=0AX=0AX	def PluginPreferences(self, parent):=0A=
 X		def changed(entry, key):=0AX			# having two functions is unnecessary..=
 =0AX			config.set("plugins", "scrobbler_" + key, entry.get_text())=0AX=0AX	=
 	def destroyed(*args):=0AX			# if changed, let's say that things just got b=
 etter and we should=0AX			# try everything again=0AX			newu =3D None=0AX			=
 newp =3D None=0AX			try:=0AX				newu =3D config.get("plugins", "scrobbler_u=
 sername")=0AX				newp =3D config.get("plugins", "scrobbler_password")=0AX		=
 	except:=0AX				return=0AX=0AX			if self.username !=3D newu or self.passwor=
 d !=3D newp:=0AX				self.broken =3D False=0AX=0AX		table =3D gtk.Table(3, 2=
 )=0AX		table.set_col_spacings(3)=0AX		lt =3D gtk.Label(_("Please enter your=
  Audioscrobbler username and password."))=0AX		lt.set_size_request(260, -1)=
 =0AX		lu =3D gtk.Label(_("Username:"))=0AX		lp =3D gtk.Label(_("Password:")=
 )=0AX		for l in [lt, lu, lp]:=0AX			l.set_line_wrap(True)=0AX			l.set_align=
 ment(0.0, 0.5)=0AX		table.attach(lt, 0, 2, 0, 1, xoptions=3Dgtk.FILL)=0AX		=
 table.attach(lu, 0, 1, 1, 2, xoptions=3Dgtk.FILL)=0AX		table.attach(lp, 0, =
 1, 2, 3, xoptions=3Dgtk.FILL)=0AX		userent =3D gtk.Entry()=0AX		pwent =3D g=
 tk.Entry()=0AX		pwent.set_visibility(False)=0AX		pwent.set_invisible_char('=
 *')=0AX		table.set_border_width(6)=0AX=0AX		try: userent.set_text(config.ge=
 t("plugins", "scrobbler_username"))=0AX		except: pass=0AX		try: pwent.set_t=
 ext(config.get("plugins", "scrobbler_password"))=0AX		except: pass=0AX=0AX	=
 	table.attach(userent, 1, 2, 1, 2)=0AX		table.attach(pwent, 1, 2, 2, 3)=0AX=
 		pwent.connect('changed', changed, 'password')=0AX		userent.connect('chang=
 ed', changed, 'username')=0AX		table.connect('destroy', destroyed)=0AX		ret=
 urn table=0AEND-of-/usr/ports/multimedia/quodlibet/files/qlscrobbler.py=0Ae=
 cho x - /usr/ports/multimedia/quodlibet/distinfo=0Ased 's/^X//' >/usr/ports=
 /multimedia/quodlibet/distinfo << 'END-of-/usr/ports/multimedia/quodlibet/d=
 istinfo'=0AXMD5 (quodlibet-0.15.tar.gz) =3D 09b14d03e587af6ba929b18ed8e0df5=
 6=0AXSHA256 (quodlibet-0.15.tar.gz) =3D 20851cc270f17330204683b0a29ab86dcfb=
 bfdda0e1c399c8f97836347063cf5=0AXSIZE (quodlibet-0.15.tar.gz) =3D 476236=0A=
 END-of-/usr/ports/multimedia/quodlibet/distinfo=0Aecho x - /usr/ports/multi=
 media/quodlibet/pkg-descr=0Ased 's/^X//' >/usr/ports/multimedia/quodlibet/p=
 kg-descr << 'END-of-/usr/ports/multimedia/quodlibet/pkg-descr'=0AXQuod Libe=
 t is a GTK+-based audio player written in Python.=0AX=0AXWWW: http://www.sa=
 credchao.net/quodlibet/=0AEND-of-/usr/ports/multimedia/quodlibet/pkg-descr=
 =0Aecho x - /usr/ports/multimedia/quodlibet/pkg-plist=0Ased 's/^X//' >/usr/=
 ports/multimedia/quodlibet/pkg-plist << 'END-of-/usr/ports/multimedia/quodl=
 ibet/pkg-plist'=0AXbin/exfalso=0AXbin/quodlibet=0AXlib/quodlibet/exfalso.pn=
 g=0AXlib/quodlibet/exfalso.py=0AXlib/quodlibet/plugins/qlscrobbler.py=0AXli=
 b/quodlibet/ql-volume-max.png=0AXlib/quodlibet/ql-volume-medium.png=0AXlib/=
 quodlibet/ql-volume-min.png=0AXlib/quodlibet/ql-volume-zero.png=0AXlib/quod=
 libet/quodlibet.png=0AXlib/quodlibet/quodlibet.py=0AXlib/quodlibet/quodlibe=
 t.zip=0AXshare/applications/exfalso.desktop=0AXshare/applications/quodlibet=
 .desktop=0AXshare/locale/bg/LC_MESSAGES/quodlibet.mo=0AXshare/locale/de/LC_=
 MESSAGES/quodlibet.mo=0AXshare/locale/en_CA/LC_MESSAGES/quodlibet.mo=0AXsha=
 re/locale/en_GB/LC_MESSAGES/quodlibet.mo=0AXshare/locale/es/LC_MESSAGES/quo=
 dlibet.mo=0AXshare/locale/fi/LC_MESSAGES/quodlibet.mo=0AXshare/locale/fr/LC=
 _MESSAGES/quodlibet.mo=0AXshare/locale/gl/LC_MESSAGES/quodlibet.mo=0AXshare=
 /locale/he/LC_MESSAGES/quodlibet.mo=0AXshare/locale/it/LC_MESSAGES/quodlibe=
 t.mo=0AXshare/locale/nl/LC_MESSAGES/quodlibet.mo=0AXshare/locale/pl/LC_MESS=
 AGES/quodlibet.mo=0AXshare/locale/pt/LC_MESSAGES/quodlibet.mo=0AXshare/loca=
 le/ru/LC_MESSAGES/quodlibet.mo=0AXshare/man/man1/exfalso.1=0AXshare/man/man=
 1/quodlibet.1=0AXshare/pixmaps/exfalso.png=0AXshare/pixmaps/quodlibet.png=
 =0AX at dirrm lib/quodlibet/plugins=0AX at dirrm lib/quodlibet=0AEND-of-/usr/port=
 s/multimedia/quodlibet/pkg-plist=0Aexit=0A=0A
 --5mCyUwZo2JvN/JJP--



More information about the freebsd-ports-bugs mailing list