[Assorted-commits] SF.net SVN: assorted: [200] movie-lookup/trunk/src
Brought to you by:
yangzhang
From: <yan...@us...> - 2007-12-27 00:35:49
|
Revision: 200 http://assorted.svn.sourceforge.net/assorted/?rev=200&view=rev Author: yangzhang Date: 2007-12-26 16:35:53 -0800 (Wed, 26 Dec 2007) Log Message: ----------- - refactored {lookup,hbo}.bash - added filter to Viewer - forgot Makefile Modified Paths: -------------- movie-lookup/trunk/src/Viewer.scala movie-lookup/trunk/src/hbo.bash movie-lookup/trunk/src/lookup.bash Added Paths: ----------- movie-lookup/trunk/src/Makefile Added: movie-lookup/trunk/src/Makefile =================================================================== --- movie-lookup/trunk/src/Makefile (rev 0) +++ movie-lookup/trunk/src/Makefile 2007-12-27 00:35:53 UTC (rev 200) @@ -0,0 +1,19 @@ +MAINCLASS := MovieLookup +CLASSPATH := bin +TARGET := $(CLASSPATH)/$(MAINCLASS).class +SRCS := MovieLookup.scala $(wildcard commons/*.scala) +INPUT := sample-hbo.txt + +all: $(TARGET) + +$(CLASSPATH): + mkdir -p $@ + +$(TARGET): $(CLASSPATH) $(SRCS) + fsc -d $(CLASSPATH) -deprecation $(SRCS) + +clean: $(CLASSPATH) + rm -r $(CLASSPATH) + +run: $(TARGET) + ./hbo.bash Modified: movie-lookup/trunk/src/Viewer.scala =================================================================== --- movie-lookup/trunk/src/Viewer.scala 2007-12-26 09:20:30 UTC (rev 199) +++ movie-lookup/trunk/src/Viewer.scala 2007-12-27 00:35:53 UTC (rev 200) @@ -1,9 +1,13 @@ import commons.Control._ import commons.Io._ +val seen: Array[String] = using (TextReader("seen.txt")) { + _.readLines.toArray map {x: String => ".." + x + ".."} +} + using (TextReader(System.in)) { - _.readLines filter {x => - try { (Integer parseInt (x split " --- " last)) > 60 } + _.readLines filter { x => + try { Integer.parseInt(x split " --- " last) > 60 } catch { case ex: Exception => false } - } foreach println + } filter (x => !seen.exists(x contains _)) foreach println } Modified: movie-lookup/trunk/src/hbo.bash =================================================================== --- movie-lookup/trunk/src/hbo.bash 2007-12-26 09:20:30 UTC (rev 199) +++ movie-lookup/trunk/src/hbo.bash 2007-12-27 00:35:53 UTC (rev 200) @@ -3,7 +3,17 @@ set -o errexit -o nounset input=hbo.txt +# extract unique movie titles from the HBO schedule + cat $input | sed 's/[^\.]*\.\.\.\.// ; s/\.\..*//' | sort -u | -./lookup.bash + +# look up their information + +./lookup.bash | + +# of the movies for which we have ratings, find their scheduled times + +fgrep ' --- ' "$ranked" | +scala -cp bin MovieLookup $input Modified: movie-lookup/trunk/src/lookup.bash =================================================================== --- movie-lookup/trunk/src/lookup.bash 2007-12-26 09:20:30 UTC (rev 199) +++ movie-lookup/trunk/src/lookup.bash 2007-12-27 00:35:53 UTC (rev 200) @@ -3,8 +3,6 @@ set -o errexit -o nounset tmp="${TEMP:-/tmp}" -ranked="$tmp/movies.txt" -input=hbo.txt # get (cache) all the index pages (300-400 of these!) @@ -14,13 +12,6 @@ # search for the movies (read from stdin) and get their ratings -if [ ! -f "$ranked" ] -then dist/build/movie-lookup/movie-lookup "$tmp/www.rottentomatoes.com/features/stats/index" > "$ranked" -fi +dist/build/movie-lookup/movie-lookup "$tmp/www.rottentomatoes.com/features/stats/index" -# of the movies for which we have ratings, find their scheduled times - -fgrep ' --- ' "$ranked" | -scala -cp bin MovieLookup $input - # vim:et:sw=2:ts=2 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |