/usr/bin/planet is in planet-venus 0~git9de2109-4.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | #! /usr/bin/python
"""The Planet aggregator.
A flexible and easy-to-use aggregator for generating websites.
Visit http://www.planetplanet.org/ for more information and to download
the latest version.
Requires Python 2.1, recommends 2.3.
"""
__authors__ = [ "Scott James Remnant <scott@netsplit.com>",
"Jeff Waugh <jdub@perkypants.org>" ]
__license__ = "Python"
import os, shutil, sys
from os import path
DEFAULT_CONFIGURATION_FILE_NAME = "/usr/share/planet-venus/example/default.ini"
DEFAULT_THEME_DIRECTORY_NAME = "/usr/share/planet-venus/theme/default"
if __name__ == "__main__":
config_file = []
offline = 0
verbose = 0
debug = 0
only_if_new = 0
expunge = 0
debug_splice = 0
no_publish = 0
def display_error(message):
print >> sys.stderr, message
print >> sys.stderr
print >> sys.stderr, "Try `planet --help' for more information."
sys.exit(1)
for key, arg in enumerate(sys.argv[1:]):
if arg == "-h" or arg == "--help":
print """Usage: planet [OPTION]... [CONFIGURATION-FILE]
Planet Venus downloads news feeds published by web sites and aggregates their
content together into a single combined feed, latest news first.
The exit status is 0 for success or 1 for failure.
Options:
-h, --help display a short help message and exit
-V, --version display version information and exit
-v, --verbose verbose logging during update
-D, --debug debug logging during update
-d --debug-splice debug splice
-o, --offline update from the cache only
-n, --only-if-new only spider new feeds
-x, --expunge expunge old entries from cache
-c, --create=DIRECTORY create a new planet in DIRECTORY
--no-publish Do not publish feeds using PubSubHubbub
Examples:
You can create a default planet:
planet --create example
You can build this default planet right away:
cd example && planet --verbose planet.ini
You can test the results in your favourite browser:
sensible-browser output/index.html
The configuration file has more details for customisation:
sensible-editor planet.ini
Report bugs using the `reportbug' command."""
sys.exit(0)
elif arg == "-V" or arg == "--version":
print """planet - Planet Venus @version@
Copyright 2008, Sam Ruby <rubys@intertwingly.net>
Licenced under the Python Software Foundation License Version 2.
Written by Sam Ruby <rubys@intertwingly.net>."""
sys.exit(0)
elif arg == "-c" or arg == "--create":
planet_directory_name = sys.argv[key + 2]
configuration_file_name = path.join(planet_directory_name, "planet.ini")
theme_directory_name = path.join(planet_directory_name, "theme")
if not path.exists(planet_directory_name):
os.makedirs(planet_directory_name)
if not path.exists(configuration_file_name):
shutil.copy(DEFAULT_CONFIGURATION_FILE_NAME, configuration_file_name)
if not path.exists(theme_directory_name):
shutil.copytree(DEFAULT_THEME_DIRECTORY_NAME, theme_directory_name)
elif arg == "-v" or arg == "--verbose":
verbose = 1
elif arg == "-D" or arg == "--debug":
debug = 1
elif arg == "-o" or arg == "--offline":
offline = 1
elif arg == "-n" or arg == "--only-if-new":
only_if_new = 1
elif arg == "-x" or arg == "--expunge":
expunge = 1
elif arg == "-d" or arg == "--debug-splice":
debug_splice = 1
elif arg == "--no-publish":
no_publish = 1
elif arg.startswith("-"):
display_error("Unknown option: %s" % arg)
else:
config_file.append(arg)
if not config_file:
display_error("No configuration file specified.")
for i in config_file:
if not path.exists(i):
display_error("The configuration file does not exist: %s" % i)
from planet import config
config.load(config_file or 'config.ini')
import planet
if debug:
planet.getLogger('DEBUG',config.log_format())
elif verbose:
planet.getLogger('INFO',config.log_format())
if not offline:
from planet import spider
try:
spider.spiderPlanet(only_if_new=only_if_new)
except Exception, e:
print e
from planet import splice
doc = splice.splice()
if debug_splice:
from planet import logger
logger.info('writing debug.atom')
debug=open('debug.atom','w')
try:
from lxml import etree
from StringIO import StringIO
tree = etree.tostring(etree.parse(StringIO(doc.toxml())))
debug.write(etree.tostring(tree, pretty_print=True))
except:
debug.write(doc.toprettyxml(indent=' ', encoding='utf-8'))
debug.close
splice.apply(doc.toxml('utf-8'))
if config.pubsubhubbub_hub() and not no_publish:
from planet import publish
publish.publish(config)
if expunge:
from planet import expunge
expunge.expungeCache
|