Permalink
Browse files

Initial commit from NRSS source, rebranded. Lightly tested.

  • Loading branch information...
0 parents commit c2f397258c285dcfa356c8d0179125a1b35a0106 @themoken committed Apr 24, 2008
Showing with 4,393 additions and 0 deletions.
  1. +339 −0 COPYING
  2. +13 −0 INSTALL
  3. +6 −0 README
  4. +2 −0 TODO
  5. +6 −0 bin/canto
  6. +6 −0 bin/canto-fetch
  7. +1 −0 build/lib.linux-i686-2.4/canto/__init__.py
  8. +117 −0 build/lib.linux-i686-2.4/canto/canto.py
  9. +335 −0 build/lib.linux-i686-2.4/canto/cfg.py
  10. +70 −0 build/lib.linux-i686-2.4/canto/feed.py
  11. +351 −0 build/lib.linux-i686-2.4/canto/gui.py
  12. +64 −0 build/lib.linux-i686-2.4/canto/input.py
  13. +158 −0 build/lib.linux-i686-2.4/canto/interface_draw.py
  14. +108 −0 build/lib.linux-i686-2.4/canto/reader.py
  15. +37 −0 build/lib.linux-i686-2.4/canto/search.py
  16. +107 −0 build/lib.linux-i686-2.4/canto/story.py
  17. +53 −0 build/lib.linux-i686-2.4/canto/tag.py
  18. +70 −0 build/lib.linux-i686-2.4/canto/utility.py
  19. BIN build/lib.linux-i686-2.4/canto/widecurse.so
  20. +1 −0 build/lib.linux-i686-2.4/canto_fetch/__init__.py
  21. +99 −0 build/lib.linux-i686-2.4/canto_fetch/canto_fetch.py
  22. +99 −0 build/lib.linux-i686-2.4/canto_fetch/feed.py
  23. +130 −0 build/lib.linux-i686-2.4/canto_fetch/parse.py
  24. +6 −0 build/scripts-2.4/canto
  25. +6 −0 build/scripts-2.4/canto-fetch
  26. BIN build/temp.linux-i686-2.4/canto/widecurse.o
  27. +1 −0 canto/__init__.py
  28. BIN canto/__init__.pyc
  29. +117 −0 canto/canto.py
  30. +335 −0 canto/cfg.py
  31. BIN canto/cfg.pyc
  32. +70 −0 canto/feed.py
  33. BIN canto/feed.pyc
  34. +351 −0 canto/gui.py
  35. +64 −0 canto/input.py
  36. +158 −0 canto/interface_draw.py
  37. BIN canto/interface_draw.pyc
  38. BIN canto/nrss.pyc
  39. +108 −0 canto/reader.py
  40. +37 −0 canto/search.py
  41. +107 −0 canto/story.py
  42. BIN canto/story.pyc
  43. +53 −0 canto/tag.py
  44. +70 −0 canto/utility.py
  45. BIN canto/utility.pyc
  46. +181 −0 canto/widecurse.c
  47. +1 −0 canto_fetch/__init__.py
  48. +99 −0 canto_fetch/canto_fetch.py
  49. +99 −0 canto_fetch/feed.py
  50. +130 −0 canto_fetch/parse.py
  51. +200 −0 man/canto.1
  52. +28 −0 setup.py
339 COPYING

Large diffs are not rendered by default.

Oops, something went wrong.
13 INSTALL
@@ -0,0 +1,13 @@
+==INSTALL==
+
+=REQUIREMENTS=
+- Python >=2.4 (tested mostly on 2.5.1)
+- NCursesw (yes, Unicode is a requirement)
+
+=BUILDING=
+- Python development headers
+- Ncurses development headers
+- GCC
+
+=INSTALL=
+- `python setup.py install` will install the files to your root.
6 README
@@ -0,0 +1,6 @@
+Canto 0.4.0 isn't ready for primetime yet, but it is ready for
+testing.
+
+Any information you should require to get started is included
+in the man page (`man canto`), under the section "GETTING
+STARTED"
2 TODO
@@ -0,0 +1,2 @@
+==Canto==
+- Beta!
@@ -0,0 +1,6 @@
+#!/usr/bin/python
+
+import canto.canto
+
+if __name__ == "__main__" :
+ canto.canto.main()
@@ -0,0 +1,6 @@
+#!/usr/bin/python
+
+import canto_fetch.canto_fetch
+
+if __name__ == "__main__" :
+ canto_fetch.canto_fetch.main()
@@ -0,0 +1 @@
+#
@@ -0,0 +1,117 @@
+# -*- coding: utf-8 -*-
+
+#Canto - ncurses RSS reader
+# Copyright (C) 2007 Jack Miller <jjm2n4@umr.edu>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+
+import signal
+import cfg
+import locale
+import os
+import time
+import sys
+import getopt
+import codecs
+
+def log(path, str, mode="a"):
+ try :
+ f = codecs.open(path, mode, "UTF-8", "ignore")
+ try:
+ f.write(str)
+ finally:
+ f.close()
+ except IOError:
+ pass
+
+def print_usage():
+ print "USAGE: canto [-hvcguDCLF]"
+ print " -h This help."
+ print " -v Print version info."
+ print " -g Only generate server config."
+ print " -u Fetch updates before running."
+ print " -D [path] Set configuration directory. (~/.canto/)"
+ print " -C [path] Set configuration file. (~/.canto/conf)"
+ print " -L [path] Set client log file. (~/.canto/log)"
+ print " -F [path] Set feed directory. (~/.canto/feeds/)"
+
+def main():
+ """The main function is dedicated mostly to reading
+ command line arguments. However it's also host to the
+ infinite loop that calls Cfg.loop."""
+
+ MAJOR = 0
+ MINOR = 4
+ REV = 0
+
+ locale.setlocale(locale.LC_ALL, "")
+ conf_dir = None
+ try :
+ optlist, arglist = getopt.getopt(sys.argv[1:], 'hvgD:C:L:S:O:F:u')
+ except getopt.GetoptError, e:
+ print "Error: %s" % e.msg
+ sys.exit(-1)
+
+ for opt, arg in optlist :
+ if opt == "-D" : conf_dir = arg
+
+ if not conf_dir : conf_dir = os.getenv("HOME") + "/.canto/"
+ elif conf_dir[-1] != '/' : conf_dir += '/'
+
+ columns = 0
+ log_file = conf_dir + "log"
+ conf_file = conf_dir + "conf"
+ serv_file = conf_dir + "sconf"
+ feed_dir = conf_dir + "feeds/"
+ only_conf = 0
+ update_first = 0
+
+ for opt, arg in optlist :
+ if opt == "-C" :
+ conf_file = arg
+ elif opt == "-L" :
+ log_file = arg
+ elif opt == "-F" :
+ feed_dir = arg
+ if feed_dir[-1] != '/' :
+ feed_dir += '/'
+ elif opt == "-g" :
+ only_conf = 1
+ elif opt == "-u" :
+ update_first = 1
+ elif opt == "-h" :
+ print_usage()
+ sys.exit(0)
+ elif opt == "-v" :
+ print "Canto v %d.%d.%d" % (MAJOR,MINOR,REV)
+ sys.exit(0)
+
+ log(log_file, "Canto v %d.%d.%d\n" % (MAJOR,MINOR,REV), "w")
+ log(log_file, "Started execution: %s\n" % time.asctime(time.localtime()), "a")
+ log_func = (lambda x : log(log_file, x, "a"))
+
+ try :
+ i = cfg.Cfg(log_func, conf_file, serv_file, feed_dir, only_conf, update_first)
+ except IndexError:
+ print "You must update feeds, try `canto -u`"
+ sys.exit(-1)
+
+ if only_conf:
+ print "Server config generated."
+ sys.exit(0)
+ elif len(i.feeds) <= 0 :
+ print "You have to add some feeds! Read `man canto`"
+ sys.exit(-1)
+
+ signal.signal(signal.SIGALRM, i.alarm)
+ signal.signal(signal.SIGWINCH, i.winch)
+ signal.signal(signal.SIGTTOU, signal.SIG_IGN)
+ signal.alarm(1)
+
+ while 1 :
+ if i.loop() :
+ break
+
+ sys.exit(0)
Oops, something went wrong.

0 comments on commit c2f3972

Please sign in to comment.