Welcome Guest ( Log In | Register )

2 Pages V  1 2 >  
Reply to this topicStart new topic
> Hentai@home-Downloader auto archiver script, A helpful windows script to archive finished galleries

 
post Apr 10 2011, 00:59
Post #1
dirtyfinger



Newcomer
*
Group: Members
Posts: 31
Joined: 20-May 10
Level 19 (Novice)


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
  1. Install the free archiver 7zip: [www.7-zip.org] 7-zip.org/
  2. Create a new batch file (text file with .bat suffix) and put it in your ...\HentaiAtHome\downloaded\ directory.
    paste the following code in and ...
  3. make sure that the path in the script ("c:\Program Files\7-Zip\7z.exe") is indeed pointing to your 7zip installation.
  4. 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


Usage
Every 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
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Apr 10 2011, 04:34
Post #2
Hentai_Ninja



Newcomer
**
Group: Members
Posts: 80
Joined: 4-February 07
Level 30 (Apprentice)


That sounds kind of handy...
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Apr 10 2011, 07:15
Post #3
kyuubisonic



I may be a wuss, but that doesn't mean you have to say it
***
Group: Members
Posts: 186
Joined: 24-August 10
Level 24 (Novice)


Cool, thanks for this.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Apr 10 2011, 14:46
Post #4
dirtyfinger



Newcomer
*
Group: Members
Posts: 31
Joined: 20-May 10
Level 19 (Novice)


oohh, feedback! (IMG:[invalid] style_emoticons/default/tongue.gif)
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Apr 18 2011, 19:40
Post #5
Mue



Newcomer
*
Group: Members
Posts: 46
Joined: 8-February 07
Level 51 (Artisan)


It's a neat invention. It would be more useful if we could turn it into Java and add it to the main H@H source.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Jul 6 2011, 17:08
Post #6
dirtyfinger



Newcomer
*
Group: Members
Posts: 31
Joined: 20-May 10
Level 19 (Novice)


QUOTE(Mue @ Apr 18 2011, 19:40) *

It's a neat invention. It would be more useful if we could turn it into Java and add it to the main H@H source.

well, nothing stops you from automatically running that script using the scheduling features of windows.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Jul 7 2011, 13:21
Post #7
drive-in



Newcomer
*
Group: Recruits
Posts: 15
Joined: 31-July 09
Level 62 (Master)


Neat-O! Nice idea.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Aug 16 2011, 20:27
Post #8
dirtyfinger



Newcomer
*
Group: Members
Posts: 31
Joined: 20-May 10
Level 19 (Novice)


I recently installed the h@h client on my mac, so i wrote the script for OSX/Linux, too.

Enjoy!

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 ---------------
pause
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Aug 17 2011, 21:22
Post #9
Mue



Newcomer
*
Group: Members
Posts: 46
Joined: 8-February 07
Level 51 (Artisan)


Looks like it can be adapted for other achievers too.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Aug 17 2011, 23:48
Post #10
dirtyfinger



Newcomer
*
Group: Members
Posts: 31
Joined: 20-May 10
Level 19 (Novice)


QUOTE(Mue @ Aug 17 2011, 21:22) *

Looks like it can be adapted for other achievers too.

Sure. You just have to figure out the command line arguments. Use zip or rar, though, for either .cbr or .cbz files.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Jan 26 2013, 09:23
Post #11
comsci



Lurker
Group: Recruits
Posts: 3
Joined: 6-July 07
Level 36 (Apprentice)


If edit your code a little, just for everyone who don't want to include directory in archive. (IMG:[invalid] style_emoticons/default/smile.gif)
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\*.*"
        rd "%%x" /s /q < j.txt
    )
    if not exist "%%x\galleryinfo.txt" (
        echo INCOMPLETE gallery in "%%x"
    )
)

del j.txt

pause
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Jan 27 2013, 20:14
Post #12
dirtyhairry



Latecomer
****
Group: Members
Posts: 394
Joined: 26-January 12
Level 321 (Destined)


