google-drive-ocamlfuse
https://github.com/astrada/google-drive-ocamlfuse
- 설치
$ sudo pacman -S opam
$ opam init
<><> Required setup - please read <><><><><><><><><><><><><><><><><><><><><><><>
In normal operation, opam only alters files within ~/.opam.
However, to best integrate with your system, some environment variables
should be set. If you allow it to, this initialisation step will update
your zsh configuration by adding the following line to ~/.zshrc:
test -r /home/nietz/.opam/opam-init/init.zsh && . /home/nietz/.opam/opam-init/init.zsh > /dev/null 2> /dev/null || true
Otherwise, every time you want to access your opam installation, you will
need to run:
eval $(opam env)
You can always re-run this setup with 'opam init' later.
Do you want opam to modify ~/.zshrc? [N/y/f]
(default is 'no', use 'f' to choose a different file) n
A hook can be added to opam's init scripts to ensure that the shell remains in sync with the opam environment when they are loaded. Set that up? [y/N] y
$ ocaml --version
The OCaml toplevel, version 4.07.0
$ opam switch create ./ ocaml-base-compiler.4.07.0
$ opam install gapi-ocaml google-drive-ocamlfuse
- 세팅
Authorization
https://github.com/astrada/google-drive-ocamlfuse/wiki/Authorization
$ eval $(opam env)
$ google-drive-ocamlfuse
웹브라우저 실행됨 -> 해당 아디 로긴 -> 권한 허용 ok
- 마운트
$ mkdir -p ~/Googledrive/User1
$ eval $(opam env)
$ google-drive-ocamlfuse ~/Googledrive/User1
- 마운트 해제
$ fusermount -u ~/Googledrive/user1
- 마운트 강제 해제
$ fusermount -uz ~/Googledrive/user1
- 팀드라이브 마운트
Team Drives
https://github.com/astrada/google-drive-ocamlfuse/wiki/Team-Drives
$ google-drive-ocamlfuse -label myTeamDrive
브라우저 실행됨, 팀드라이브 소속 아디로 로그인 -> 권한 허용 ok
구글 드라이브의 팀드라이브의 최상위 폴더 크릭 -> 주소창의 주소중 마지막 토큰 부분 복사
: https://drive.google.com/drive/folders/xxxxxxxxxxxxxxxxxxxx
| gdfuse 환경설정 파일 경로
1. 개인 default 구글 드라이브 : ~/.gdfuse/default/
2. 라벨로 생성한 구글 팀드라이브: ~/.gdfuse/myTeamDrive/
$ vim ~/.gdfuse/myTeamDrive/config
team_drive_id=xxxxxxxxxxxxxxxxxxxx ## 팀드라이브 토큰 값 기재
| 팀드라이브 마운트
$ mkdir -p ~/Googledrive/PlexTeamDrive
$ eval $(opam env)
$ google-drive-ocamlfuse -label myTeamDrive ~/Googledrive/PlexTeamDrive
- 팀드라이브 마운트 해제
$ fusermount -u ~/Googledrive/PlexTeamDrive
- 영상 스트리밍을 위한 설정값
Configuration
https://github.com/astrada/google-drive-ocamlfuse/wiki/Configuration
$ vim ~/.gdfuse/myTeamDrive/config
stream_large_files=true
large_file_read_only=false
memory_buffer_size=1048576 (* 1MB *)
max_memory_cache_size=10485760 (* 10MB *)
read_ahead_buffers=3
- 파일 관리(다운로드, 업로드, 리네임, 복사, 이동, ...) 및 영상 재생
$ ranger
"zP" "zp" "zi" "zv" : 디렉토리, 파일, 이미지 미리보기 토글(끄기) , preview_script 토글(끄기)
"zc" : collapse_preview! 토글.. 서브디렉토리 프리뷰 끄기, 구글 드라이브 API 호출 제한 밴 방지목적
탐색 후, "l"키 : mpv로 재생
| 팀드라이브 config 전체 설정값
apps_script_format=json
apps_script_icon=
async_upload=true
cache_directory=
client_id=
client_secret=
connect_timeout_ms=5000
curl_debug_off=false
data_directory=
delete_forever_in_trash_folder=false
docs_file_extension=true
document_format=odt
document_icon=
download_docs=true
drawing_format=png
drawing_icon=
form_format=zip
form_icon=
fusion_table_format=desktop
fusion_table_icon=
keep_duplicates=false
large_file_read_only=false
large_file_threshold_mb=16
log_directory=
lost_and_found=false
low_speed_limit=0
low_speed_time=0
map_format=desktop
map_icon=
max_cache_size_mb=512
max_download_speed=0
max_memory_cache_size=10485760
max_retries=8
max_upload_chunk_size=1099511627776
max_upload_speed=0
memory_buffer_size=1048576
metadata_cache_time=60
presentation_format=pdf
presentation_icon=
read_ahead_buffers=3
read_only=false
root_folder=
shared_with_me=false
spreadsheet_format=ods
spreadsheet_icon=
sqlite3_busy_timeout=5000
stream_large_files=true
team_drive_id=xxxx블라블라xxxx
umask=0o022
verification_code=
$ opam env
OPAM_SWITCH_PREFIX='/home/nietz/_opam'; export OPAM_SWITCH_PREFIX;
CAML_LD_LIBRARY_PATH='/home/nietz/_opam/lib/stublibs:/home/nietz/_opam/lib/ocaml/stublibs:/home/nietz/_opam/lib/ocaml'; export CAML_LD_LIBRARY_PATH;
OCAML_TOPLEVEL_PATH='/home/nietz/_opam/lib/toplevel'; export OCAML_TOPLEVEL_PATH;
MANPATH=':/home/nietz/_opam/man'; export MANPATH;
PATH='/home/nietz/_opam/bin:/home/nietz/.local/bin:/home/nietz/bin:/usr/local/bin:/home/nietz/.local/bin:/home/nietz/bin:/usr/local/bin:/usr/lib/hardening-wrapper/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/nietz/.fzf/bin:/home/nietz/.cabal/bin'; export PATH;
Automounting
https://github.com/astrada/google-drive-ocamlfuse/wiki/Automounting
- Mount from login scripts
$ vim ~/.zprofile
# GoogleDrive Automounting
eval $(opam env)
mount | grep "${HOME}/GoogleDrive/User1" >/dev/null || google-drive-ocamlfuse "${HOME}/GoogleDrive/User1"
mount | grep "${HOME}/GoogleDrive/PlexTeamDrive" >/dev/null || google-drive-ocamlfuse -label myTeamDrive "${HOME}/GoogleDrive/PlexTeamDrive"
For Media Server
- "media" 그룹 생성 (gid=1001 할당)
$ sudo groupadd -g 1001 media
- "media" 구룹에 그룹 멤버들 추가
$ sudo gpasswd -a user1 -a plex -a emby media
- 그룹리스트 확인
$ grep media /etc/group
media:x:1001:user1,plex,emby
- Plex-Media-Server systemd 파일 수정
$ sudo vim /usr/lib/systemd/system/plexmediaserver.service
[Unit]
Description=Plex Media Server
After=network.target
[Service]
WorkingDirectory=/opt/plexmediaserver
EnvironmentFile=/etc/conf.d/plexmediaserver
ExecStart=/opt/plexmediaserver/Plex\x20Media\x20Server
Type=simple
User=plex
Group=media
Restart=on-failure
RestartSec=5
StartLimitInterval=60s
StartLimitBurst=3
StandardOutput=null
[Install]
WantedBy=multi-user.target
- Emby Server systemd 파일 수정
$ sudo vim /usr/lib/systemd/system/emby-server.service
[Unit]
Description=Emby brings together your videos, music, photos, and live television.
[Service]
EnvironmentFile=/etc/conf.d/emby-server
WorkingDirectory=/usr/lib/emby-server
ExecStart=/usr/bin/emby-server
RestartForceExitStatus=3
User=emby
Group=media
[Unit]
After=network.target
[Install]
WantedBy=multi-user.target
- 미디어 서버 Daemon 재시작
$ sudo systemctl daemon-reload
$ sudo systemctl restart plexmediaserver.service
$ sudo systemctl restart emby-server.service
- fuse.conf 파일 수정 ( for 미디어 서버에서 해당 팀드라이브에 접근, 스캔 할 수 있도록 )
$ sudo vim /etc/fuse.conf
# Set the maximum number of FUSE mounts allowed to non-root users.
# The default is 1000.
#
#mount_max = 1000
# Allow non-root users to specify the 'allow_other' or 'allow_root'
# mount options.
#
user_allow_other
- 팀드라이브 Re-Mount ( ~/.zprofile 파일에 아래 라인으로 수정)
fuse mount option : https://www.systutorials.com/docs/linux/man/8-mount.fuse/
$ mount | grep "~/GoogleDrive/PlexTeamDrive" >/dev/null || google-drive-ocamlfuse -label myTeamDrive -o uid=1000,gid=1001,allow_other "${HOME}/GoogleDrive/PlexTeamDrive"
- Plex나 Emby 에서 해당 팀드라이브의 특정 폴더를 라이브러리 폴더 지정해서 스캔
- Home Local 재생 : pmcli + mpv (with Plex-Media-Server) - Direct Play , 실시간 외부필터 스크립트 사용가능(vapoursynth filter, ffmpeg filter, mpv internal filter)
- Remote 모바일 재생 : 웹브라우저, 안드로이드 Emby APP, IOS Emby APP
(with Emby Server - VAAPI 하드웨어 트랜스코딩, / 웹브라우저에서 smi, srt 자막 재생인 경우에도 트랜스코딩 없이 Direct Play로 자막 오버레이 재생 가능)
- google-drive-ocamlfuse : 읽기/쓰기 가능, 구글 API 호출 Limit 제한 조심, 작업용
plexdrive : 읽기만 가능, 스트리밍 전용, 많은 수의 라이브러리 보유시 스캔용
RaiDrive : 윈도우OS 용
Plexdrive Tutorial
https://github.com/dweidenfeld/plexdrive/blob/master/TUTORIAL.md