Created
December 4, 2016 13:59
-
-
Save ssokolow/4c190df14ec0fd1e2e3d6a24bf5be693 to your computer and use it in GitHub Desktop.
Script to associate .mpv.edl files with MPV (including by header)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Sources: | |
# - https://stackoverflow.com/questions/30931/register-file-extensions-mime-types-in-linux | |
# - https://www.freedesktop.org/wiki/Specifications/AddingMIMETutor/ | |
echo "* Adding file-type icons..." | |
for SIZE in 16 32 64; do | |
echo "* Adding ${SIZE}px icon" | |
xdg-icon-resource install --context mimetypes --size "$SIZE" "/usr/share/icons/hicolor/${SIZE}x${SIZE}/apps/mpv.png" application-x-mpv-edl | |
done | |
echo "* Adding file-type definition..." | |
cat > edl-mime.xml << EOF | |
<?xml version="1.0" encoding="UTF-8"?> | |
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'> | |
<mime-type type="application/x-mpv-edl"> | |
<comment>MPV Edit Decision List</comment> | |
<magic priority="50"> | |
<match type="string" value="# mpv EDL" offset="0" /> | |
</magic> | |
<glob pattern="*.mpv.edl"/> | |
</mime-type> | |
</mime-info> | |
EOF | |
xdg-mime install edl-mime.xml | |
rm edl-mime.xml | |
echo "* Adding mime type association to MPV" | |
sed 's@\(audio/x-mpegurl;\)@\1application/x-mpv-edl;@' /usr/share/applications/mpv.desktop > ~/.local/share/applications/mpv.desktop | |
echo "* Updating desktop application database" | |
update-desktop-database ~/.local/share/applications | |
echo "* Updating mime type database" | |
update-mime-database ~/.local/share/mime |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment