Viewing pornographic materials on a computer, whether previously downloaded or directly from a website

Source Code

Document and list the code used to upload posts.

Thanks to John Bokma for providing example code.

Perl Modules needed:

  • Carp
  • Config::Simple
  • Getopt::Long
  • Tie::File
  • Time::Local
  • XMLRPC::Lite
  • WordPress

#!/usr/bin/perl

use strict;
use warnings;

use Config::Simple;
use Getopt::Long;
use POSIX qw(strftime);
use Time::Local;
use Tie::File;
use WordPress;

my $dayOffset = 0;

# Location of config file
my $configFile = "$ENV{'HOME'}/.pornloading/pornloading.conf";

GetOptions("c|config=s"=>$configFile, "do|dayoffset=i"=> $dayOffset); 

# Read config file
my %cfg = ();
Config::Simple->import_from( $configFile, %cfg );

my $dayOfWeek = strftime( "%w", localtime( time() - $dayOffset * (24 * 60 * 60) ) );
print "$dayOfWeekn";
my $dayOfYear = strftime( "%j", localtime( time() - $dayOffset * (24 * 60 * 60) ) );
print "$dayOfYearn";

print "$cfg{'blog.url'}n";
my $wp = WordPress->new($cfg{'blog.url'}, $cfg{'blog.user'}, $cfg{'blog.password'});

for (my $i = 1; $i <= $cfg{'sites.count'}; $i++) {
    my $key = "sites.s" . $i;

    if (&shouldPost($dayOfWeek, $cfg{$cfg{$key}.'.dayOfWeek'}, $dayOfYear, $cfg{$cfg{$key}.'.evenOddDay'})) {
        print "$keyt$cfg{$key}t";
        print "$cfg{$cfg{$key}.'.dayOfWeek'}t";
        print "n";

        &processSite($wp,
                 $cfg{$cfg{$key}.'.defaultCategory'},
                 $cfg{$cfg{$key}.'.dataFile'},
                 $cfg{$cfg{$key}.'.fromLink'});

        print "n";
    }
}

exit;

sub processSite {
    my ($wp, $site, $dataFile, $fromLink) = @_;
    my @lines;
    my @categories = ("Porn", $site);

    if (-e $dataFile) {
        # print "$dataFilet$fromLinkn";
        tie @lines, 'Tie::File', $dataFile or die "Can't read file: $dataFilen";
        # my @data = split(/t/, $lines[0]);
        my $line = shift @lines;
        $line =~ s/"?t"?/t/g;
        print $line . "n";
        my @data = split(/t/, $line);

        my $title = $data[0];

        my $desc = "
$data[1] “; if ($data[7]) { $desc .= ” Also have a bonus gallery: $data[6] / $data[7] “; } $desc .= ” $fromLink
n”; if ($data[4]) { push(@categories, $data[4]); } print join(”t”, @categories) . “n”; $wp->post($title, $desc, @categories); sleep 2; } else { print “Data File, ‘$dataFile’, does not exist.n”; } } sub shouldPost { my ($dayOfWeek, $cfgDayOfWeek, $dayOfYear, $cfgEvenOddDay) = @_; my $weekDay = 1; my $evenOddDay = 1; if (defined($cfgDayOfWeek)) { if (($dayOfWeek == $cfgDayOfWeek) || ($cfgDayOfWeek == 7) ) { $weekDay = 1; } else { $weekDay = 0; } } if (defined($cfgEvenOddDay)) { if (( ($dayOfYear % 2) == $cfgEvenOddDay) || ($cfgEvenOddDay == 2) ) { $evenOddDay = 1; } else { $evenOddDay = 0; } } return ($weekDay && $evenOddDay); }

No Comments

No comments yet.

Leave a comment

You must be logged in to post a comment.