How well does this work with Readarr? #248
Replies: 8 comments 2 replies
-
I was just wondering the same thing while looking in to setting up some sort of book automation. Would be interesting to hear what peoples workflows are like. |
Beta Was this translation helpful? Give feedback.
-
Going to add my voice here as someone trying to integrate this with Readarr. |
Beta Was this translation helpful? Give feedback.
-
I can think of a couple of ways to do this:
#!/usr/bin/env bash
# Folder to monitor
WATCH_FOLDER="/media/Readarr_library"
echo "Watching folder: $WATCH_FOLDER"
# CWA Ingest Folder Path
CWA_INGEST="/opt/cwa-book-ingest"
echo "CWA Ingest Folder: $CWA_INGEST"
# Monitor the folder for new files
inotifywait -m -r --format="%e %w%f" -e close_write -e moved_to "$WATCH_FOLDER" |
while read -r events filepath; do
echo "New file detected: $filepath"
cp -r "$filepath" "$CWA_INGEST"
done |
Beta Was this translation helpful? Give feedback.
-
Do new books need to go to the ingest folder? What if they just went to the "root folder" in Readarr which is where your library is located? |
Beta Was this translation helpful? Give feedback.
-
Alternatively, you could configure your downloader (at least for usenet via nzb/sabnzbd) to dump downloads into the ingest folder and then CWA would ingest and move to your root folder (aka library folder). |
Beta Was this translation helpful? Give feedback.
-
@vhsdream I really liked your first suggestion to use a custom script triggered by readarr. The suggestion inspired me to write the below script. I have it set up in readarr to trigger on release import and on upgrade. When that happens it will copy the ebook file to the specified cwa ingest folder. This was only really made possible as I discovered readarr provides a environment variable with the full paths for imported or upgraded books as Anyway I hope some people find this script useful. It has massively helped me. Note: I believe #!/usr/bin/env bash
# Log file for debugging
LOGFILE="/config/logs/readarr-book-copy.log" # path to your readarr log folder
# Log all environment variables (useful for debugging Readarr's behavior)
# echo "$(date): Script environment variables:" >> "$LOGFILE"
# set >> "$LOGFILE"
# Exit early if READARR_EVENTTYPE is "Test"
if [ "$readarr_eventtype" == "Test" ]; then
echo "$(date): INFO - Received 'Test' event from Readarr, exiting script early." >> "$LOGFILE"
exit 0
fi
# Readarr environment variables
BOOK_PATHS="$readarr_addedbookpaths"
DEST_DIR="/media/book-ingest" # Replace with the path to your book ingest folder
# Check if BOOK_PATHS is empty
if [ -z "$BOOK_PATHS" ]; then
echo "$(date): ERROR - No book paths found in READARR_ADDEDBOOKPATHS." >> "$LOGFILE"
exit 1
fi
# Process each book path (assuming | is the separator)
IFS='|' read -ra BOOK_ARRAY <<< "$BOOK_PATHS"
for BOOK_PATH in "${BOOK_ARRAY[@]}"; do
# Trim leading/trailing spaces (just in case)
BOOK_PATH=$(echo "$BOOK_PATH" | xargs)
# Ensure the book file exists
if [ ! -f "$BOOK_PATH" ]; then
echo "$(date): ERROR - Book not found: $BOOK_PATH" >> "$LOGFILE"
continue
fi
# Extract the filename
BOOK_FILENAME=$(basename "$BOOK_PATH")
# Define the destination file path
DEST_BOOK="$DEST_DIR/$BOOK_FILENAME"
# Copy the book
cp -v "$BOOK_PATH" "$DEST_BOOK" >> "$LOGFILE" 2>&1
# Check if the copy was successful
if [ $? -eq 0 ]; then
echo "$(date): SUCCESS - Copied '$BOOK_PATH' to '$DEST_BOOK'" >> "$LOGFILE"
else
echo "$(date): ERROR - Failed to copy '$BOOK_PATH'" >> "$LOGFILE"
fi
done
exit 0 |
Beta Was this translation helpful? Give feedback.
-
Won't any solution where Readarr moves it to the ingest folder still not solve the issue of the management part of Readarr? Sure it will move it to the CWA ingest folder, but then CWA will ingest it and Readarr will not longer see it and keep track of what you have. |
Beta Was this translation helpful? Give feedback.
-
I see Readarr is capable to send to a Calibre content server. Wouldn't it be possible for it to use the database on Calibre-Web-Automated ? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I just installed this last night and I love the work put into it!
However, unless I'm mistaken, this doesn't really work with Readarr's function as a book database, does it?
Since how you add books is the ingest folder and that removes whatever you put into it.
Or is there a way to use both in conjunction with each other?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions