# global variables

# variables that need to be declacred 1st
# for use with home directory and os dependant variables

our $version 		= "4.0 RC8";
our $author 		= "Jacob Jarick";

our $load_defaults 	= 0;
our $config_version  	= "";

our $dir = $ARGV[0];
our $home = "";
our $fs_fix_default = 0;

our $overwrite	= 0;

# Detect enviroment and setup namefix directories

our $nf_dir = $main::prog_dir."/";

if(!$dir) {
        $dir = cwd;
}

if($^O eq "MSWin32") {
        $home = $ENV{"USERPROFILE"};
        $fs_fix_default = 1;
        our $dialog_font	= "ansi 8 bold";
        our $dialog_title_font	= "ansi 12 bold";
        our $edit_pat_font	= "ansi 16 bold";
        our $dir_slash		= "\\";
}
else {
        $fs_fix_default = 0;
        $home = $ENV{"HOME"},
        our $dialog_font	= "ansi 16";
        our $dialog_title_font	= "ansi 18 bold";
        our $edit_pat_font	= "ansi 20 bold";
        our $dir_slash		= "\/";
}

if(!$home) {
        $home = $ENV{"TMP"};    # surely the os has a tmp if nothing else
}

if(!-d "$home/.namefix.pl") {
        mkdir("$home/.namefix.pl", 0755) || die "Cannot mkdir :$home/.namefix.pl $!\n";
}

# File locations

our $config_file	= "$home/.namefix.pl/config.ini";
our $fonts_file		= "$home/.namefix.pl/fonts.ini";
our $bm_pl		= "$home/.namefix.pl/bm.ini";

our $casing_file    	= "$home/.namefix.pl/list_special_word_casing.txt";
our $killwords_file 	= "$home/.namefix.pl/list_rm_words.txt";
our $killpat_file   	= "$home/.namefix.pl/list_rm_patterns.txt";
our $bookmark_file	= "$home/.namefix.pl/list_bookmarks.txt";

our $namefix_log_file	= "$home/.namefix.pl/namefix.pl"."$version"."log";
our $namefix_error_file	= "$home/.namefix.pl/namefix.pl"."$version"."error.log";

our $mempic 		= $nf_dir."mem.jpg";

# system internal vars

our $cwd		= $dir;
our $hlist_cwd		= $cwd;
our $hlist_file		= "";
our $testmode 		= 1;
our $change 		= 0;
our $id3_change		= 0;	# counter for changes made 2 id3 tags
our $tags_rm		= 0;	# counter for number of tags removed
our $id3_writeme	= 0;	# used for missing id3v1/id3v2 that can be filled in from each other
our $suggestF 		= 0;	# suggest using fsfix var
our $tmpfilefound 	= 0;
our $tmpfilelist 	= "";
our $enum_count 	= 0;
our $rpwold_escaped	= "";
our $last_recr_dir 	= "";
our $hl_counter		= 0;
our @bm_arr 		= "";	# bookmark array
our $bm_menu_hash	= "";
our $bm_count		= 0;
our $hlist_selection	= 0;	# current line selected


# internal flags
# note: its been my decision that all internal flags will be in UC
# should make the app more c like (I hope), and if not its still tidier.

our $LISTING		= 0;
our $FIRST_DIR_LISTED	= 0;

# preference options - save enabled

our $cleanup		= 1;
our $case 		= 1;
our $advance		= 0;
our $space_character 	= " ";
our $max_fn_length 	= 256;
our $truncate_to    	= $max_fn_length;

our $id3_guess_tag	= 0;
our $id3_force_guess_tag	= 0;
our $id3_mode		= 0;

our $window_g		= "";

our $fat32fix 		= $fs_fix_default;
our $disable_regexp 	= 1;
our $file_ext_2_proc 	= "jpeg|jpg|mp3|mpc|mpg|mpeg|avi|asf|wmf|wmv|ogg|ogm|rm|rmvb|mkv";

our $enum_opt		= 1;
our $enum_pad		= 1;
our $enum_pad_zeros 	= "4";
$enum_pad_zeros		= 4;

our $truncate_style 	= 0;
our $trunc_char		= "";


# main window options - save enabled

our $sp_word		= 0;
our $spaces		= 1;
our $dot2space		= 0;
our $intr_char 		= 0;
our $kill_cwords 	= 0;
our $kill_sp_patterns 	= 0;
our $sp_char		= 0;

# main window, misc options - no save allowed

our $scene 		= 0;
our $unscene		= 0;

our $rm_digits		= 0;
our $digits     	= 0;

our $pad_dash 		= 0;
our $pad_digits 	= 0;
our $pad_digits_w_zero	= 0;

# main window options - no save allowed

our $enum		= 0;	# enumerate mode
our $truncate		= 0;
our $uc_all		= 0;
our $lc_all		= 0;

our $replace		= 0;
our $rpwold		= "";
our $rpwnew		= "";

our $front_a 		= 0;
our $faw		= "";
our $end_a 		= 0;
our $eaw		= "";

our $recr		= 0;
our $proc_dirs  	= 0;
our $ig_type 		= 0;

# main window, id3 tag vars

our $id3_art_set	= 0;
our $id3_art_str	= "";

our $id3_alb_set	= 0;
our $id3_alb_str	= "";

our $id3_com_set	= 0;
our $id3_com_str	= "";

our $id3v1_rm		= 0;
our $id3v2_rm		= 0;

$main::id3_gen_set 	= 0;
$main::id3_gen_str 	= "Metal";

