-
Notifications
You must be signed in to change notification settings - Fork 4
/
missing-in-xdcc.awk
executable file
·97 lines (95 loc) · 2.11 KB
/
missing-in-xdcc.awk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/usr/bin/awk -f
BEGIN {
# DEBUG = 1
IGNORECASE = 1
SAVED_FS = FS
FS = "|"
CONTROL = "alle2dk"
while ( ( res = getline < CONTROL ) > 0 ) {
NAME = tolower( $3 )
NAME_CACHE[ NAME ] = 1
if ( match( NAME, "[({[](crc[_-]*)*[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][]})]" ) ) {
CRC = substr( NAME, RSTART + 1, RLENGTH - 2 )
sub( "(crc[_-]*)", "", CRC )
CRC_CACHE[ CRC ] = NAME
}
}
close( CONTROL )
FS = SAVED_FS
}
function ausgabe() {
PACK ++
NAME = tolower( XD )
if ( NAME_CACHE[ NAME ] == 1 ) {
if ( DEBUG != "" )
printf( "%3s (identical name) %s\n", "#" PACK, XD )
return
}
CRC = ""
if ( match( NAME, "[({[](crc[_-]*)*[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][]})]" ) ) {
CRC = substr( NAME, RSTART + 1, RLENGTH - 2 )
sub( "(crc[_-]*)", "", CRC )
if ( CRC_CACHE[ CRC ] != "" ) {
if ( DEBUG != "" )
printf( "%3s (crc found) %s -> %s\n", "#" PACK, XD, CRC_CACHE[ CRC ] )
return
}
}
KEY = tolower( XD )
gsub( "german.sub", " ", KEY )
gsub( "ger.sub", " ", KEY )
gsub( "gersub", " ", KEY )
gsub( "episode", " ", KEY )
gsub( "ep", " ", KEY )
gsub( "german", " ", KEY )
gsub( "fansub", " ", KEY )
gsub( "divx5", " ", KEY )
gsub( "xvid", " ", KEY )
gsub( "v2", " v 2", KEY )
gsub( "arcthelad", "arc the lad", KEY )
gsub( "gasbastard", "gas bastard", KEY )
gsub( "[.]", " ", KEY )
gsub( "[[&+() _,`!\\]-]+", ".*", KEY )
gsub( "reminisence", "reminiscence", KEY )
gsub( "[*]0+", "*[0]*", KEY )
# gsub( "0", "[0]*", KEY )
for ( NAME in NAME_CACHE ) {
if ( NAME_CACHE[ NAME ] != 1 )
continue
if ( match( NAME, KEY ) ) {
if ( DEBUG != "" )
printf( "%3s (name found) %s -> %s\n", "#" PACK, XD, NAME )
return
}
}
if ( ( DEBUG != "" ) && ( CRC == "" ) )
print KEY
printf( "%3s %s\n", "#" PACK, XD )
}
END {
ausgabe()
}
/Do Not Edit This File/ {
# Do Not Edit This File: 50.08 50.43 15173264677 1638743
if ( LAST_KEY != "" ) {
ausgabe()
XF = ""
print ""
}
PACK = 0
next
}
/^$/ {
if ( XF == "" )
next
ausgabe()
}
/^xx_file/ {
XF = substr( $0, 9 )
next
}
/^xx_desc/ {
XD = substr( $0, 9 )
next
}
#