Skip to content

Commit

Permalink
feat: 🎸 拆分emby和jellyfin的media数据
Browse files Browse the repository at this point in the history
  • Loading branch information
monlor committed Jun 6, 2024
1 parent e880f1e commit 7cd1061
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 41 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ export VERSION=main && bash -c "$(curl -fsSL ${GH_PROXY}https://raw.githubuserco

| 部署方案 | CPU | 内存 | 硬盘 |
| ----------------- | -------- | --------- | --------- |
| Alist + Emby | 2核 | 4G | 150G |
| Alist + Emby | 2核 | 4G | 140 |
| 仅部署 Alist | 1核 | 512M | 512M |
| Alist + Emby + Jellyfin | 2核 | 4G | 200G |
| Alist + Jellyfin | 2核 | 4G | 150G |
| Alist + Emby + Jellyfin | 2核 | 4G | 300G |
| Alist + Jellyfin | 2核 | 4G | 155G |

## 配置示例

Expand Down
4 changes: 3 additions & 1 deletion docker-compose-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ services:
- media:/media/xiaoya
- config:/media/config
- cache:/media/config/cache
- jf_media:/media/jf_xiaoya
- jf_config:/media/jf_config
- jf_cache:/media/jf_config/cache
- meta:/media/temp
Expand Down Expand Up @@ -57,7 +58,7 @@ services:
- metadata
- alist
volumes:
- media:/media
- jf_media:/media
- jf_config:/config
- jf_cache:/cache
ports:
Expand All @@ -74,6 +75,7 @@ volumes:
media:
config:
cache:
jf_media:
jf_config:
jf_cache:
meta:
Expand Down
6 changes: 3 additions & 3 deletions docker-compose-jellyfin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
- env
volumes:
- xiaoya:/etc/xiaoya
- media:/media/xiaoya
- jf_media:/media/jf_xiaoya
- jf_config:/media/jf_config
- jf_cache:/media/jf_config/cache
- meta:/media/temp
Expand All @@ -39,7 +39,7 @@ services:
- metadata
- alist
volumes:
- media:/media
- jf_media:/media
- jf_config:/config
- jf_cache:/cache
ports:
Expand All @@ -53,7 +53,7 @@ networks:

volumes:
xiaoya:
media:
jf_media:
jf_config:
jf_cache:
meta:
108 changes: 74 additions & 34 deletions metadata/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,38 @@ download_meta() {
fi
}

download_media() {
if [ -f "${MEDIA_DIR}/xiaoya/media_finished" ]; then
download_emby_config() {
if [ -f ${MEDIA_DIR}/config/emby_meta_finished ]; then
echo "Emby metadata has been downloaded. Delete the file ${MEDIA_DIR}/config/emby_meta_finished to re-extract."
fi

disk_check ${MEDIA_DIR}/temp 5
disk_check ${MEDIA_DIR}/config 5

echo "Downloading Emby config..."

cd "${MEDIA_DIR}/temp"
download_meta config.mp4

echo "Extracting Emby config..."

cd ${MEDIA_DIR}
7z x -aoa -mmt=16 temp/config.mp4

download_media

touch ${MEDIA_DIR}/config/emby_meta_finished
}

download_emby_media() {
if [ -f "${MEDIA_DIR}/xiaoya/emby_media_finished" ]; then
echo "Media has been downloaded. Delete the file ${MEDIA_DIR}/xiaoya/media_finished to re-extract."
return
fi

echo "Cleaning up emby media..."
rm -rf ${MEDIA_DIR}/xiaoya/*

disk_check ${MEDIA_DIR}/temp 60
disk_check ${MEDIA_DIR}/xiaoya 70

Expand All @@ -98,55 +125,68 @@ download_media() {
touch ${MEDIA_DIR}/xiaoya/media_finished
}

if [ "${EMBY_ENABLED:=false}" = "true" ]; then
if [ -f ${MEDIA_DIR}/config/emby_meta_finished ]; then
echo "Emby metadata has been downloaded. Delete the file ${MEDIA_DIR}/config/emby_meta_finished to re-extract."
else

disk_check ${MEDIA_DIR}/temp 5
disk_check ${MEDIA_DIR}/config 5
download_jellyfin_config() {
if [ -f ${MEDIA_DIR}/jf_config/jellyfin_meta_finished ]; then
echo "Jellyfin metadata has been downloaded. Delete the file ${MEDIA_DIR}/jf_config/jellyfin_meta_finished to re-extract."
return
fi

echo "Downloading Emby config..."
disk_check ${MEDIA_DIR}/temp 5
disk_check ${MEDIA_DIR}/jf_config 20

cd "${MEDIA_DIR}/temp"
download_meta config.mp4
echo "Downloading Jellyfin config..."

echo "Extracting Emby config..."
cd ${MEDIA_DIR}/temp
download_meta config_jf.mp4 Jellyfin/

echo "Extracting Jellyfin config..."

cd ${MEDIA_DIR}
7z x -aoa -mmt=16 temp/config.mp4
cd ${MEDIA_DIR}
7z x -aoa -mmt=16 temp/config_jf.mp4

download_media
download_media

touch ${MEDIA_DIR}/config/emby_meta_finished
touch ${MEDIA_DIR}/jf_config/jellyfin_meta_finished
}

download_jellyfin_media() {
if [ -f "${MEDIA_DIR}/jf_xiaoya/jellyfin_media_finished" ]; then
echo "Media has been downloaded. Delete the file ${MEDIA_DIR}/jf_xiaoya/jellyfin_media_finished to re-extract."
return
fi
fi
echo "Cleaning up jellyfin media..."
rm -rf ${MEDIA_DIR}/jf_xiaoya/*

if [ "${JELLYFIN_ENABLED:=false}" = "true" ]; then
if [ -f ${MEDIA_DIR}/jf_config/jellyfin_meta_finished ]; then
echo "Jellyfin metadata has been downloaded. Delete the file ${MEDIA_DIR}/config/jellyfin_meta_finished to re-extract."
else
disk_check ${MEDIA_DIR}/temp 60
disk_check ${MEDIA_DIR}/jf_xiaoya 70

echo "Downloading media..."

disk_check ${MEDIA_DIR}/temp 5
disk_check ${MEDIA_DIR}/jf_config 20
cd "${MEDIA_DIR}/temp"
download_meta all_jf.mp4 Jellyfin/
download_meta PikPak_jf.mp4 Jellyfin/

echo "Downloading Jellyfin config..."
echo "Extracting media..."

cd ${MEDIA_DIR}/temp
download_meta config_jf.mp4 Jellyfin/

echo "Extracting Jellyfin config..."
cd ${MEDIA_DIR}/jf_xiaoya
7z x -aoa -mmt=16 ${MEDIA_DIR}/temp/all_jf.mp4

cd ${MEDIA_DIR}
7z x -aoa -mmt=16 temp/config_jf.mp4
cd ${MEDIA_DIR}/jf_xiaoya
7z x -aoa -mmt=16 ${MEDIA_DIR}/temp/PikPak_jf.mp4

download_media
chmod -R 777 ${MEDIA_DIR}/jf_xiaoya

touch ${MEDIA_DIR}/jf_config/jellyfin_meta_finished
touch ${MEDIA_DIR}/jf_xiaoya/media_finished
}

fi
if [ "${EMBY_ENABLED:=false}" = "true" ]; then
download_emby_config
download_emby_media
fi

if [ "${JELLYFIN_ENABLED:=false}" = "true" ]; then
download_jellyfin_config
download_jellyfin_media
fi

crontabs=""
Expand Down

0 comments on commit 7cd1061

Please sign in to comment.