mirror of https://github.com/zlatinb/muwire
send path information with results
parent
ebac1ffafa
commit
1c5100f320
|
@ -84,21 +84,27 @@ class ResultsSender {
|
||||||
InfoHash ih = new InfoHash(it.getRoot())
|
InfoHash ih = new InfoHash(it.getRoot())
|
||||||
int certificates = certificateManager.getByInfoHash(ih).size()
|
int certificates = certificateManager.getByInfoHash(ih).size()
|
||||||
Set<InfoHash> collections = collectionManager.collectionsForFile(ih)
|
Set<InfoHash> collections = collectionManager.collectionsForFile(ih)
|
||||||
|
|
||||||
|
List<String> pathElements = new ArrayList<>()
|
||||||
|
for(String pathElement : it.getPathToSharedParent())
|
||||||
|
pathElements << pathElement
|
||||||
|
|
||||||
def uiResultEvent = new UIResultEvent( sender : me,
|
def uiResultEvent = new UIResultEvent( sender : me,
|
||||||
name : it.getFile().getName(),
|
name : it.getFile().getName(),
|
||||||
size : length,
|
size : length,
|
||||||
infohash : ih,
|
infohash : ih,
|
||||||
pieceSize : pieceSize,
|
pieceSize : pieceSize,
|
||||||
uuid : uuid,
|
uuid : uuid,
|
||||||
browse : settings.browseFiles,
|
browse : settings.browseFiles,
|
||||||
browseCollections : settings.browseFiles,
|
browseCollections : settings.browseFiles,
|
||||||
sources : suggested,
|
sources : suggested,
|
||||||
comment : comment,
|
comment : comment,
|
||||||
certificates : certificates,
|
certificates : certificates,
|
||||||
chat : chatServer.isRunning() && settings.advertiseChat,
|
chat : chatServer.isRunning() && settings.advertiseChat,
|
||||||
messages : settings.allowMessages,
|
messages : settings.allowMessages,
|
||||||
feed : settings.fileFeed && settings.advertiseFeed,
|
feed : settings.fileFeed && settings.advertiseFeed,
|
||||||
collections : collections
|
collections : collections,
|
||||||
|
path: pathElements.toArray(new String[0])
|
||||||
)
|
)
|
||||||
uiResultEvents << uiResultEvent
|
uiResultEvents << uiResultEvent
|
||||||
}
|
}
|
||||||
|
@ -132,7 +138,8 @@ class ResultsSender {
|
||||||
InfoHash ih = new InfoHash(it.getRoot())
|
InfoHash ih = new InfoHash(it.getRoot())
|
||||||
int certificates = certificateManager.getByInfoHash(ih).size()
|
int certificates = certificateManager.getByInfoHash(ih).size()
|
||||||
Set<InfoHash> collections = collectionManager.collectionsForFile(ih)
|
Set<InfoHash> collections = collectionManager.collectionsForFile(ih)
|
||||||
def obj = sharedFileToObj(it, settings.browseFiles, certificates, collections, false)
|
def obj = sharedFileToObj(it, settings.browseFiles, certificates, collections,
|
||||||
|
settings.showPaths)
|
||||||
def json = jsonOutput.toJson(obj)
|
def json = jsonOutput.toJson(obj)
|
||||||
os.writeShort((short)json.length())
|
os.writeShort((short)json.length())
|
||||||
os.write(json.getBytes(StandardCharsets.US_ASCII))
|
os.write(json.getBytes(StandardCharsets.US_ASCII))
|
||||||
|
@ -161,7 +168,7 @@ class ResultsSender {
|
||||||
InfoHash ih = new InfoHash(it.getRoot())
|
InfoHash ih = new InfoHash(it.getRoot())
|
||||||
int certificates = certificateManager.getByInfoHash(ih).size()
|
int certificates = certificateManager.getByInfoHash(ih).size()
|
||||||
Set<InfoHash> collections = collectionManager.collectionsForFile(ih)
|
Set<InfoHash> collections = collectionManager.collectionsForFile(ih)
|
||||||
def obj = sharedFileToObj(it, settings.browseFiles, certificates, collections, false)
|
def obj = sharedFileToObj(it, settings.browseFiles, certificates, collections, settings.showPaths)
|
||||||
def json = jsonOutput.toJson(obj)
|
def json = jsonOutput.toJson(obj)
|
||||||
dos.writeShort((short)json.length())
|
dos.writeShort((short)json.length())
|
||||||
dos.write(json.getBytes(StandardCharsets.US_ASCII))
|
dos.write(json.getBytes(StandardCharsets.US_ASCII))
|
||||||
|
|
Loading…
Reference in New Issue