]> gitweb.michael.orlitzky.com - dead/htsn-import.git/blobdiff - src/Main.hs
Add a teams_are_normal function to TSN.XML.Weather.
[dead/htsn-import.git] / src / Main.hs
index 0fe6096e867631e4ea0ddae439324d891fd037f2..cb4bdffbe5e61f4ff8045e701310693944ff9dd2 100644 (file)
@@ -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, is_type1, pickle_message )
+import qualified TSN.XML.Weather as Weather (
+  dtd,
+  is_type1,
+  pickle_message,
+  teams_are_normal )
 import Xml ( DtdName(..), parse_opts )
 
 
@@ -204,11 +208,17 @@ import_file cfg path = do
 
             -- SportInfo and GameInfo appear last in the guards
             | 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 go Weather.pickle_message
+                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
-                  -- We want these to "succeed" so that they're deleted.
-                  -- We already know we can't parse them.
                   let msg = "Unsupported weatherxml.dtd type (" ++ path ++ ")"
                   return $ ImportUnsupported msg