#!/usr/bin/perl
#
# listupdate.pl v0.0.2 - Update list for Music database
# Copyright (C) 2005 Stian Skjæveland
#
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
#

use strict;

# You must set the three following variables yourself in order to make this work

my $listfile="/home/stian/www/stian.atlantiscrew.net/doc/list.txt";
my $texteditor="nano";
my $uploadcmd="scp /home/stian/www/stian.atlantiscrew.net/doc/list.txt stunix\@atlantiscrew.net:~/domains/atlantiscrew.net/public_html/stian/doc/";
my ($filelength, @filelines);

print "$0: Entering stage 1... Modify items-list\n";
sleep 1;
system("$texteditor $listfile");

print "$0: Entering stage 2... Show how many items that currently exists\n";
sleep 1;
open (LISTFILE, "<$listfile");
@filelines=<LISTFILE>;
$filelength=@filelines;
close(LISTFILES);
print "$0: $listfile now has $filelength items\n";

print "$0: Entering stage 3... Upload list.txt to webserver\n";
sleep 1;
system("$uploadcmd");

print "$0: All done.\n";
