-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathInsert Video.tmDragCommand
48 lines (45 loc) · 1.29 KB
/
Insert Video.tmDragCommand
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
<string>#!/usr/bin/env ruby20
if ENV['TM_DROPPED_FILE'] =~ /(?i)\.mp4$/
mimetype = 'mp4'
elsif ENV['TM_DROPPED_FILE'] =~ /(?i)\.og[gv]$/
mimetype = 'ogg'
elsif ENV['TM_DROPPED_FILE'] =~ /(?i)\.webm$/
mimetype = 'webm'
elsif ENV['TM_DROPPED_FILE'] =~ /(?i)\.mov$/
mimetype = 'quicktime'
end
puts <<~TAG
<video controls>
<source src="#{ENV['TM_DROPPED_FILE']}" type="video/#{mimetype}"${TM_XHTML}>
<p>Your browser doesn't support HTML5 video. Here is
a <a href="#{ENV['TM_DROPPED_FILE']}">link to the video</a> instead.</p>
</video>
TAG
</string>
<key>draggedFileExtensions</key>
<array>
<string>mp4</string>
<string>ogg</string>
<string>ogv</string>
<string>webm</string>
<string>mov</string>
</array>
<key>input</key>
<string>selection</string>
<key>name</key>
<string>Insert Video</string>
<key>output</key>
<string>insertAsSnippet</string>
<key>scope</key>
<string>text.html</string>
<key>uuid</key>
<string>EBE53CE6-AEBB-4318-AE98-D07F3755E3F9</string>
</dict>
</plist>