コード例 #1
0
	def default_conf(self):
		self.conf.add_section("GENERAL")
		self.conf.set("GENERAL","tempfolder","./tmp/")
		self.conf.add_section("NOTIFICATIONS")
		self.conf.set("NOTIFICATIONS","enabled","0")
		self.conf.add_section("DATABASE")
		self.conf.set("DATABASE","path",os.getcwd()+os.sep+"qad_rssreader.db")
		self.conf.set("DATABASE","config_table","rssfeeds")
		self.conf.set("DATABASE","feed_table","rsstopics")
		self.conf.set("DATABASE","cycle","300")
		self.conf.add_section("FTP")
		self.conf.set("FTP","path","/")
		self.conf.set("FTP","username","your_username")
		self.conf.set("FTP","password","your_password")
		self.conf.set("FTP","server","your_server")
		self.conf.add_section("HTML")
		self.conf.set("HTML","filename","index.html")
		self.conf.set("HTML","title","Quick And Dirty RSS Reader")
		self.conf.set("HTML","description","The website description")
		self.conf.set("HTML","footer","The copyright information")
		self.conf.set("HTML","template","default")
		self.conf.set("HTML","baseaddress","http://www.feed.fi")
		f = open(self.conf_path,"w")
		self.conf.write(f)
		f.close()
		db = rss_db.db_connection(self.conf.get("DATABASE","path"))
		db.default_db()
		db.close()
コード例 #2
0
ファイル: qad_cron.py プロジェクト: Jeff-Lewis/quickanddirty
#	if (rss_config.Config().get("NOTIFICATIONS","enabled")=="1"):#
#		try:
#			import dbus
#			session_bus = dbus.SessionBus()
#			notifications_object = 
#session_bus.get_object('org.freedesktop.Notifications', '/org/freedesktop/Notifications')
#			notifications_interface = dbus.Interface(notifications_object, 
#'org.freedesktop.Notifications')
#		except dbus.DBusException, e:
#			print "Error: %s" % str(e)
	while (_LOOP==0):
		
		c = rss_config.Config()
		db_things = c.read_conf()
	
		db = rss_db.db_connection(db_things[0])
		newslinks = db.read_newslinks()
		feeds = db.read_feeds(db_things[1])
	
		for feed in feeds:
			p("")
			p("Reading feed: "+feed[1])
			p("Feed id: "+str(feed[2]))
			rss_feed(feed[0],feed[2])
		
		if force or (len(newslinks)!=len(db.read_newslinks())):
			p("Generating html file.")
			tmpfolder = c.get("GENERAL","tempfolder")
			if (os.path.exists(tmpfolder)==False):
				os.mkdir(tmpfolder)
			localfile = tmpfolder+c.get("HTML","filename")
コード例 #3
0
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 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
#    MERCHANTABILITY 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, see <http://www.gnu.org/licenses/>.
#############################################################################
# Version 0.2
############################################################################
import rss_db
import sys

args = sys.argv

if len(args)>1:
	db = rss_db.db_connection()
	try:
		print "current title was "+db.read_feedname(feedid=args[1])
	except TypeError:
		print "title was not set."
	db.update_feedtitle(feedid=args[1], title=args[2])
	print "current title is now "+db.read_feedname(feedid=args[1])
	db.close()
else:
	print "USAGE: ./qad_rssreader_title.py id url"
コード例 #4
0
    def GetNews(self):
    	print "GetNews called!"
    	import rss_db
	db = rss_db.db_connection()
	news = db.read_newslinks()
        return news
コード例 #5
0
ファイル: rss_www.py プロジェクト: Jeff-Lewis/quickanddirty
	def __init__(self,filename=structure.layout().filename()):
		self.template = structure.layout()
		self.c = rss_config.Config()
		self.f = open(filename,"w")
		self.db = rss_db.db_connection(self.c.get("DATABASE","path"))
		self.template.init(title=self.c.get("HTML","title"),desc=self.c.get("HTML","description"),addr=self.c.get("HTML","baseaddress"),footer=self.c.get("HTML","footer"))