사용자 지정 브라우저 프로토콜이란?
- 기본 프로토콜 예시:
- http:// → 웹 브라우저에서 처리.
- mailto: → 이메일 클라이언트에서 처리.
- 사용자 지정 프로토콜 예시:
- foo://some/info/here → 로컬 애플리케이션 실행.
적용 사례
- RV, Maya, 또는 Cinesync와 같은 애플리케이션과 통합.
- 특정 스크립트를 실행하거나 파일을 처리.
프로토콜 등록 방법
Windows에서 프로토콜 등록
- Windows 레지스트리 설정:
-
[HKEY_CLASSES_ROOT\\ShotGrid] @="URL:ShotGrid Protocol" "URL Protocol"="" [HKEY_CLASSES_ROOT\\ShotGrid\\shell] [HKEY_CLASSES_ROOT\\ShotGrid\\shell\\open] [HKEY_CLASSES_ROOT\\ShotGrid\\shell\\open\\command] @="python \\"sgTriggerScript.py\\" \\"%1\\""
- "sgTriggerScript.py": 실행할 Python 스크립트.
- "%1": 클릭된 URL이 첫 번째 인자로 전달.
- Python 스크립트 예제:
import sys
from urllib.parse import parse_qs
def main(args):
if len(args) != 1:
sys.exit("URL 하나만 필요합니다.")
protocol, path = args[0].split(":", 1)
if "?" in path:
action, params = path.split("?", 1)
parsed_params = parse_qs(params)
else:
action = path
parsed_params = {}
print(f"프로토콜: {protocol}, 액션: {action}, 파라미터: {parsed_params}")
if __name__ == "__main__":
main(sys.argv[1:])
macOS에서 프로토콜 등록
- AppleScript를 사용한 애플리케이션 번들 생성:
-
on open location this_URL do shell script "python3 /path/to/sgTriggerScript.py '" & this_URL & "'" end open location
- info.plist 파일 수정:
- CFBundleURLTypes 섹션에 사용자 지정 프로토콜 추가:
-
<key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLSchemes</key> <array> <string>ShotGrid</string> </array> </dict> </array>
- Applications 폴더로 이동 및 실행:
- .app 번들을 /Applications 폴더에 복사.
Linux에서 프로토콜 등록
- GNOME 설정 도구 사용:
-
gconftool-2 -t string -s /desktop/gnome/url-handlers/foo/command 'foo "%s"' gconftool-2 -s /desktop/gnome/url-handlers/foo/needs_terminal false -t bool gconftool-2 -s /desktop/gnome/url-handlers/foo/enabled true -t bool
GConf란?
- GNOME 데스크톱 환경에서 사용하는 설정 저장소 시스템입니다
- 애플리케이션의 설정을 저장하고 관리하는 데 사용됩니다
설정 적용:
- 로컬 설정을 전역 설정으로 만들려면 /etc/gconf/gconf.xml.defaults/%gconf-tree.xml 파일에 추가해야 합니다
- 이렇게 하면 시스템의 모든 사용자에게 설정이 적용됩니다
브라우저 호환성:
- Firefox와 GNU IceCat은 알 수 없는 프로토콜을 만나면 gnome-open을 사용합니다
- 이 때문에 GNOME이 아닌 KDE 환경에서도 작동합니다
- 하지만 KDE의 Konqueror 같은 다른 브라우저는 이 방식으로 작동하지 않습니다
사용 예시:
- 이 설정을 마친 후에는 브라우저에서 foo://example 같은 URL을 클릭하면
- 시스템은 설정된 foo 명령어를 실행하게 됩니다
How to set subl:// protocol handler with Unity?
My web app generates clickable URLs like the following when an error occurs: subl://open?url=file://%2Fusr%2Flocal%2Fwebenginex%2Fclass%2Fmodels%2Fwxclient.php&line=123 When I click it I get ...
askubuntu.com
AMI와 프로토콜 연결
- ShotGrid에서 AMI 생성:
- URL 필드에 사용자 지정 프로토콜 입력 (예: shotgrid://processVersion).
- 엔터티 유형에 따라 AMI를 구성.
- 동작 확인:
- ShotGrid에서 엔터티를 우클릭하고 AMI 실행.
- 로컬 애플리케이션이나 스크립트가 실행됨.
데이터 흐름 및 출력
- AMI가 실행되면 다음 데이터가 스크립트로 전달:
-
{ 'protocol': 'shotgrid', 'action': 'processVersion', 'params': { 'entity_type': 'Version', 'selected_ids': ['123', '124'], 'project_name': 'Test Project', 'user_login': 'admin' } }
- 활용 사례:
- 로컬 애플리케이션 열기.
- 데이터 업로드/다운로드.
- PDF 보고서 생성.
- 이메일 전송.
'Flow Production Tracking > Help' 카테고리의 다른 글
Webhooks Guide (0) | 2025.01.01 |
---|---|
Getting Started - Getting started with configurations (0) | 2024.12.26 |
Integrations user guide (0) | 2024.12.26 |
Custom Protocol (1) | 2024.12.25 |
Custom Action Menu Items (0) | 2024.12.25 |