summaryrefslogtreecommitdiffstats
path: root/module/remote
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-09-20 20:41:45 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-09-20 20:41:45 +0200
commit73ede837c8b9a31a8bd0b380d2246fba67bddd89 (patch)
treeda3bc22833f5fc2bf3e614228eff68291d60412c /module/remote
parentclosed #390 (diff)
downloadpyload-73ede837c8b9a31a8bd0b380d2246fba67bddd89.tar.xz
general JSON API, url parser
Diffstat (limited to 'module/remote')
-rw-r--r--module/remote/thriftbackend/ThriftClient.py4
-rwxr-xr-xmodule/remote/thriftbackend/generateThrift.sh4
-rw-r--r--module/remote/thriftbackend/pyload.thrift2
-rwxr-xr-xmodule/remote/thriftbackend/thriftgen/pyload/Pyload-remote8
-rw-r--r--module/remote/thriftbackend/thriftgen/pyload/Pyload.py21
5 files changed, 21 insertions, 18 deletions
diff --git a/module/remote/thriftbackend/ThriftClient.py b/module/remote/thriftbackend/ThriftClient.py
index 3b6a56448..27cb89b0d 100644
--- a/module/remote/thriftbackend/ThriftClient.py
+++ b/module/remote/thriftbackend/ThriftClient.py
@@ -17,9 +17,7 @@ from Protocol import Protocol
from thriftgen.pyload import Pyload
from thriftgen.pyload.ttypes import *
-from thriftgen.pyload.Pyload import PackageDoesNotExists
-from thriftgen.pyload.Pyload import FileDoesNotExists
-
+from thriftgen.pyload.Pyload import PackageDoesNotExists, FileDoesNotExists
ConnectionClosed = TTransport.TTransportException
diff --git a/module/remote/thriftbackend/generateThrift.sh b/module/remote/thriftbackend/generateThrift.sh
index 7acb8531c..c5ca72736 100755
--- a/module/remote/thriftbackend/generateThrift.sh
+++ b/module/remote/thriftbackend/generateThrift.sh
@@ -1,9 +1,7 @@
#!/bin/sh
rm -rf thriftgen
-# use thrift 0.7.0 from trunk
-# patched if needed https://issues.apache.org/jira/browse/THRIFT-1115?page=com.atlassian.jira.plugin.system.issuetabpanels%3Achangehistory-tabpanel#issue-tabs
-# --gen py:slots,dynamic
+# use thrift from trunk or a release with dynamic/slots python code generation
thrift -strict -v --gen py --gen java pyload.thrift
mv gen-py thriftgen
diff --git a/module/remote/thriftbackend/pyload.thrift b/module/remote/thriftbackend/pyload.thrift
index e7ae10055..dc085e180 100644
--- a/module/remote/thriftbackend/pyload.thrift
+++ b/module/remote/thriftbackend/pyload.thrift
@@ -211,7 +211,7 @@ service Pyload {
// packagename - urls
map<string, LinkList> generatePackages(1: LinkList links),
map<PluginName, LinkList> checkURLs(1: LinkList urls),
- map<PluginName, LinkList> parseURLs(1: string html),
+ map<PluginName, LinkList> parseURLs(1: string html, 2: string url),
// parses results and generates packages
OnlineCheck checkOnlineStatus(1: LinkList urls),
diff --git a/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote b/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote
index 6c8116d92..0251fbeae 100755
--- a/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote
+++ b/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote
@@ -41,7 +41,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help':
print ' bool toggleReconnect()'
print ' generatePackages(LinkList links)'
print ' checkURLs(LinkList urls)'
- print ' parseURLs(string html)'
+ print ' parseURLs(string html, string url)'
print ' OnlineCheck checkOnlineStatus(LinkList urls)'
print ' OnlineCheck checkOnlineStatusContainer(LinkList urls, string filename, string data)'
print ' OnlineCheck pollResults(ResultID rid)'
@@ -251,10 +251,10 @@ elif cmd == 'checkURLs':
pp.pprint(client.checkURLs(eval(args[0]),))
elif cmd == 'parseURLs':
- if len(args) != 1:
- print 'parseURLs requires 1 args'
+ if len(args) != 2:
+ print 'parseURLs requires 2 args'
sys.exit(1)
- pp.pprint(client.parseURLs(args[0],))
+ pp.pprint(client.parseURLs(args[0],args[1],))
elif cmd == 'checkOnlineStatus':
if len(args) != 1:
diff --git a/module/remote/thriftbackend/thriftgen/pyload/Pyload.py b/module/remote/thriftbackend/thriftgen/pyload/Pyload.py
index a29eed62f..828ff520d 100644
--- a/module/remote/thriftbackend/thriftgen/pyload/Pyload.py
+++ b/module/remote/thriftbackend/thriftgen/pyload/Pyload.py
@@ -9,7 +9,7 @@
from thrift.Thrift import TType, TMessageType
from ttypes import *
from thrift.Thrift import TProcessor
-from thrift.protocol.TBase import TBase, TExceptionBase
+from thrift.protocol.TBase import TBase, TExceptionBase, TApplicationException
class Iface(object):
@@ -92,10 +92,11 @@ class Iface(object):
"""
pass
- def parseURLs(self, html):
+ def parseURLs(self, html, url):
"""
Parameters:
- html
+ - url
"""
pass
@@ -905,18 +906,20 @@ class Client(Iface):
return result.success
raise TApplicationException(TApplicationException.MISSING_RESULT, "checkURLs failed: unknown result");
- def parseURLs(self, html):
+ def parseURLs(self, html, url):
"""
Parameters:
- html
+ - url
"""
- self.send_parseURLs(html)
+ self.send_parseURLs(html, url)
return self.recv_parseURLs()
- def send_parseURLs(self, html):
+ def send_parseURLs(self, html, url):
self._oprot.writeMessageBegin('parseURLs', TMessageType.CALL, self._seqid)
args = parseURLs_args()
args.html = html
+ args.url = url
args.write(self._oprot)
self._oprot.writeMessageEnd()
self._oprot.trans.flush()
@@ -2678,7 +2681,7 @@ class Processor(Iface, TProcessor):
args.read(iprot)
iprot.readMessageEnd()
result = parseURLs_result()
- result.success = self._handler.parseURLs(args.html)
+ result.success = self._handler.parseURLs(args.html, args.url)
oprot.writeMessageBegin("parseURLs", TMessageType.REPLY, seqid)
result.write(oprot)
oprot.writeMessageEnd()
@@ -3769,19 +3772,23 @@ class parseURLs_args(TBase):
"""
Attributes:
- html
+ - url
"""
__slots__ = [
'html',
+ 'url',
]
thrift_spec = (
None, # 0
(1, TType.STRING, 'html', None, None, ), # 1
+ (2, TType.STRING, 'url', None, None, ), # 2
)
- def __init__(self, html=None,):
+ def __init__(self, html=None, url=None,):
self.html = html
+ self.url = url
class parseURLs_result(TBase):