#!/usr/bin/perl # Joe Gillotti - 4/2/2012 # generate tags for video based on filename/title package genTags; use strict; use warnings; use File::Glob qw(bsd_glob); use File::Basename; my $name; my $title; my $tag; # tags that same word case insensitve my @tags = qw( anal maid tits creampie teen cute virgin stranger pussy hair police couger cocks blowjob college russian beach feet german nanny dildo french gangbang handjob couple outdoor rimjob blonde redhead brunette orgy threesome latina asian lesbian underwater amateur southern milf cumshot massage bikini club teacher ); # alias -> destination tag my $aliases = { facial => 'cumshot', cutie => 'cute', young => 'teen', pool => 'underwater', texas => 'southern', lesbians => 'lesbian', hispanic => 'latina', spanish => 'latina', papi => 'latina', brazilian => 'latina', chinese => 'asian', azn => 'asian', threeway => 'threesome', blond => 'blonde', blondie => 'blonde', oral => 'blowjob', virginity => 'virgin', teens => 'teen', # anal butt => 'anal', ass => 'anal', asshole => 'anal', # ew lol hairy => 'hair', # pussy equivalents vagina => 'pussy', cunt => 'pussy', twat => 'pussy', beaver => 'pussy', snatch => 'pussy', # tits boobs => 'tits', breasts => 'tits', busty => 'tits', }; # destination tag -> compiled regex to match my $regexen = { teen => qr/1[8|9] year old/i, brunette => qr/(black|brown)\-?haired/i, black => qr/black (chick|hottie|guy|girl|man|cock|penis)/i, blowjob => qr/(sucking|suck|oral|bj|swallow|blow|protein)/i, pussy => qr/(perfect|tight) pussy\??/i, milf => qr/(hot mom|milf)/i, tits => qr/(boob|breast|nipple)s?/i, asleep => qr/(sleep|sleeping|asleep)/i, gangbang => qr/(gang|train)/i, russia => qr/(russia)n?/i, teacher => qr/(teacher|professor)/i, college => qr/school/i, police => qr/(officer|cop)/i }; sub genTag { $name = $_[0]; ($name = basename($_[0])) =~ s/_*\.mp4//; ($title = $name) =~ s/_/ /g; my @thisTags; for $tag (split '_', lc($name)) { if (in_array($tag, \@tags)) { push @thisTags, $tag; } if (defined $aliases->{$tag}) { push @thisTags, $aliases->{$tag} unless in_array($aliases->{$tag}, \@thisTags); } } for $tag (keys %{$regexen}) { if ($title =~ $regexen->{$tag}) { push @thisTags, $tag unless in_array($tag, \@thisTags); } } return { file => $_[0], title => $title, tags => \@thisTags }; } sub in_array { my ($string, $array) = @_; return grep $_ eq $string, @{$array}; } 1;