<?xml version="1.0"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
  <mime-type type="application/x-go-sgf">
    <comment>Board game record</comment>
    <glob pattern="*.sgf"/>

    <!-- Usually SGF files start with one of these two properties at
	 offset 0. -->
    <magic priority="50">
      <match type="string" value="(;FF[" offset="0"/>
      <match type="string" value="(;GM[" offset="0"/>
    </magic>

    <!-- These properties are usually not used as the opening ones,
	 but are good candidates to be used this way. -->
    <magic priority="45">
      <match type="string" value="(;CA[" offset="0"/>
      <match type="string" value="(;AP[" offset="0"/>
    </magic>

    <!-- We also repeat matching on the first kilobyte of a file, but
	 give matches much lower priroty. -->
    <magic priority="25">
      <match type="string" value="(;FF[" offset="0:1019"/>
      <match type="string" value="(;GM[" offset="0:1019"/>
    </magic>
    <magic priority="20">
      <match type="string" value="(;CA[" offset="0:1019"/>
      <match type="string" value="(;AP[" offset="0:1019"/>
    </magic>

    <!-- Last resort matching with very low priority. -->
    <magic priority="5">
      <match type="string" value="(;\n" offset="0"/>
      <match type="string" value="(;\r\n" offset="0"/>
    </magic>
    <magic priority="0">
      <match type="string" value="(;" offset="0"/>
    </magic>

    <alias type="text/sgf"/>
    <alias type="text/x-sgf"/>
  </mime-type>
</mime-info>
