Created
August 15, 2024 01:59
-
-
Save jcarletto27/fd42ebeda18afe729cb968748af70d9b to your computer and use it in GitHub Desktop.
This file contains hidden or 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/bash | |
######################ABOUT########################### | |
# this plus split_library.py in the same folder | |
# allow for relative symlinking in such a way that docker audiobookshelf | |
# can scan and utilize a logical library system instead of a hardlinked one | |
# can support any number of account nicknames | |
##################################################### | |
# requires symlinks utility to be installed | |
# Copy this gist and the split_library.py to a folder and give them chmod +X | |
# Pick a starting directory for your library, the folder name of your Full library | |
# a full pathh to a folder not more than one layer up from your full library | |
# congfigure libation to use account nickname with a single username like "jsmith" and "jdoe" | |
# a folder configuration that begins with <account nickname> | |
STARTING_DIR="/mnt/ssd" | |
FULL_LIBRARY_DIR="Books" #must be no more than one layer away from starting directory | |
USERSARRAY=("ACCOUNTNICKNAME1" "ACCOUNTNICKNAME2") | |
for STR_USER in ${USERSARRAY[@]}; do | |
TARGET_DIR="${STARTING_DIR}/library_${STR_USER}" # must be no more than one layer above the full library directory | |
SOURCE_DIR="${STARTING_DIR}/${FULL_LIBRARY_DIR}" | |
echo "${SOURCE_DIR} ${TARGET_DIR} ${STR}" | |
/usr/bin/env python ./split_library.py ${SOURCE_DIR} ${TARGET_DIR} ${STR_USER} | |
sudo symlinks -cr "${TARGET_DIR}" #recursively changes absolute symlinks to relative ones | |
#relative symlinks for docker audiobookshelf have some limitations based on dockerfile or docker-compose volume settings | |
done | |
<<comment | |
this is what part of my docker-compose.yml looks like for folder structure | |
my libation docker data volume looks like this | |
- /mnt/ssd/Books:/data | |
take notice of the full and split library folders | |
audiobookshelf: | |
image: "advplyr/audiobookshelf:latest" | |
ports: | |
- "13378:80" | |
restart: always | |
volumes: | |
- /mnt/ssd/Books:/audiobooks/FullLibrary | |
- /mnt/ssd/Podcasts:/podcasts | |
- /mnt/ssd:/audiobooks/SplitLibrary | |
- ./metadata:/metadata | |
- ./config:/config | |
comment |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment