Add torrent file detection for single files
This commit is contained in:
		@@ -56,13 +56,16 @@ function fillDetectedFilelist(file) {
 | 
			
		||||
 | 
			
		||||
		filesGroup = document.querySelectorAll(".filesGroup")[0]
 | 
			
		||||
		if(torrentObject["info"]["files"] != undefined && torrentObject["info"]["files"].length > 0) {
 | 
			
		||||
			// render the file-tree if multiple files are present
 | 
			
		||||
			autodetectSuccess = true
 | 
			
		||||
			rootElement = document.createElement("div")
 | 
			
		||||
			for(var fileIndex = 0; fileIndex < torrentObject.info.files.length; fileIndex++){
 | 
			
		||||
				path = torrentObject["info"]["files"][fileIndex]["path"]
 | 
			
		||||
				renderFile(getRoot(), path.reverse())
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		} else {
 | 
			
		||||
			// assume the torrent is only one file named "name"
 | 
			
		||||
			autodetectSuccess = true
 | 
			
		||||
			renderFile(getRoot(), [torrentObject["info"]["name"]])
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		var detectInfosGroup = document.querySelectorAll(".detectedInfosGroup")[0]
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user