/usr/share/pyshared/freevo/helpers/rssserver.py is in python-freevo 1.9.2b2-4.2.
This file is owned by root:root, with mode 0o644.
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 | # -*- coding: iso-8859-1 -*-
# -----------------------------------------------------------------------
# This is the Freevo RSS feed server
# -----------------------------------------------------------------------
# $Id: rssserver.py 11445 2009-04-28 15:01:44Z duncan $
#
# Notes:
# Todo:
#
# -----------------------------------------------------------------------
# Freevo - A Home Theater PC framework
# Copyright (C) 2002 Krister Lagerstrom, et al.
# Please see the file freevo/Docs/CREDITS for a complete list of authors.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MER-
# CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# -----------------------------------------------------------------------
"""
In local_conf.py add the following:
# File defining RSS feeds to monitor (see format below).
RSS_FEEDS='/etc/freevo/rss.feeds'
# Frequency (in seconds) to check for new downloads. Default is 3600 or 1 hour.
RSS_CHECK_INTERVAL=3600
# Download directory for video files.
RSS_VIDEO='/path/to/video/feeds/'
# Download directory for audio files.
RSS_AUDIO='/path/to/podcasts/'
You will need to make a rss.feeds file: it contains the URL. And after the
semicolon the number of days it's been published and how long the copy
should stay on the local machine before it gets deleted.
# Begin /etc/freevo/rss.feeds
http://twit.libsyn.com/rss;7
http://leo.am/podcasts/twit;7
http://leo.am/podcasts/itn;7
http://feeds.feedburner.com/TechRenegades;7
http://www.linuxactionshow.com/?feed=rss2&cat=3;30
http://www.thelinuxlink.net/tllts/tllts.rss;30
http://www.linux-games.ca/2006/redneck.xml;360
# End /etc/freevo/rss.feeds
"""
import os, sys, threading, time
import rssperiodic
import config
appname = os.path.splitext(os.path.basename(sys.argv[0]))[0]
appconf = appname.upper()
# change uid
if __name__ == '__main__':
uid='config.'+appconf+'_UID'
gid='config.'+appconf+'_GID'
try:
if eval(uid) and os.getuid() == 0:
os.setgid(eval(gid))
os.setuid(eval(uid))
os.environ['USER'] = pwd.getpwuid(os.getuid())[0]
os.environ['HOME'] = pwd.getpwuid(os.getuid())[5]
except Exception, e:
print e
from optparse import IndentedHelpFormatter, OptionParser
def parse_options():
"""
Parse command line options
"""
import version
formatter = IndentedHelpFormatter(indent_increment=2, max_help_position=32, width=100, short_first=0)
parser = OptionParser(conflict_handler='resolve', formatter=formatter, usage="freevo %prog [--daemon|--stop]",
version='%prog ' + str(version.version))
parser.prog = appname
parser.description = "start or stop the RSS server"
opts, args = parser.parse_args()
return opts, args
opts, args = parse_options()
# check for expired files and delete them
to = threading.Thread(rssperiodic.checkForExpiration())
to.start()
to.join()
# than starting server to poll podcasts
while True:
t = threading.Thread(rssperiodic.checkForUpdates())
t.start()
t.join()
try:
time.sleep(config.RSS_CHECK_INTERVAL)
except KeyboardInterrupt:
print 'Goodbye'
break
except Exception, e:
print e
|