← Back to team overview

cairo-dock-team team mailing list archive

[Merge] lp:~eduardo-mucelli/cairo-dock-plug-ins-extras/Quote into lp:cairo-dock-plug-ins-extras

 

Eduardo Mucelli Rezende Oliveira has proposed merging lp:~eduardo-mucelli/cairo-dock-plug-ins-extras/Quote into lp:cairo-dock-plug-ins-extras.

Requested reviews:
  Cairo-Dock Team (cairo-dock-team)

For more details, see:
https://code.launchpad.net/~eduardo-mucelli/cairo-dock-plug-ins-extras/Quote/+merge/53812

Added Grouphug.us
-- 
https://code.launchpad.net/~eduardo-mucelli/cairo-dock-plug-ins-extras/Quote/+merge/53812
Your team Cairo-Dock Team is requested to review the proposed merge of lp:~eduardo-mucelli/cairo-dock-plug-ins-extras/Quote into lp:cairo-dock-plug-ins-extras.
=== modified file 'Quote/ChangeLog'
--- Quote/ChangeLog	2011-01-27 16:46:43 +0000
+++ Quote/ChangeLog	2011-03-17 13:36:24 +0000
@@ -1,3 +1,4 @@
+0.0.8:(March/17/2010): Added Grouphug.us.
 0.0.7:(January/27/2010): Fixing the message when there were no translation for only one word. Adding Vidademerda.com.br. Adding next quote button in the PopupDialog.
 0.0.6:(December/22/2010): Automatic fetch more quotes when all of them were already showed to the user, except for Quotationspage.com.
 0.0.5:(December/2/2010): Added Jokes2go.com.

=== added file 'Quote/GroupHugParser.py'
--- Quote/GroupHugParser.py	1970-01-01 00:00:00 +0000
+++ Quote/GroupHugParser.py	2011-03-17 13:36:24 +0000
@@ -0,0 +1,44 @@
+# This is a part of the external Quote applet for Cairo-Dock
+#
+# Author: Eduardo Mucelli Rezende Oliveira
+# E-mail: edumucelli@xxxxxxxxx or eduardom@xxxxxxxxxxx
+
+from sgmllib import SGMLParser
+
+class GroupHugParser(SGMLParser):
+
+	def reset(self):
+		SGMLParser.reset(self)
+		self.url = "http://grouphug.us/random";
+		self.quote = []
+		self.author = []
+		self.inside_div_element = False											  	# indica dentro da <div class="content"></div> tag
+		self.inside_div_p_element = False											# indica dentro da <div class="content"><p></p></div> tag
+		self.current_quote = ""
+
+	def start_div(self, attrs):
+		for name, value in attrs:
+			if name == "class" and value == "content":						   	 	# <dt class="content">...</dt>
+				self.inside_div_element = True
+
+	def end_div(self):
+		if self.inside_div_element:
+			self.quote.append(self.current_quote)
+			self.current_quote = ""												 	# reinicia o armazenador do conteudo
+			self.inside_div_element = False
+
+	def start_p(self, attrs):
+		if self.inside_div_element:
+			self.inside_div_p_element = True
+
+	def end_p(self):
+		# if self.inside_div_element:
+		self.inside_div_p_element = False
+											   										# adiciona o conteudo completo da tag
+	def handle_data(self, text):
+		if self.inside_div_p_element:												# estamos dentro de <div><p>...</p></div>
+			self.current_quote += text
+
+	def parse(self, page):
+		self.feed(page)															 	# feed the parser with the page's html
+		self.close() 

=== modified file 'Quote/Quote.conf'
--- Quote/Quote.conf	2011-02-25 01:02:47 +0000
+++ Quote/Quote.conf	2011-03-17 13:36:24 +0000
@@ -1,4 +1,4 @@
-#!en;0.0.7
+#!en;0.0.8
 
 #[gtk-about]
 [Icon]
@@ -98,5 +98,5 @@
 
 #[gtk-preferences]
 [Configuration]
-#l[Quotationspage.com;Bash.org;Xkcdb.com;Qdb.us;Danstonchat.com;Jokes2go.com;Vidademerda.com.br] Quote source:
+#l[Quotationspage.com;Bash.org;Xkcdb.com;Qdb.us;Danstonchat.com;Jokes2go.com;Vidademerda.com.br;Grouphug.us] Quote source:
 source = 0

=== modified file 'Quote/auto-load.conf'
--- Quote/auto-load.conf	2011-02-23 01:56:34 +0000
+++ Quote/auto-load.conf	2011-03-17 13:36:24 +0000
@@ -10,7 +10,7 @@
 category = 7
 
 # Version of the applet; change it everytime you change something in the config file. Don't forget to update the version both in this file and in the config file.
-version = 0.0.7
+version = 0.0.8
 
 # Whether the applet can be instanciated several times or not.
 multi-instance = true