Cool script, bro. (IMG:[invalid] style_emoticons/default/biggrin.gif)
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Jan 29 2013, 23:04
Post #13
JapaG



Casual Poster
***
Group: Members
Posts: 149
Joined: 12-May 11
Level 216 (Godslayer)


It's a nice script and very useful. However, I'd been using it for nearly 6 months when I realized it didn't archive folders starting with a "-" (minus) character, it however deleted them. Hundreds of galleries were just deleted during that 6 months period instead of being archived. So beware!
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Nov 12 2013, 02:18
Post #14
mrpops



Casual Poster
***
Group: Gold Star Club
Posts: 195
Joined: 27-July 13
Level 500 (Godslayer)


Just stumbled upon this. It is fucking brilliant. Why it isn't in the wiki as some kind of addon I will never know. Maybe we could get it added?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Jan 30 2015, 03:49
Post #15
micnorian14



Newcomer
*
Group: Recruits
Posts: 11
Joined: 26-April 10
Level 180 (Destined)


I just loath digging up old threads. But this is for a good reason as people using this script could certainly benefit from it.

I've been using this for a while now - and it really does do a good job. Very simple and easy to use. The problem I'm having now is that I want to sort the generated files into folders by artist, using part of the existing file name to create a subfolder if one does not yet exist, then move said file into it.

I've had near success using robocopy with operands like sorting files into folders based on certain strings of wildcards like:

"(C??) [* *] * [*].cbz" or "[* (* *)] * [*].cbz"

But automating this into the bat file would be much less tedious as I already have to manually sort files with weird characters in the filename. I just don't know how to use strings of wildcards in DOS let alone generate folders and move said files into them! None of the forums I've seen so far have specific enough examples I can work with.

It sounds complicated but in reality we're just establishing there is a string in the filename that looks like "[this *] * [*].cbz" and we want to move those files into a folder called [this] and ignore the rest. It is doable.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Jan 30 2015, 04:06
Post #16
hzqr



Savagely Still
********
Group: Gold Star Club
Posts: 4,672
Joined: 13-May 09
Level 462 (Dovahkiin)


Having to rename standard file extensions so they're compatible with a shitty image viewer that hasn't been updated in 11 years is beyond retarded.
Please, think of the children: use standard *.zip, *.rar and *.7z.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Jan 30 2015, 04:37
Post #17
blue penguin



in umbra, igitur, pugnabimus
***********
Group: Gold Star Club
Posts: 10,045
Joined: 24-March 12
Level 500 (Godslayer)


hey! evince supports .cbz as it main comic format...
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Jan 30 2015, 04:46
Post #18
hzqr



Savagely Still
********
Group: Gold Star Club
Posts: 4,672
Joined: 13-May 09
Level 462 (Dovahkiin)


It's not a format, they are literally renamed archives (.zip -> .cbz, .rar -> .cbr, .7z -> .cb7, etc.)
This is one of those things that drives me crazy.
"You know what we should do? We should make a program to read standard archives, except that users will have to rename every archive to a different, non-standard extension before they can view them! This makes perfect sense!"
WHY
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Jan 30 2015, 06:32
Post #19
blue penguin



in umbra, igitur, pugnabimus
***********
Group: Gold Star Club
Posts: 10,045
Joined: 24-March 12
Level 500 (Godslayer)


Yeah, I know. In theory you could argue that the .cbz/.cbr/.cb7/.cbt are archives which cannot contain directories, which you could argue that is a standard above the archive standard.
Spoiler text - Highlight to read...
i know, that's a shitty argument. It is just... that... i'm so used to these extensions...

also if you rename a .cbz to .zip evince stops being able to open it, that's utter crap
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Jan 30 2015, 09:04
Post #20
el h



It's all about the Pentiums, baby!
*******
Group: Members
Posts: 1,328
Joined: 10-November 09
Level 402 (Ascended)


There are multiple file formats that are basically zip files, but with extra rules about the structure inside. They often use their own extension.

Two others that come to mind are OpenOffice documents and Java jar files.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post


2 Pages V  1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 


Lo-Fi Version Time is now: 11th May 2024 - 17:24