Created
August 15, 2009 01:28
-
-
Save grampelberg/168178 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net._ | |
import scala.collection.immutable._ | |
import scala.io._ | |
import org.saunter.bencode._ | |
import scalax.io._ | |
import scalax.io.Implicits._ | |
import scalax.data.Implicits._ | |
def parse_data(file: String): Any = | |
Bencode.parse(args(0).toFile.reader.lines.mkString("\n")) match { | |
case Some(x) => x | |
case _ => None | |
} | |
val data = parse_data(file) match { | |
case x:Map[String, _] => x.get("files") | |
case _ => HashMap() | |
} | |
} | |
data.elements.foreach( x => println(x) ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment