mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-12 12:34:43 +00:00
another patch from David Mohr adding basic cookies support in core
This commit is contained in:
parent
82682dbb2d
commit
d1c6e551a9
@ -1,8 +1,8 @@
|
|||||||
#
|
#
|
||||||
# core.py
|
# core.py
|
||||||
#
|
#
|
||||||
|
# Copyright (C) 2008-2009 Fredrik Eriksson <feeder@winterbird.org>
|
||||||
# Copyright (C) 2009 David Mohr <david@mcbf.net>
|
# Copyright (C) 2009 David Mohr <david@mcbf.net>
|
||||||
# Copyright (C) 2008 Fredrik Eriksson <feeder@winterbird.org>
|
|
||||||
#
|
#
|
||||||
# Basic plugin template created by:
|
# Basic plugin template created by:
|
||||||
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
|
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
|
||||||
@ -63,14 +63,21 @@ class Feed:
|
|||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.url = ""
|
self.url = ""
|
||||||
|
self.cookies = {}
|
||||||
self.updatetime = 15
|
self.updatetime = 15
|
||||||
|
|
||||||
def get_config(self):
|
def get_config(self):
|
||||||
return {'url': self.url, 'updatetime': self.updatetime}
|
try:
|
||||||
|
tmp = self.cookies
|
||||||
|
except Exception, e:
|
||||||
|
log.debug("Old feed without cookies... updating")
|
||||||
|
self.cookies = {}
|
||||||
|
return {'url': self.url, 'updatetime': self.updatetime, 'cookies': self.cookies}
|
||||||
|
|
||||||
def set_config(self, config):
|
def set_config(self, config):
|
||||||
self.url = config['url']
|
self.url = config['url']
|
||||||
self.updatetime = config['updatetime']
|
self.updatetime = config['updatetime']
|
||||||
|
self.cookies = config['cookies']
|
||||||
|
|
||||||
|
|
||||||
class Filter:
|
class Filter:
|
||||||
@ -399,7 +406,7 @@ class Core(CorePluginBase):
|
|||||||
# check history to prevent multiple adds of the same torrent
|
# check history to prevent multiple adds of the same torrent
|
||||||
log.debug("testing %s", entry.link)
|
log.debug("testing %s", entry.link)
|
||||||
if not entry.link in self.history:
|
if not entry.link in self.history:
|
||||||
self.add_torrent(entry.link, opts)
|
self.add_torrent(entry.link, opts, self.feeds[feedname].cookies)
|
||||||
self.history.append(entry.link)
|
self.history.append(entry.link)
|
||||||
|
|
||||||
#limit history to 50 entries
|
#limit history to 50 entries
|
||||||
@ -420,6 +427,6 @@ class Core(CorePluginBase):
|
|||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def add_torrent(self, url, torrent_options):
|
def add_torrent(self, url, torrent_options, headers):
|
||||||
log.debug("Attempting to add torrent %s", url)
|
log.debug("Attempting to add torrent %s", url)
|
||||||
component.get("Core").add_torrent_url(url, torrent_options)
|
component.get("Core").add_torrent_url(url, torrent_options, headers)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user