Author: dmeyer
Date: Sat Sep 15 17:47:43 2007
New Revision: 2814
Log:
move feed test to beacon-feedmanager
Added:
trunk/beacon/bin/beacon-feedmanager
- copied, changed from r2813, /trunk/beacon/test/feeds.py
Removed:
trunk/beacon/test/feeds.py
Modified:
trunk/beacon/setup.py
Copied: trunk/beacon/bin/beacon-feedmanager (from r2813,
/trunk/beacon/test/feeds.py)
==============================================================================
--- /trunk/beacon/test/feeds.py (original)
+++ trunk/beacon/bin/beacon-feedmanager Sat Sep 15 17:47:43 2007
@@ -1,59 +1,137 @@
+#!/usr/bin/python
+# -*- coding: iso-8859-1 -*-
+# -----------------------------------------------------------------------------
+# beacon-feedmanager
+# -----------------------------------------------------------------------------
+# $Id$
+#
+# -----------------------------------------------------------------------------
+# kaa.beacon - A virtual filesystem with metadata
+# Copyright (C) 2007 Dirk Meyer
+#
+# First Edition: Dirk Meyer <[EMAIL PROTECTED]>
+# Maintainer: Dirk Meyer <[EMAIL PROTECTED]>
+#
+# Please see the file AUTHORS 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
+#
+# -----------------------------------------------------------------------------
+
+# python imports
import sys
+
+# kaa imports
import kaa.notifier
import kaa.beacon
kaa.beacon.connect()
-if len(sys.argv) > 1:
- if sys.argv[1] in ('--update', '-u'):
- if len(sys.argv) > 2:
- def update(feeds, id):
- for f in feeds:
- if f.get('id') == id:
- f.update().connect(sys.exit)
- kaa.beacon.list_feeds().connect(update, int(sys.argv[2]))
- else:
- kaa.beacon.update_feeds().connect(sys.exit)
-
- elif sys.argv[1] in ('--list', '-l'):
- def show(feeds):
- for f in feeds:
- print f
- sys.exit(0)
- kaa.beacon.list_feeds().connect(show)
-
- elif sys.argv[1] in ('--add', '-a') and len(sys.argv) > 3:
- url = sys.argv[2]
- destdir = sys.argv[3]
- if len(sys.argv) > 4:
- if sys.argv[4].lower() in ('true', 'yes'):
- download = True
- elif sys.argv[4].lower() in ('false', 'no'):
- download = False
- num = int(sys.argv[5])
- if sys.argv[6].lower() in ('true', 'yes'):
- keep = True
- elif sys.argv[6].lower() in ('false', 'no'):
- keep = False
- kaa.beacon.add_feed(url, destdir, download, num,
keep).connect(sys.exit)
- else:
- kaa.beacon.add_feed(url, destdir).connect(sys.exit)
-
- elif sys.argv[1] in ('--remove', '-r') and len(sys.argv) > 2:
- def remove(feeds, id):
+def help():
+ print 'beacon-feedmanager'
+ print 'options:'
+ print '-l list all feeds'
+ print '-a options add a feed, see examples below'
+ print '-r id remove feed with the given id'
+ print '-u [ id ] update all feeds or only the feed with the given id'
+ print
+ print 'The beacon-feedmanager adds feeds like audio and video podcasts'
+ print 'to the filesystem. It either downloads the files or just adds'
+ print 'the url into the directory. The later is hidden from the normal'
+ print 'filessytem, only beacon clients such as Freevo can see it.'
+ print 'Right now, only RSS feeds with links directly to a video or audio'
+ print 'file are supported, other feeds can be integrated with a plugin'
+ print 'interface, but there are no special plugins yet.'
+ print
+ print 'To add a feed use -a and add the url and the directory where the'
+ print 'items should be stored as parameter. This will download all files'
+ print 'on update and keep the old files even when they are not listed in'
+ print 'the rss feed anymore. There are three further paramater to control'
+ print 'if the file should be downloaded, the number of items to consider'
+ print 'and if old files should be kept.'
+ print
+ print 'Example:'
+ print 'download all entries and keep old one'
+ print 'beacon-feedmanager -a http://url /media/mypodcasts'
+ print 'link to all entries and not keep old one'
+ print 'beacon-feedmanager -a http://url /media/mypodcasts False 0 False'
+ print 'download up to 4 entries and delete old one'
+ print 'beacon-feedmanager -a http://url /media/mypodcasts True 4 False'
+ print
+ sys.exit(0)
+
+if len(sys.argv) < 2:
+ help()
+
+if sys.argv[1] in ('--update', '-u'):
+ if len(sys.argv) > 2:
+ def update(feeds, id):
for f in feeds:
if f.get('id') == id:
- f.remove().connect(sys.exit)
- kaa.beacon.list_feeds().connect(remove, int(sys.argv[2]))
-
+ f.update().connect(sys.exit)
+ break
+ else:
+ print 'feed not found'
+ sys.exit(0)
+
+ kaa.beacon.list_feeds().connect(update, int(sys.argv[2]))
else:
- print 'help'
+ kaa.beacon.update_feeds().connect(sys.exit)
+
+elif sys.argv[1] in ('--list', '-l'):
+ def show(feeds):
+ for f in feeds:
+ print 'Feed %d' % f['id']
+ for key in ('id', 'url', 'directory', 'download', 'num', 'keep'):
+ print ' %10s = %s' % (key, f[key])
+ print
sys.exit(0)
-
- kaa.notifier.loop()
- sys.exit(0)
+ kaa.beacon.list_feeds().connect(show)
-print 'help'
-# Add example
-# python test/feeds.py -a http://www.radiobremen.de/podcast/bestof/ \
-# /local/podcast False 2 False
+elif sys.argv[1] in ('--add', '-a') and len(sys.argv) > 3:
+ url = sys.argv[2]
+ destdir = sys.argv[3]
+ if len(sys.argv) > 4:
+ if len(sys.argv) != 7:
+ help()
+ if sys.argv[4].lower() in ('true', 'yes'):
+ download = True
+ elif sys.argv[4].lower() in ('false', 'no'):
+ download = False
+ num = int(sys.argv[5])
+ if sys.argv[6].lower() in ('true', 'yes'):
+ keep = True
+ elif sys.argv[6].lower() in ('false', 'no'):
+ keep = False
+ kaa.beacon.add_feed(url, destdir, download, num,
keep).connect(sys.exit)
+ else:
+ kaa.beacon.add_feed(url, destdir).connect(sys.exit)
+
+elif sys.argv[1] in ('--remove', '-r') and len(sys.argv) > 2:
+ def remove(feeds, id):
+ for f in feeds:
+ if f.get('id') == id:
+ f.remove().connect(sys.exit)
+ break
+ else:
+ print 'feed not found'
+ sys.exit(0)
+
+ kaa.beacon.list_feeds().connect(remove, int(sys.argv[2]))
+
+else:
+ help()
+
+kaa.notifier.loop()
Modified: trunk/beacon/setup.py
==============================================================================
--- trunk/beacon/setup.py (original)
+++ trunk/beacon/setup.py Sat Sep 15 17:47:43 2007
@@ -78,7 +78,7 @@
license = 'LGPL',
summary = "Media-oriented virtual filesystem",
scripts = [ 'bin/kaa-thumb', 'bin/beacon-daemon',
'bin/beacon-search',
- 'bin/beacon-mount' ],
+ 'bin/beacon-mount', 'bin/beacon-feedmanager' ],
rpminfo = {
'requires': 'python-kaa-base >= 0.1.2, imlib2 >= 1.2.1',
'build_requires': 'python-kaa-base >= 0.1.2, imlib2-devel >= 1.2.1,
python-devel >= 2.4.0'
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog