I don't know how many people use the hentai@home client on a windows machine, but those that do and use it to download galleries might find this script useful.
What does it do?It checks your \HentaiAtHome\downloaded\ directory for finished galleries, zips them into .cbz archives (standard zip files renamed for comic book viewers like CDisplay) and subsequently deletes the now zipped directory.
Installation- Install the free archiver 7zip: [www.7-zip.org] 7-zip.org/
- Create a new batch file (text file with .bat suffix) and put it in your ...\HentaiAtHome\downloaded\ directory.
paste the following code in and ... - make sure that the path in the script ("c:\Program Files\7-Zip\7z.exe") is indeed pointing to your 7zip installation.
- Save. Done.
CODE
@echo off
:start
echo j > j.txt
for /d %%x in (*.*) do (
if exist "%%x\galleryinfo.txt" (
echo galleryinfo.txt FOUND in "%%x"
"c:\Program Files\7-Zip\7z.exe" a -tzip -mx0 "%%x".zip "%%x\*.*"
ren "%%x".zip "%%x".cbz
rd "%%x" /s /q < j.txt
)
if not exist "%%x\galleryinfo.txt" (
echo INCOMPLETE gallery in "%%x"
)
)
del j.txt
pause
UsageEvery once in a while (when it's 'personal' time, y'know) go to the \downloaded\ directory and run the batch file. A dos terminal opens and displays status messages.
You'll notice how the directory fills with cbz files while removing the corresponding directories.
The script above doesn't compress the pics - it merely stores them for speed reasons and because compression usually doesn't yield that much of a space saving advantage with jpg/png files. If you want to use compression anyway, simply modify the "-mx0" parameter by setting any number from 0 to 9 with "-mx9" being the slowest and highest compression factor.
Cheers!
PS: Mind you, some malware/virus scanner could object to this script because it uses the command line command "rd", which recursively removes whole directories, in this case without even asking if that's ok. If you feel suspicious, ask someone who can read the code so he can put you (and your system protection software) at ease. After all, the rd command indeed has the potential to ruin your day if used wrong.
Update!The following script is for
Mac OSX users but it should work for older Macs and
Linux, too.
Just create a text file, paste the code in and chmod it to executable.
Oh, and you have to install zip using the usual packet managers.
CODE
FILE=galleryinfo.txt
for dir in */
do
base=$(basename "$dir")
echo ---------------
echo Checking $basename
echo ---
if [ -f "$dir"$FILE ];
then
echo "Gallery complete! Archiving ..."
zip -0 "${base}.cbz" "$dir"*
wait
rm "$dir"*
rmdir "$dir"
else
echo "galleryinfo.txt does not exist. Gallery incomplete."
fi
done
echo ---------------
This post has been edited by dirtyfinger: Aug 16 2011, 20:20