비디오 파일을 처리하는 bash 스크립트를 작성했으며 터미널에서 파일로 이동할 필요없이 비디오 파일을 열고 싶습니다.
$ ~/script.sh video.mp4
터미널에서 실행되는 방식입니다.
비디오를 열어 보았지만 gnome-terminal -e ~/home/user/script.sh
파일 이름 / 경로를 캡처하지 않는 것 같습니다. Nemo 파일 관리자를 사용하고 있습니다.
나는 해결책을 찾는 동안 아무것도 생각할 수 없었다.
관련성이있는 경우 이것이 파일 이름 인수를 스크립트에 전달하는 방법입니다. (가장 좋은 방법은 아닐 것입니다)
#!/bin/bash
args=("$@")
in_file=${args[0]}
업데이트 : 이 .desktop 파일을 만들었습니다.
[Desktop Entry]
Comment=
Terminal=true
Name=fixvideo
Exec=/home/user/fixvideo.sh %f
Type=Application
Icon=/usr/share/icons/gnome/48x48/apps/gnome-settings-theme.png
Encoding=UTF-8
바탕 화면 아이콘에 동영상 파일을 드롭하면 정상적으로 동작합니다. 하지만 Nemo (또는 Nautilus)에서 "연결 프로그램"을 사용하는 것은 작동하지 않습니다.
bash 스크립트에 대해 비디오 파일 ( "연결 프로그램 ...")과 연결될 수있는 .desktop 파일을 작성하고 싶을 것입니다. https://specifications.freedesktop.org/desktop-entry-spec/ desktop-entry-spec-latest.html
https://developer.gnome.org/integration-guide/stable/desktop-files.html.en :
모든 사람이 액세스 할 수 있도록이 파일을 / usr / share / applications 디렉토리에 배치하고, 단일 사용자 만 액세스 할 수 있도록하려면 ~ / .local / share / applications에 배치하십시오.
leetwanker 편집 : 제가 만든 .desktop 파일은 다음과 같습니다. 나는 그것을 내 자신의 게시물에 보관하는 것을 선호했지만 여기의 개조 자들이 눈살을 찌푸린 것 같습니다.
이 fixvideo.desktop 파일을 ~/.local/share/applications/
[Desktop Entry]
Comment=
Terminal=true
Name=fixvideo
Exec=/home/user/fixvideo.sh %f
Type=Application
Icon=/usr/share/icons/gnome/48x48/apps/gnome-settings-theme.png
Encoding=UTF-8
Hidden=false
NoDisplay=false
Categories=AudioVideo;Player;Recorder;
MimeType=video/dv;video/mpeg;video/x-mpeg;video/msvideo;video/quicktime;video/x-anim;video/x-avi;video/x-ms-asf;video/x-ms-wmv;video/x-msvideo;video/x-nsv;video/x-flc;video/x-fli;video/x-flv;video/vnd.rn-realvideo;video/mp4;application/mp4;video/mp4v-es;video/mp2t;application/ogg;application/x-ogg;video/x-ogm+ogg;audio/x-vorbis+ogg;audio/ogg;video/ogg;application/x-matroska;audio/x-matroska;video/x-matroska;video/webm;audio/webm;audio/x-mp3;audio/x-mpeg;audio/mpeg;audio/x-wav;audio/x-mpegurl;audio/x-scpls;audio/x-m4a;audio/x-ms-asf;audio/x-ms-asx;audio/x-ms-wax;application/vnd.rn-realmedia;audio/x-real-audio;audio/x-pn-realaudio;application/x-flac;audio/x-flac;application/x-shockwave-flash;misc/ultravox;audio/vnd.rn-realaudio;audio/x-pn-aiff;audio/x-pn-au;audio/x-pn-wav;audio/x-pn-windows-acm;image/vnd.rn-realpix;audio/x-pn-realaudio-plugin;application/x-extension-mp4;audio/mp4;audio/amr;audio/amr-wb;x-content/video-vcd;x-content/video-svcd;x-content/video-dvd;x-content/audio-cdda;x-content/audio-player;application/xspf+xml;x-scheme-handler/mms;x-scheme-handler/rtmp;x-scheme-handler/rtsp;
.mp4 파일의 "권장 응용 프로그램"목록에이 항목을 추가하려면 "시스템 기본값으로 재설정"해야했습니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다