-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathInsert Audio.tmDragCommand
51 lines (48 loc) · 1.38 KB
/
Insert Audio.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
49
50
51
<?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>command</key>
<string>#!/usr/bin/env ruby20
if ENV['TM_DROPPED_FILE'] =~ /(?i)\.mp4$/
mimetype = 'mp4'
elsif ENV['TM_DROPPED_FILE'] =~ /(?i)\.mp3$/
mimetype = 'mp3'
elsif ENV['TM_DROPPED_FILE'] =~ /(?i)\.og[ga]$/
mimetype = 'ogg'
elsif ENV['TM_DROPPED_FILE'] =~ /(?i)\.webm$/
mimetype = 'webm'
elsif ENV['TM_DROPPED_FILE'] =~ /(?i)\.flac$/
mimetype = 'flac'
elsif ENV['TM_DROPPED_FILE'] =~ /(?i)\.wave?$/
mimetype = 'wav'
end
puts <<~TAG
<audio controls>
<source src="#{ENV['TM_DROPPED_FILE']}" type="audio/#{mimetype}"${TM_XHTML}>
<p>Your browser doesn't support HTML5 audio. Here is
a <a href="#{ENV['TM_DROPPED_FILE']}">link to the audio</a> instead.</p>
</audio>
TAG
</string>
<key>draggedFileExtensions</key>
<array>
<string>mp4</string>
<string>mp3</string>
<string>ogg</string>
<string>oga</string>
<string>webm</string>
<string>flac</string>
<string>wav</string>
<string>wave</string>
</array>
<key>name</key>
<string>Insert Audio</string>
<key>output</key>
<string>insertAsSnippet</string>
<key>scope</key>
<string>text.html</string>
<key>uuid</key>
<string>01D7DB7F-0A1E-4086-9277-562FD85A58CC</string>
</dict>
</plist>