$main::id3_year_set 	= 0;
$main::id3_year_str 	= "";

$main::split_dddd	= 0;

# all prefined arrays.

# Kill Common Words array, for safety reasons all are case specific.
@main::kill_words_arr = 
(
        # net sites
        'ShareReactor',
        'ShareConnector',
        'Sharevirus',
        'English.[www.tvu.org.ru]',
        '[yem]',

        # misc
        'english',
        'ac3',
        'WS',		# wide screen
        'hdtv',
        'tv',
        'divx',
        'xvid',
        'HDRip',
        'dsrip',
        'DVDrip',
        'DVDscr',
	'DVD',

        # mp3/divx/xvid Ripper tags
        'Crimson',
        'DMT',
        'DiAMOND',
        'Saphire',
        'FoV',
        'LoL',
        'LoKi',
        'l0ki',
        'pdtv',
        'rns',
        'VFUA',
        'VTV',
        'dsr',
        'tcm',
        'fqm',
        'notv',
        'kyr',
        'aaf',
        'xor',
        'ctu',
        'repack',
        'orenji',
        'sdtv',
        'tvd',
        '2sd'

);

# Big Word Casing List

# Douglas: Thanks to the great folk at karanet for the help with the following list!
# ( ssh bbs@karanet.uni-klu.ac.at )

@main::word_casing_arr = 
(
        'ABBA', 'ABC', ' AC', 'ACDC', 'ATC',
        'BSB',
        'CIA', 'CNN',
        'CD', 'CD1', 'CD2', 'CD3', 'CD4',
        'DNA', 'DC', 'DJ', 'DVD', 'DVDRip', 'DivX', 'DVDA',
        'FBI', 'FM',
        'II', 'III', 'IV',
        'KGB',
        'LSD',
        'MASH', 'MTV', 'MIB',
        'NIN',
        'OK', 'OST', 'OVA',
        'USSR', 'USA',
        'REM',
        'STS', 'SNK', 'SG-1',
        'TV', 'THC', 'TimTim', 'TNT',
        'UK',
        'vs', 'VI', 'VII',
        'YMCA',
        'XXX', 'Xvid', 'IX', 'XI', 'XII', 'XV', 'XVI', 'XVII',
        'a', 'an', 'at', 'and', 'are', 'for', 'in', 'is', 'it', 'of', 'on', 'the', 'to',
        '- A', '- At', '- An', '- And', 'Are', '- For', '- In', '- Is', '- It', '- Of', '- On', '- The', '- To'
);

@main::kill_patterns_arr = 
(
        '(\(|\[)(divx|dvdrip|dvd|tv|xvid)(\]|\))',
	'(\(|\[)www\..*?\.(com|net|de|tk|ru|nl)(\]|\))',
	'(\[|\()(\]|\))',
	'(\[[a-f0-9]*\])'
);

@main::genres = sort
(
	"Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk",
	"Grunge", "Hip-Hop", "Jazz", "Metal", "New Age", "Oldies", "Other",
	"Pop", "R&B", "Rap", "Reggae", "Rock", "Techno", "Industrial",
	"Alternative", "Ska", "Death Metal", "Pranks", "Soundtrack",
	"Euro-Techno", "Ambient", "Trip-Hop", "Vocal", "Jazz+Funk", "Fusion",
	"Trance", "Classical", "Instrumental", "Acid", "House", "Game",
	"Sound Clip", "Gospel", "Noise", "Alt. Rock", "Bass", "Soul",
	"Punk", "Space", "Meditative", "Instrum. Pop", "Instrum. Rock",
	"Ethnic", "Gothic", "Darkwave", "Techno-Indust.", "Electronic",
	"Pop-Folk", "Eurodance", "Dream", "Southern Rock", "Comedy",
	"Cult", "Gangsta", "Top 40", "Christian Rap", "Pop/Funk", "Jungle",
	"Native American", "Cabaret", "New Wave", "Psychadelic", "Rave",
	"Showtunes", "Trailer", "Lo-Fi", "Tribal", "Acid Punk", "Acid Jazz",
	"Polka", "Retro", "Musical", "Rock & Roll", "Hard Rock", "Folk",
	"Folk/Rock", "National Folk", "Swing", "Fusion", "Bebob", "Latin",
	"Revival", "Celtic", "Bluegrass", "Avantgarde", "Gothic Rock",
	"Progress. Rock", "Psychadel. Rock", "Symphonic Rock", "Slow Rock",
	"Big Band", "Chorus", "Easy Listening", "Acoustic", "Humour",
	"Speech", "Chanson", "Opera", "Chamber Music", "Sonata", "Symphony",
	"Booty Bass", "Primus", "Porn Groove", "Satire", "Slow Jam",
	"Club", "Tango", "Samba", "Folklore", "Ballad", "Power Ballad",
	"Rhythmic Soul", "Freestyle", "Duet", "Punk Rock", "Drum Solo",
	"A Capella", "Euro-House", "Dance Hall", "Goa", "Drum & Bass",
	"Club-House", "Hardcore", "Terror", "Indie", "BritPop", "Negerpunk",
	"Polsk Punk", "Beat", "Christian Gangsta Rap", "Heavy Metal",
	"Black Metal", "Crossover", "Contemporary Christian", "Christian Rock",
	"Merengue", "Salsa", "Thrash Metal", "Anime", "Jpop", "Synthpop"
);



1;

syntax highlighted by Code2HTML, v. 0.9.1