Listen up nignogs. I got 2 objectives

Listen up nignogs. I got 2 objectives.

1. Scan through any CBZ or CBR inside a directory and its subdirectories.
2. Create a list of CBZ/CBR files with minimum one PNG file

What's the best way to accomplish this on Windows, and how much would it cost for someone to make a batch script or software to do it for me?

I've basically got millions of CBR/CBZ files with PNG images with the JPG extension and it takes too much time to manually look it up.

Attached: 1523973064101.jpg (1680x945, 175K)

Other urls found in this thread:

warosu.org/g/?task=search&ghost=yes&search_text="Listen up nignogs"
warosu.org/g/?task=search&ghost=yes&search_text=cbz png
w3.org/TR/PNG-Structure.html
libpng.org/pub/png/spec/1.2/PNG-Rationale.html#R.PNG-file-signature
twitter.com/NSFWRedditVideo

Just write a batch file lmao

didn't make this thread yesterday?

write one and i'll give you $20 if it works over btc or eth

...

I'll do it in JavaScript and java with a database and React for 1000 dollars my good sir :) you will indeed do the needful sir

Good luck if you want to actually detect PNGs with bad extension and not just search list of filenames.

yup, this one's the third, in fact
warosu.org/g/?task=search&ghost=yes&search_text="Listen up nignogs"
damn u dum
why do you need it though, autism?
eh, a bit less trivial, but still not too hard

As a matter of fact the guy seems like he's been more civilized back in the day, but is now going full fucktard:
warosu.org/g/?task=search&ghost=yes&search_text=cbz png

>seems like he's been more civilized back in the day
hm
>Yeah I'm going to buy a 12TB drive to unzip a bunch pf.files for no reason
>
>Go fuck yourself you autistic retard
nah
OP, you're a dumb kid that's not gonna get far with that attitude

looks like his first recognizable post
Might make for some good reading with how he gets deservedly shat on

found an earlier one
Man, OP's faggotry knows no bounds

in the 3 months he's trying to do this, he could actually have learned enough programming instead of begging. that's sad.

>OP's faggotry knows no bounds
I mean just look at this guy
>python code
>where do i put it
and he has the gall to insult the sad bastards that try to help him

absolutely
not to mention done the quicker approach
- quick and shitty ubongo vm
- test shitty code multiple people already wrote *for* him
- ask questions when it doesn't work, and gain at least some vague idea about what's happening
Could've done it in an evening or two, but he's gonna continue being useless with his 2TB million cbz/cbr files containing PNGs named as .jpg.
What I wonder is why he's looking for that shit. There's some juicy retardation hiding behind this requirement.

Learn to do it yourself. It'll be a fun experience in figuring out how retarded you are.

Attached: 1520246358675.jpg (846x1200, 308K)

It's a shame that the guy is acting like such a spoiled tween.
The problem's trivial enough that it's a fun exercise

>65580667
>65580409
>65580358
>65580258
>65580207
>65580163
>65580142
Stop samefagging.

Yeah why can't everyone on this planet be a programmer.

Why are you here again?

learn
- how to quote
- what samefagging means

I wonder if
was the same dumbass

Maybe even
is the same fag.
>3dpd
>anime tiddies
>gay
Could this be a roastie?
Nah, that'd be hitting way too many behavioral stereotypes ITT and in the fag's post history.

probably some retarded /u/ or /y/ fag

>Hydra

What

They're schizophrenic and they believe everyone on Jow Forums is OP. It's pretty hilarious.

Have you solved your issue yet?

>Heil Hydra obviously
Have you heard of hydrus?
I'm surprised it's not getting shilled more often here.
Or maybe it's simply past its prime.

Hydra is awful, have you actually ever used it?

OP hasn't solved his problem in 3 months with multiple people writing seemingly working code for him.
Make a guess.

Heard some "nice" things about its UI/UX, but it seemed like normieposting.

I could tell you how to get rich right now, but you'd still be a poor uneducated mutt. Why's that?

?

Seems like there's more posts with this whole "recursive cbz porn" silliness
>How hard would it be to make a bash script that starts at my porn directory, and then checks all folders, if the folder has no other folders, it zips itself up and replaces the folder with a cbz, else it runs itself again on that folder?

It'll probably need powershell, and you'd be better off using python or something.

Learn how image files work. For PNG, check the docs: w3.org/TR/PNG-Structure.html

"The first eight bytes of a PNG file always contain the following (decimal) values:"

137 80 78 71 13 10 26 10

Use this to determine what is actually a PNG and what is not.

The rest of it is very basic.

Attached: 1505210674942.png (589x800, 401K)

>Learn how image files work. For PNG, check the docs:
No need, the magic number ought to be sufficient.

By the way those smart bastards put a bit more thought than expected into it:
libpng.org/pub/png/spec/1.2/PNG-Rationale.html#R.PNG-file-signature
>This signature both identifies the file as a PNG file
>and provides for immediate detection of common file-transfer problems.
>The first two bytes distinguish PNG files on systems that expect the first two bytes to identify the file type uniquely.
>The first byte is chosen as a non-ASCII value to reduce the probability that a text file may be misrecognized as a PNG file;
>also, it catches bad file transfers that clear bit 7. Bytes two through four name the format.
>The CR-LF sequence catches bad file transfers that alter newline sequences.
>The control-Z character stops file display under MS-DOS.
>The final line feed checks for the inverse of the CR-LF translation problem.
The chunking organization was supposedly inspired by IFF, whose history (EA, Amiga) is also pretty interesting if you're into file format autism.

if i help you, you will upload your hentai collection to mega.nz and share the link with me. deal?

Attached: 903713.png (1920x1080, 3.14M)

i won't upload it to mega.nz, i'll just run a sftp and you can connect to it

sounds good to me. i'll start working right away.

Attached: 1523862979804.jpg (828x720, 80K)

Do you also have a thing for reading RFCs?

Attached: 1519326130729.jpg (306x336, 29K)

Fuck no, not enough autism nowadays for that.
Needed to do some simple shit with PNGs, so I skimmed the format docs.

you basically want to extract cbz/cbr archive, rename file.jpg to file.png if it's a png and pack all images back to cbz/cbr, yeah? that should be simple enough.

Attached: 1522203945082.png (1160x1079, 595K)

>inb4 not enough space

instead of renaming file.jpg to file.png, i want the name of the cbz/cbr archive added to a list if that's possible, and then it packs everything back to cbz/cbr

what are you trying to achieve?

some of these images have been corrupted and my previous image viewer changed the files from .png to .jpg, it's a complicated story

if i would do it i would extract one archive at a time and then look for fucked up images and then pack them together again. shouldn't take too much space.
if you don't need to make any changes to files within cbz/cbr then there's no need to repack them again. all you need is a list of archives with png files within them, right?

yeah pretty much

I see.
Makes sense.
If the viewer won't make any changes to the files, would it make sense to make them read-only to prevent such issues in the future - even if using less buggy viewers?

>if i would do it i would extract one archive at a time and then look for fucked up images and then pack them together again. shouldn't take too much space.
yep, especially given the "million files, over 2TB" titbit.
Was the usual objection when folks mentioned extracting the last few times.

Bash/Batch will be fine for this. Pretty simple no matter what OS you're running.

Python's probably a better choice in the Windows scenario, though he'd need something for the RAR files.

Attached: 1498209396108.png (856x1300, 714K)

Attached: (you).jpg (570x572, 22K)

#!/bin/bash
find . -type f -iregex ".*\.cb[rz]" | while read i; do
haspng=0
regex=".* image\/png$"
temp="$(mktemp -d)"
7z x -o"$temp" "$i" 1>/dev/null
for p in $(find "$temp" -type f); do
if [[ "$(file --mime-type "$p")" =~ $regex ]]; then
haspng=1
fi
done
if [ $haspng = 1 ]; then
echo File \"$i\" contains a png file.
fi
rm -rf "$temp"
done

Attached: a.png (330x247, 16K)

will it go through subdirectories and provide a txt file with the title of the archive that has png files?

forgot to test/show that, but yes, it does

Attached: a.png (367x296, 16K)

>bash
>find
>mktemp
>7z
>file
>rm
windows. OP might need assistance to get WSL running.
>while read i
does this handle spaces in the path?
>if file =~ png
didn't we want to find the cb*s that contain PNGs with extension .jpg only (), or does any PNG count ()

also note that it doesn't rely on correct filenames either, since it uses 'type' instead of looking at the filename
> file --mime-type actually\ a\ png.jpg
actually a png.jpg: image/png

>does this handle spaces in the path?
nvm, screenshot already has an example

file*

>does this handle spaces in the path?
yes
> ./a.sh
File "./has a png.cbr" contains a png file.
File "./subdir/has a png.cbr" contains a png file.
File "./subdir/has a png.cbz" contains a png file.
File "./subdir with space/has a png.cbr" contains a png file.
File "./subdir with space/has a png.cbz" contains a png file.
File "./has a png.cbz" contains a png file.
>windows. OP might need assistance to get WSL running.
cygwin should be fine, too
>didn't we want to find the cb*s that contain PNGs with extension .jpg only (), or does any PNG count ( (OP))
he wrote "any png"

is there any way to run bash scripts in windows or do i have to format a drive to xfs/ext4 and run it on ubuntu or something

you can use WSL, cygwin, a VM, or a livecd
i haven't used WSL, so i can't comment on it, but cygwin is pretty easy to use

I bet their shows suck.

note that while this wouldn't be hard to write in batch script/powershell, windows doesn't come with much in the way of command-line tools, it would be just as if not more tedious to gather the necessary tools as it would be to just install cygwin, which has an installer for all the common tools

just fucking install a vm or run cygwin or run msys or run a live cd/usb holy shit

why do you make this so fucking hard on yourself. people were saying what you need to do tens of times and you still ask those stupid questions.

frustrating innit
at least it seems that OP finally upgraded from being clueless+dick to clueless only, if he keeps it that way he'll get a lot more help in the future

>any way to run bash scripts in windows or do i have to format a drive to xfs/ext4 and run it on ubuntu or something
no need to go full loonix, you can either
- burn a quick liveCD/USB with ubongo, then just run the script there
- create a ubongo VM, share the porn folder with it and run the script in the VM
- futz around with cygwin or WSL

by the way, consider buying an extra drive and starting a backup schedule, it's handy for situations like this one - both the data loss that started this, and now running someone's potentially data destroying code/OS/VM/program

worst case scenario: you try some stuff, then you notice all your shit's fucked

>you fucks are actually going to get him to use Linux for a bash script rather than just write the shit in python or something.
Senpai

feel free to write something in python then. i'm familiar with bash, but not python

cbz and cbr are literally renamed zips, right? is there any reason I couldn't just zip a folder and rename it .cbr and use that in a reader application?

how reliable is wsl compared to cygwin on windows 10

also, windows doesn't ship with python either, so what's the difference?
install python + the tools vs. install cygwin + the tools

yes, cbz is a renamed zip, and cbr is a renamed rar

thanks dude

>python
>rar support
if it were only cbzs, sure
but supporting cbrs means nig gotta do additional shit besides muh python

it totally doesn't subtly rot your bits

what packages do i need to run that script with cygwin

>you need linux to run bash
user, i...

>google "rar python"
>literally the first result has the solution
what

Install gentoo

bash
findutils (find)
p7zip (7z)
file

>rarfile 3.0 : Python Package Index
as in "need to fuck around with the clusterfuck that is Python package management"

not only that, but
How can I get it work on Windows?
On Windows the unrar.exe is not in PATH so simple Popen("unrar ..") does not work. It can be solved several ways:

Add location of unrar.exe to PATH.
Set rarfile.UNRAR_TOOL to full path of unrar.exe.
Copy unrar.exe to your program directory.
Copy unrar.exe to system directory that is in PATH, eg. C:\Windows.

much easier than a fuckin' live usb

oh, also coreutils for mktemp, rm

just realized i got rid of my cbr a while ago

is it still possible to make it in powershell?

Attached: 1505685328072.png (179x181, 3K)

Good work team we almost got a windows user to install Linux

i kinda agree that python packaging is weird to maintain/update (especially on windows), and for some retarded reason pip still isn't included in a default install (i guess). but still this isn't something that 5 minutes of googling won't solve.

yikes.

can you even install cygwin without coreutils? also personally i find msys much simpler and hassle-free. pacman makes things a lot easier.

nah, looks like they'll spoonfeed him enough that he'll avoid opening that door
at least we got him to be less of a cunt for now

probably easier to reuse some of that python code that people spent effort writing for you in one of the previous threads

>can you even install cygwin without coreutils?
not sure
all but p7zip would be available ootb in most any linux system, but i'm not sure what cygwin comes with, i just listed everything

blow your fucking brains out

>not arch

i got cygwin up and running, so how do i make sure it only checks my two external drives and nothing else with this script and where is the text file made?

what got you so butthurt, bby

>being this much of an ungrateful cunt and still expecting help
holy fuck people here are pathetic if they're still giving you a hand

POSIX compliant:
#!/bin/sh
find . -type f -name '*.cb[rz]' | while read i; do
temp="/tmp/${0##*/}.$$"
mkdir -p "$temp"
7z x -o"$temp" "$i" 1>/dev/null
if find "$temp" -type f -exec file {} + | grep -qsm 1 -e 'PNG'; then
echo "File $i contains a png file."
fi
rm -Rf "$temp"
done

>is it still possible to make it in powershell?
possible? sure, with external tools
but you're much more likely to find people who can write scripts that aren't specific to windows maintenance in bash than powershell

it works off the current directory, as specified as "." at the start of line 2
just 'cd' into the directory you want to start from
you can have it output to a text file with "./a.sh > output.txt", or if you want plain output, change "echo File \"$i\" contains a png file." to just "echo $i"

this is susceptible to false positives, if the filename or extension contains "PNG"
you're assuming filenames/extensions won't be uppercase

#!/bin/bash
find . -type f -iregex ".*\.cb[rz]" | while read i; do
haspng=0
regex=".* image\/png$"
temp="$(mktemp -d)"
7z x -o"$temp" "$i" 1>/dev/null
for p in $(find "$temp" -type f); do
if [[ "$(file --mime-type "$p")" =~ $regex ]]; then
haspng=1
fi
done
if [ $haspng = 1 ]; then
echo File \"$i\" contains a png file.
./a.sh > output.txt
fi
rm -rf "$temp"
done


would this create "output.txt" with the name of the zip if there is one png that doesn't have .png in the filename

-- false negatives, too, since it won't see inputs with uppercase characters in the extension (not relevant in windows scripts, but may be relevant in cygwin)

oof

you've just created a loop by telling the script to run itself with no way to break out of it
it'll hit a png, call itself, which will hit a png, call itself, etc, etc
no, you run the script with "./a.sh > output.txt", don't put that /in/ the script anywhere

-- also, the script lists files that contain any png's, correct extension or not, as per OP

#!/bin/sh
find . -type f -name '*.[cC][bB][rRzZ]' | while read i; do
temp="/tmp/${0##*/}.$$"
mkdir -p "$temp"
7z x -o"$temp" "$i" 1>/dev/null
if find "$temp" -type f -exec file {} + | grep -qsm 1 -e 'PNG'; then
echo "File $i contains a png file."
fi
rm -Rf "$temp"
done

Done and still POSIX compliant.