You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ni...@apache.org on 2017/03/23 00:12:44 UTC

[tika] 01/03: TIKA-1772 More WebVTT magic - for cases with no header, and with custom headers

This is an automated email from the ASF dual-hosted git repository.

nick pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tika.git

commit bb82205eece0eb68edee7d7ac24f63cf3934198f
Author: Nick Burch <ni...@gagravarr.org>
AuthorDate: Wed Mar 22 23:25:52 2017 +0000

    TIKA-1772 More WebVTT magic - for cases with no header, and with custom headers
---
 .../org/apache/tika/mime/tika-mimetypes.xml        | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml b/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml
index e3df6f6..c99ce3f 100644
--- a/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml
+++ b/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml
@@ -5991,9 +5991,32 @@
     <_comment>Web Video Text Tracks Format</_comment>
     <acronym>WebVTT</acronym>
     <magic priority="40">
+      <!-- Simple Form -->
+      <match value="WEBVTT\r" type="string" offset="0"/>
+      <match value="WEBVTT\n" type="string" offset="0"/>
+      <!-- With Byte Order Mark -->
+      <match value="0xfeff" offset="0">
+         <match value="WEBVTT\r" type="string" offset="2"/>
+      </match>
+      <match value="0xfeff" offset="0">
+         <match value="WEBVTT\n" type="string" offset="2"/>
+      </match>
+      <!-- Common Header -->
       <match value="WEBVTT FILE\r" type="string" offset="0"/>
       <match value="WEBVTT FILE\n" type="string" offset="0"/>
     </magic>
+    <magic priority="30">
+      <!-- With a custom header - needs a lower priority -->
+      <match value="WEBVTT " type="string" offset="0">
+        <match value="\n\n" type="string" offset="10:50" />
+      </match>
+      <match value="WEBVTT " type="string" offset="0">
+        <match value="\r\r" type="string" offset="10:50" />
+      </match>
+      <match value="WEBVTT " type="string" offset="0">
+        <match value="\r\n\r\n" type="string" offset="10:50" />
+      </match>
+    </magic>
     <glob pattern="*.vtt"/>
     <sub-class-of type="text/plain"/>
   </mime-type>

-- 
To stop receiving notification emails like this one, please contact
"commits@tika.apache.org" <co...@tika.apache.org>.