X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FMain.hs;h=cb4bdffbe5e61f4ff8045e701310693944ff9dd2;hb=9a8a222bae7eb08001a99bb693dd20ed8a2693a1;hp=fc6d14b8a116aef185d0c7d362b2204c912ff135;hpb=3768238ca528db394e4777ac1e19b2091979e1c8;p=dead%2Fhtsn-import.git diff --git a/src/Main.hs b/src/Main.hs index fc6d14b..cb4bdff 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -65,7 +65,11 @@ import qualified TSN.XML.ScheduleChanges as ScheduleChanges ( pickle_message ) import qualified TSN.XML.Scores as Scores ( dtd, pickle_message ) import qualified TSN.XML.SportInfo as SportInfo ( dtds, parse_xml ) -import qualified TSN.XML.Weather as Weather ( dtd, pickle_message ) +import qualified TSN.XML.Weather as Weather ( + dtd, + is_type1, + pickle_message, + teams_are_normal ) import Xml ( DtdName(..), parse_opts ) @@ -203,7 +207,20 @@ import_file cfg path = do | dtd == Scores.dtd = go Scores.pickle_message -- SportInfo and GameInfo appear last in the guards - | dtd == Weather.dtd = go Weather.pickle_message + | dtd == Weather.dtd = + -- Some of the weatherxml docs are busted in predictable ways. + -- We want them to "succeed" so that they're deleted. + -- We already know we can't parse them. + if Weather.is_type1 xml + then if Weather.teams_are_normal xml + then go Weather.pickle_message + else do + let msg = "Teams in reverse order in weatherxml.dtd" ++ + " (" ++ path ++ ")" + return $ ImportUnsupported msg + else do + let msg = "Unsupported weatherxml.dtd type (" ++ path ++ ")" + return $ ImportUnsupported msg | dtd `elem` GameInfo.dtds = do let either_m = GameInfo.parse_xml dtd xml