Skip to content

Commit

Permalink
Only align on-the-ball events (closes #39)
Browse files Browse the repository at this point in the history
  • Loading branch information
Marek Kwiatkowski committed Jan 14, 2019
1 parent ba14a77 commit dd99586
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/F24.hs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@ convertGameCoordinates metaData frames game =
otherwise ->
1

-- Whether the event is an on-the-ball event.
-- Consult the list below for the meaning of event type IDs.
isOTB :: Event c -> Bool
isOTB e = elem (type_id e) ([1..16] ++ [41..45] ++ [49..61])


eventTypeName :: Event a -> String
Expand Down
8 changes: 5 additions & 3 deletions src/SyncMain.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ main = do
f24Raw <- F24.loadGameFromFile (f24File opts)
let f24Data = F24.convertGameCoordinates tbMeta tbData f24Raw

-- Select first and second half events and frames
let events1 = filter (\e -> F24.period_id e == 1) (F24.events f24Data)
let events2 = filter (\e -> F24.period_id e == 2) (F24.events f24Data)
-- Select events to sync in both halves
let syncable pid e = (F24.period_id e == pid) && (F24.isOTB e)
let events1 = filter (syncable 1) (F24.events f24Data)
let events2 = filter (syncable 2) (F24.events f24Data)

-- Select frames to sync to
let p1start = (Tcb.startFrame . head . Tcb.periods) tbMeta
let p2start = (Tcb.startFrame . head . tail . Tcb.periods) tbMeta
let p1end = (Tcb.endFrame . head . Tcb.periods) tbMeta
Expand Down

0 comments on commit dd99586

Please sign in to comment.