Skip to content

Instantly share code, notes, and snippets.

@grampelberg
Created August 15, 2009 01:28
Show Gist options
  • Save grampelberg/168178 to your computer and use it in GitHub Desktop.
Save grampelberg/168178 to your computer and use it in GitHub Desktop.
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