Skip to content

Instantly share code, notes, and snippets.

@mkrentovskiy
Created July 20, 2011 08:03
Show Gist options
  • Select an option

  • Save mkrentovskiy/1094551 to your computer and use it in GitHub Desktop.

Select an option

Save mkrentovskiy/1094551 to your computer and use it in GitHub Desktop.
def listStreams(self):
r = "Streams:\n"
c = self.db.cursor()
c.execute('SELECT id, url, type, en, state FROM streams ORDER BY en, id')
for i in c.fetchall():
num = "%05d" % i[0]
if i[3] == 1: en = "+";
else: en = "-"
if i[2] == 1: t = " RSS"
else: t = "PAGE"
url = i[1].encode("utf-8", "ignore")
if i[4]: title = i[4].encode("utf-8", "ignore")
else: title = ""
r = "%s %s[%s] %s: %s - %s\n" % (r, en, num, t, url, title)
return r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment