You are not logged in.

#1 2009-06-23 04:19:45

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

How to get BF3AA75E style CRC of a file?

$ cksum /media/ANIME/\[gg\]_Eden_of_the_East_-_11_\[BF3AA75E\].mkv
133567665 340402264 /media/ANIME/[gg]_Eden_of_the_East_-_11_[BF3AA75E].mkv

But I hear 'BF3AA75E' in the file name is the CRC sum, too.

So, how do I get this CRC instead of '133567665'?

PS: I've found this:
community/perl-string-crc32 1.4-3
    Perl/CPAN Module String::CRC32 : ZMODEMlike CRC32 generation
ZMODEM is six letters... maybe not what I'm looking for...I know only it is a module for perl to call, but just don't know how to do that...

EDIT:
I found this in man crc32 on the web. So what is the package in arch?
% crc::crc32 -format 0x%X "Hello, World!" 0xEC4AC3D0

Last edited by lolilolicon (2009-06-23 04:31:34)


This silver ladybug at line 28...

Offline

#2 2009-06-23 04:31:41

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,405
Website

Re: How to get BF3AA75E style CRC of a file?

I found this a couple of days ago:
http://agafix.org/anime-crc32-checksum-in-linux-v20/

Offline

#3 2009-06-23 04:35:28

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: How to get BF3AA75E style CRC of a file?

woo! That's amazing.


This silver ladybug at line 28...

Offline

#4 2009-06-23 04:46:58

Ranguvar
Member
Registered: 2008-08-12
Posts: 2,549

Re: How to get BF3AA75E style CRC of a file?

There is also 'cksfv' in [community] for a more standard CRC32 app smile

Offline

#5 2009-06-23 04:54:17

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: How to get BF3AA75E style CRC of a file?

hello again.

The result is supposed to be like
anime_check.png
While mine is like this:
vMXZjZA
Some mess in the formatting... I tried to add print("\n") in the script and it didn't work well.
Somebody who know python help please, thanks.


This silver ladybug at line 28...

Offline

#6 2009-06-23 04:56:13

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: How to get BF3AA75E style CRC of a file?

Ranguvar wrote:

There is also 'cksfv' in [community] for a more standard CRC32 app smile

Yes, thanks a lot.

But I really like the idea of that short script, can you help?


This silver ladybug at line 28...

Offline

#7 2009-06-23 05:22:35

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: How to get BF3AA75E style CRC of a file?

So I combined cksfv and the coloring idea of the script, here it goes:
vMXZjag

#!/bin/bash
### quick check CRC32 of anime videos with a filename in the format of "[gg]_Eden_of_the_East_-_11_[BF3AA75E].mkv"
### Simple output with two colors.
anime="$@"
for anime ; do
cksfv "$anime" |
sed '/^;/d;s/.*\[\([^\]*\)]*\]\.[^\.]* \(........\)$/\1-->\2/' |
awk -F'-->' '{if($1==$2) printf("\x1b[32;01m%s\x1b[00;00m YES\n",$0) ; \
                    else printf("\x1b[31;01m%s NO!\x1b[00;00m\n",$0)}'
done

Any suggestions to improve it?

Last edited by lolilolicon (2009-06-23 05:43:50)


This silver ladybug at line 28...

Offline

#8 2009-06-23 06:33:34

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: How to get BF3AA75E style CRC of a file?

Another version

#!/bin/bash
### quick check CRC32 of anime videos with a filename in the format of "[gg]_Eden_of_the_East_-_11_[BF3AA75E].mkv"
### Simple output with two colors.

yes_clr="\x1b[32;01m"
no_clr="\x1b[31;01m"
end_clr="\x1b[00;00m"

for anime ; do
TEMP=$( cksfv -b -q "$anime" | sed '/^;/d;s/.*\[\(........\)\]\.[^\.]* \(........\)$/\1-->\2/' )
echo "$TEMP" | grep -- "-->" &>/dev/null
if [ "$?" == 0 ]; then
    my_crc="${TEMP%-->*}"
    src_crc=${TEMP#*-->}
    anime=$( basename "$anime" )
    if [ "$my_crc" == "$src_crc" ] ; then
    printf "$anime ...$yes_clr YES $end_clr\n"
    else
    printf "$anime ...$no_clr NO! \n\t$TEMP $end_clr\n"
    fi
else :
fi
done

vMXZkNA

Last edited by lolilolicon (2009-06-23 07:58:52)


This silver ladybug at line 28...

Offline

Board footer

Powered by FluxBB