A hint: This file contains one or more very long lines, so maybe it is better readable using the pure text view mode that shows the contents as wrapped lines within the browser window.
1 #!/usr/bin/perl -w 2 3 use strict; 4 #no strict; 5 #use warnings; 6 no warnings; 7 8 use English; 9 use Cwd; 10 use MP3::Tag; 11 use File::Find; 12 use File::Basename qw(&basename &dirname); 13 14 use Tk; 15 use Tk::JPEG; 16 use Tk::DirTree; 17 use Tk::Balloon; 18 use Tk::NoteBook; 19 use Tk::HList; 20 use Tk::Radiobutton; 21 use Tk::Spinbox; 22 use Tk::Text; 23 use Tk::ROText; 24 use Tk::DynaTabFrame; 25 use Tk::Menu; 26 use Tk::JComboBox; 27 28 # $0 = location of scipt either full or relative, usefull to determine scripts location 29 our $prog_dir = $0; 30 if(-l $prog_dir) # if its a link find real file 31 { 32 $prog_dir = readlink($prog_dir); 33 } 34 if($prog_dir eq "namefix.pl") 35 { 36 $prog_dir = "./"; 37 } 38 $prog_dir =~ s/\\/\//g; 39 # remove script name from $dir and then we "should" have a nice path to our scripts 40 $prog_dir =~ s/^(.*)\/(.*?)$/$1/; 41 42 # mems libs 43 require "$prog_dir/libs/fixname.pm"; 44 require "$prog_dir/libs/run_namefix.pm"; 45 require "$prog_dir/libs/misc.pm"; 46 require "$prog_dir/libs/config.pm"; 47 require "$prog_dir/libs/global_variables.pm"; 48 require "$prog_dir/libs/nf_print.pm"; 49 50 51 require "$prog_dir/libs/dir.pm"; 52 require "$prog_dir/libs/mp3.pm"; 53 require "$prog_dir/libs/filter.pm"; 54 require "$prog_dir/libs/undo.pm"; 55 require "$prog_dir/libs/html.pm"; 56 57 # gui requires 58 require "$prog_dir/libs/gui/dir_hlist.pm"; 59 require "$prog_dir/libs/gui/about.pm"; 60 require "$prog_dir/libs/gui/config_dialog.pm"; 61 require "$prog_dir/libs/gui/help.pm"; 62 require "$prog_dir/libs/gui/blockrename.pm"; 63 require "$prog_dir/libs/gui/bookmarks.pm"; 64 require "$prog_dir/libs/gui/changelog.pm"; 65 require "$prog_dir/libs/gui/dialog.pm"; 66 require "$prog_dir/libs/gui/edit_lists.pm"; 67 require "$prog_dir/libs/gui/links.pm"; 68 require "$prog_dir/libs/gui/manual.pm"; 69 require "$prog_dir/libs/gui/menu.pm"; 70 require "$prog_dir/libs/gui/thanks.pm"; 71 require "$prog_dir/libs/gui/todo.pm"; 72 require "$prog_dir/libs/gui/br_preview.pm"; 73 require "$prog_dir/libs/gui/undo.pm"; 74 75 # ---------------------------------------------------------------------------- 76 # Vars 77 # ---------------------------------------------------------------------------- 78 79 my $row = 1; 80 my $col = 1; 81 82 #-------------------------------------------------------------------------------------------------------------- 83 # load config file if it exists 84 #-------------------------------------------------------------------------------------------------------------- 85 86 87 if(-f $main::config_file) 88 { 89 do $main::config_file; # executes config file 90 } 91 92 if(-f $main::fonts_file) 93 { 94 do $main::fonts_file; # if font file exists 95 } 96 97 &save_fonts; 98 99 if($main::ZERO_LOG) 100 { 101 &clog; 102 } 103 104 &plog(1, "**** namefix.pl $main::version start *************************************************"); 105 &plog(4, "main: \$prog_dir = \"$prog_dir\""); 106 107 #-------------------------------------------------------------------------------------------------------------- 108 # Begin Gui 109 #-------------------------------------------------------------------------------------------------------------- 110 111 our $mw = new MainWindow; # Main Window 112 $mw -> title("namefix.pl $main::version by $main::author"); 113 114 our $folderimage = $mw->Getimage("folder"); 115 our $fileimage = $mw->Getimage("file"); 116 117 our $balloon = $mw->Balloon(); 118 119 our $frm_bottom = $mw -> Frame() 120 -> pack 121 ( 122 -side => 'bottom', 123 -fill => 'x', 124 -anchor => 'w' 125 ); 126 127 #-------------------------------------------------------------------------------------------------------------- 128 # Create dynamic tabbed frames for main gui 129 #-------------------------------------------------------------------------------------------------------------- 130 131 my $dtfw = 200; 132 my $dtfh = 460; 133 134 my $frame4dtf = $mw->Frame(-width=>$dtfw, -height=>$dtfh) 135 -> pack(-side => 'left', -fill => 'both', -anchor => 'nw', -fill=>'both'); 136 137 our $dtf = $frame4dtf->DynaTabFrame ( 138 -font => 'Arial 8', 139 -raisecolor => 'white', 140 -tabcolor => 'grey', 141 -tabcurve => 2, 142 # -tablock => undef, 143 -tabpadx => 3, 144 -tabpady => 3, 145 -tabrotate => 1, 146 -tabside => 'wn', 147 -tabscroll => undef, 148 -textalign => 1, 149 -tiptime => 600, 150 -tipcolor => 'yellow', 151 ); 152 153 $dtf -> place 154 ( 155 -in=>$frame4dtf, 156 -relx =>0, 157 -rely =>0, 158 -width=>$dtfw, 159 -height=>$dtfh 160 ); 161 162 our $tab7 = $dtf->add 163 ( 164 -caption => "TRUN", 165 -label => "TRUN",, 166 -raisecolor=>'yellow',, 167 -tabcolor=>'orange', 168 -width=> 300 169 ); 170 171 our $tab6 = $dtf->add 172 ( 173 -caption => "ENUM", 174 -label => "ENUM", 175 -raisecolor=>'yellow',, 176 -tabcolor=>'orange', 177 ); 178 179 our $tab5 = $dtf->add 180 ( 181 -caption => "MISC", 182 -label => "MISC", 183 -raisecolor=>'yellow',, 184 -tabcolor=>'orange', 185 ); 186 187 our $tab2 = $dtf->add 188 ( 189 -caption => "MP3", 190 -label => "MP3", 191 -raisecolor=>'yellow',, 192 -tabcolor=>'orange', 193 ); 194 195 our $tab1 = $dtf->add 196 ( 197 -caption => "MAIN", 198 -label => "MAIN", 199 -raisecolor=>'yellow', 200 -tabcolor=>'orange', 201 ); 202 203 our $frm_left = $tab1 -> Frame() 204 -> pack 205 ( 206 -fill => 'both', 207 -expand => 1 208 ); 209 210 our $frm_right2 = $mw -> Frame() 211 -> pack 212 ( 213 -side => 'right', 214 -expand => 1, 215 -fill => 'both' 216 ); 217 218 #-------------------------------------------------------------------------------------------------------------- 219 # frame bottom 220 #-------------------------------------------------------------------------------------------------------------- 221 222 $col = 1; 223 224 my $open_but = $frm_bottom -> Button 225 ( 226 -text=>"Browse", 227 -activebackground => "cyan", 228 -command =>\&dir_dialog 229 ) 230 -> grid 231 ( 232 -row=>1, 233 -column=>$col++, 234 -sticky=>"nw", 235 -padx =>2 236 ); 237 238 my $cwd_ent = $frm_bottom->Entry 239 ( 240 -textvariable=>\$main::dir, 241 ) 242 -> grid 243 ( 244 -row=>1, 245 -column=>$col++, 246 -sticky=>"nw", 247 -padx =>2 248 ); 249 $balloon->attach 250 ( 251 $cwd_ent, 252 -msg => \$main::dir 253 ); 254 255 $frm_bottom -> Label() 256 -> grid 257 ( 258 -row=>1, 259 -column=>$col++, 260 -sticky=>"nw" 261 ); 262 263 my $recr_chk = $frm_bottom -> Checkbutton 264 ( 265 -text=>"Recursive", 266 -variable=>\$main::recr, 267 -activeforeground => "blue" 268 ) 269 -> grid 270 ( 271 -row=>1, 272 -column=>$col++, 273 -sticky=>"nw" 274 ); 275 276 my $D_chk = $frm_bottom -> Checkbutton 277 ( 278 -text=>"Process Dirs", 279 -variable=>\$main::proc_dirs, 280 -activeforeground => "blue" 281 ) 282 -> grid 283 ( 284 -row=>1, 285 -column=>$col++, 286 -sticky=>"nw" 287 ); 288 $balloon->attach 289 ( 290 $D_chk, 291 -msg => "Process and rename directorys as well.\n\nNote: Use with CAUTION" 292 ); 293 294 $frm_bottom -> Label() 295 -> grid 296 ( 297 -row=>1, 298 -column=>$col++, 299 -sticky=>"nw" 300 ); 301 302 my $I_chk = $frm_bottom -> Checkbutton 303 ( 304 -text=>"Process ALL Files", 305 -variable=>\$main::ig_type, 306 -activeforeground => "blue" 307 ) 308 -> grid 309 ( 310 -row=>1, 311 -column=>$col++, 312 -sticky=>"nw" 313 ); 314 $balloon->attach 315 ( 316 $I_chk, 317 -msg => "Process and rename all files, not just media files." 318 ); 319 320 $frm_bottom -> Label 321 ( 322 -text=>" " 323 ) 324 -> grid 325 ( 326 -row=>1, 327 -column=>$col++, 328 -sticky=>"nwe" 329 ); 330 331 my $tm_chk = $frm_bottom -> Checkbutton 332 ( 333 -text=>"Preview", 334 -variable=>\$main::testmode, 335 -activeforeground => "blue" 336 ) 337 -> grid 338 ( 339 -row=>1, 340 -column=>$col++, 341 -sticky=>"nw" 342 ); 343 $balloon->attach 344 ( 345 $tm_chk, 346 -msg => "Preview changes that will be made.\n\nNote: This option always re-enables after a run for safety." 347 ); 348 349 $frm_bottom -> Label 350 ( 351 -text=>" " 352 ) 353 -> grid 354 ( 355 -row=>1, 356 -column=>$col++, 357 -sticky=>"nwse" 358 ); 359 360 $frm_bottom -> Button 361 ( 362 -text=>"STOP!", 363 -activebackground => "red", 364 -command => sub 365 { 366 if($main::STOP) # stub 367 { 368 &plog(1, "namefix.pl: STOP flag allready enabled, turning off LISTING flag as well"); 369 $main::LISTING = 0; 370 } 371 $main::STOP = 1; 372 &plog(0, "namefix.pl: Stop button pressed"); 373 } 374 ) 375 -> grid 376 ( 377 -row=>1, 378 -column=>$col++, 379 -sticky=>"ne" 380 ); 381 382 $frm_bottom -> Label 383 ( 384 -text=>" " 385 ) 386 -> grid 387 ( 388 -row=>1, 389 -column=>$col++, 390 -sticky=>"nwse" 391 ); 392 393 my $ls_but = $frm_bottom -> Button 394 ( 395 -text=>"LIST", 396 -activebackground => "orange", 397 -command =>\&ls_dir 398 ) 399 -> grid 400 ( 401 -row=>1, 402 -column=>$col++, 403 -sticky=>"ne" 404 ); 405 406 $balloon->attach 407 ( 408 $ls_but, 409 -msg => "List Directory Contents." 410 ); 411 412 $frm_bottom -> Label 413 ( 414 -text=>" " 415 ) 416 -> grid 417 ( 418 -row=>1, 419 -column=>$col++, 420 -sticky=>"ne" 421 ); 422 423 $frm_bottom -> Button 424 ( 425 -text=>"RUN", 426 -activebackground => "green", 427 -command =>\&run_namefix 428 ) 429 -> grid 430 ( 431 -row=>1, 432 -column=>$col++, 433 -sticky=>"ne" 434 ); 435 436 $frm_bottom -> Label 437 ( 438 -text=>" " 439 ) 440 -> grid 441 ( 442 -row=>1, 443 -column=>$col++, 444 -sticky=>"ne" 445 ); 446 447 #-------------------------------------------------------------------------------------------------------------- 448 # main options / tab1 / frame left 449 #-------------------------------------------------------------------------------------------------------------- 450 451 $frm_left -> Label 452 ( 453 -text=>"Main Options:\n", 454 -font => 'Arial 10 bold', 455 ) 456 -> grid 457 ( 458 -row=>1, 459 -column=>1, 460 -columnspan=>1, 461 -sticky=>"nw" 462 ); 463 464 my $clean_chk = $frm_left -> Checkbutton 465 ( 466 -text=>"General Cleanup", 467 -variable=>\$main::cleanup, 468 -activeforeground => "blue", 469 -command=> sub { 470 if($main::cleanup == 0) 471 { 472 $main::advance = 1; 473 } 474 else 475 { 476 $main::advance = 0; 477 } 478 } 479 ) 480 -> grid 481 ( 482 -row=>2, 483 -column=>1, 484 -sticky=>"nw" 485 ); 486 $balloon->attach 487 ( 488 $clean_chk, 489 -msg => "Preform general cleanups on filename.\n\nNote: Leave on unless doing very specific renaming." 490 ); 491 492 my $case_chk = $frm_left -> Checkbutton 493 ( 494 -text=>"Normal Casing", 495 -variable=>\$main::case, 496 -activeforeground => "blue" 497 ) 498 -> grid 499 ( 500 -row=>3, 501 -column=>1, 502 -sticky=>"nw", 503 -columnspan=>2 504 ); 505 $balloon->attach 506 ( 507 $case_chk, 508 -msg=>"Uppercase the 1st letter of every word and lowercase the rest" 509 ); 510 511 my $w_chk = $frm_left -> Checkbutton 512 ( 513 -text=>"Specific Casing", 514 -variable=>\$main::sp_word, 515 -activeforeground => "blue" 516 ) 517 -> grid 518 ( 519 -row=>4, 520 -column=>1, 521 -sticky=>"nw" 522 ); 523 $balloon->attach 524 ( 525 $w_chk, 526 -msg => "Applys word specific casing from the \"Specific Casing List\"\n\neg: ABBA, ACDC CD1 CD2 XVII" 527 ); 528 529 my $p_chk = $frm_left -> Checkbutton 530 ( 531 -text=>"Spaces", 532 -variable=>\$main::spaces, 533 -activeforeground => "blue" 534 ) 535 -> grid 536 ( 537 -row=>5, 538 -column=>1, 539 -sticky=>"nw" 540 ); 541 $balloon->attach 542 ( 543 $p_chk, 544 -msg => "Swaps space and underscore with the set space delimiter\n\neg: Weezer_-_Hash_Pipe.mp3 to Weezer - Hash Pipe.mp3" 545 ); 546 547 my $o_chk = $frm_left -> Checkbutton 548 ( 549 -text=>". to Space", 550 -variable=>\$main::dot2space, 551 -activeforeground => "blue" 552 ) 553 -> grid 554 ( 555 -row=>6, 556 -column=>1, 557 -sticky=>"nw" 558 ); 559 $balloon->attach 560 ( 561 $o_chk, 562 -msg => "Swaps period with the set space delimiter\n\neg: Norther.-.Betrayed.mp3 to Norther - Betrayed.mp3" 563 ); 564 565 $frm_left -> Label 566 ( 567 -text=>" " 568 ) 569 -> grid 570 ( 571 -row=>8, 572 -column=>1, 573 -sticky=>"ne" 574 ); 575 576 my $K_chk = $frm_left -> Checkbutton 577 ( 578 -text=>"RM Word List", 579 -variable=>\$main::kill_cwords, 580 -activeforeground => "blue" 581 ) 582 -> grid 583 ( 584 -row=>10, 585 -column=>1, 586 -sticky=>"nw" 587 ); 588 $balloon->attach 589 ( 590 $K_chk, 591 -msg => "Remove list of words specified in the \"Remove Word List\"" 592 ); 593 594 my $P_chk = $frm_left -> Checkbutton 595 ( 596 -text=>"RM Pattern List", 597 -variable=>\$main::kill_sp_patterns, 598 -activeforeground => "blue" 599 ) 600 -> grid 601 ( 602 -row=>11, 603 -column=>1, 604 -sticky=>"nw" 605 ); 606 $balloon->attach 607 ( 608 $P_chk, 609 -msg => "Removes list of regexps specified in \"Remove Pattern List\".\n\nNote: Mainly used to match urls" 610 ); 611 612 $frm_left -> Label 613 ( 614 -text=>" " 615 ) 616 -> grid 617 ( 618 -row=>12, 619 -column=>1, 620 -sticky=>"ne" 621 ); 622 623 my $R_chk = $frm_left -> Checkbutton 624 ( 625 -text=>"Remove:", 626 -variable=>\$main::replace, 627 -activeforeground => "blue" 628 ) 629 -> grid 630 ( 631 -row=>16, 632 -column=>1, 633 -sticky=>"nw" 634 ); 635 $balloon->attach 636 ( 637 $R_chk, 638 -msg => 639 "Remove user entered words\n\nNote 1:\tTo remove multiple words, seperate with |\n\nExample:\tone|two|three\n\nNote 2:\tTo remove | simply escape it like so \\|\nNote 3:\tPerl regexps are available\n\tEnable under File, Preferences, Advance, Enable regexps." 640 ); 641 642 my $R_ent1 = $frm_left -> Entry 643 ( 644 -textvariable=>\$main::rpwold 645 ) 646 -> grid 647 ( 648 -row=>17, 649 -column=>1, 650 -sticky=>"nw" 651 ); 652 $balloon->attach 653 ( 654 $R_ent1, 655 -msg => "Enter word/s to remove" 656 ); 657 658 $frm_left -> Label 659 ( 660 -text=>"Replace With:" 661 ) 662 -> grid 663 ( 664 -row=>18, 665 -column=>1, 666 -sticky=>"nw" 667 ); 668 my $R_ent2 = $frm_left -> Entry 669 ( 670 -textvariable=>\$main::rpwnew 671 ) 672 -> grid( 673 -row=>19, 674 -column=>1, 675 -sticky=>"nw" 676 ); 677 $balloon->attach 678 ( 679 $R_ent2, 680 -msg => "Leave blank if your only removing words" 681 ); 682 683 my $f_chk = $frm_left -> Checkbutton 684 ( 685 -text=>"Front Append:", 686 -variable=>\$main::front_a, 687 -activeforeground => "blue" 688 ) 689 -> grid 690 ( 691 -row=>20, 692 -column=>1, 693 -sticky=>"nw" 694 ); 695 $balloon->attach 696 ( 697 $f_chk, 698 -msg => "Append string (of characters) to front of filename" 699 ); 700 701 my $f_ent = $frm_left -> Entry 702 ( 703 -textvariable=>\$main::faw 704 ) 705 -> grid 706 ( 707 -row=>21, 708 -column=>1, 709 -sticky=>"nw" 710 ); 711 712 my $e_chk = $frm_left -> Checkbutton 713 ( 714 -text=>"End Append:", 715 -variable=>\$main::end_a, 716 -activeforeground => "blue" 717 ) 718 -> grid 719 ( 720 -row=>22, 721 -column=>1, 722 -sticky=>"nw" 723 ); 724 $balloon->attach 725 ( 726 $e_chk, 727 -msg => "Append string to end of filename but before the file extension" 728 ); 729 my $e_ent = $frm_left -> Entry 730 ( 731 -textvariable=>\$main::eaw 732 ) 733 -> grid 734 ( 735 -row=>23, 736 -column=>1, 737 -sticky=>"nw" 738 ); 739 740 my $clr_but = $frm_left -> Button 741 ( 742 -text=>"Clear", 743 -activebackground => "cyan", 744 -command =>\&clr_no_save 745 ) 746 -> grid 747 ( 748 -row=>24, 749 -column=>1, 750 -sticky=>"sw" 751 ); 752 $balloon->attach 753 ( 754 $clr_but, 755 -msg => "Reset All options." 756 ); 757 758 #-------------------------------------------------------------------------------------------------------------- 759 # id3v1 tab options 760 #-------------------------------------------------------------------------------------------------------------- 761 762 $row = 1; 763 764 $tab2->Label 765 ( 766 -text=>"MP3 Options:\n", 767 -font => 'Arial 10 bold', 768 ) 769 -> grid 770 ( 771 -row=>$row++, 772 -column=>1, 773 -sticky=>"nw" 774 ); 775 776 my $id3_mode_chk = $tab2 -> Checkbutton 777 ( 778 -text=>"Process Tags", 779 -variable=>\$main::id3_mode, 780 -command=>\&draw_list, 781 -activeforeground => "blue" 782 ) 783 -> grid 784 ( 785 -row=>$row++, 786 -column=>1, 787 -sticky=>"nw", 788 -columnspan=>2 789 ); 790 $balloon->attach 791 ( 792 $id3_mode_chk, 793 -msg => "Enable processing of id3v1 and id3v2 tags" 794 ); 795 796 $tab2->Label(-text=>" ") 797 -> grid 798 ( 799 -row=>$row++, 800 -column=>1 801 ); 802 803 my $id3_guess_tag_chk = $tab2 -> Checkbutton 804 ( 805 -text=>"Guess tags", 806 -variable=>\$main::id3_guess_tag, 807 -activeforeground => "blue" 808 ) 809 -> grid 810 ( 811 -row=>$row++, 812 -column=>1, 813 -sticky=>"nw", 814 -columnspan=>2 815 ); 816 $balloon->attach 817 ( 818 $id3_guess_tag_chk, 819 -msg => "Guess tag from filename\n\nNote: Only works when mp3s are named in 1 of the formats.\n\nTrack Number - Title\nTrack Number - Artist - Title\nArtist - Album - Track Number - Title\nArtist - Track Number - Title\nArtist - Title" 820 ); 821 822 my $id3_force_guess_tag_chk = $tab2 -> Checkbutton 823 ( 824 -text=>"Overwrite", 825 -variable=>\$main::id3_force_guess_tag, 826 -activeforeground => "blue" 827 ) 828 -> grid 829 ( 830 -row=>$row++, 831 -column=>1, 832 -sticky=>"nw", 833 -columnspan=>2 834 ); 835 $balloon->attach 836 ( 837 $id3_force_guess_tag_chk, 838 -msg => "Overwrite pre-existing tags when using above option." 839 ); 840 841 $tab2->Label(-text=>" ") 842 -> grid( 843 -row=>$row++, 844 -column=>1 845 ); 846 847 my $rm_id3v1 = $tab2 -> Checkbutton 848 ( 849 -text=>"RM id3v1 tags", 850 -variable=>\$main::id3v1_rm, 851 -activeforeground => "blue" 852 ) 853 -> grid 854 ( 855 -row=>$row++, 856 -column=>1, 857 -sticky=>"nw", 858 -columnspan=>2 859 ); 860 861 my $rm_id3v2 = $tab2 -> Checkbutton 862 ( 863 -text=>"RM id3v2 tags", 864 -variable=>\$main::id3v2_rm, 865 -activeforeground => "blue" 866 ) 867 -> grid 868 ( 869 -row=>$row++, 870 -column=>1, 871 -sticky=>"nw", 872 -columnspan=>2 873 ); 874 875 876 $tab2->Label(-text=>" ") 877 -> grid( 878 -row=>$row++, 879 -column=>1 880 ); 881 882 my $id3_art_chk = $tab2 -> Checkbutton 883 ( 884 -text=>"Set Artist as:", 885 -variable=>\$main::id3_art_set, 886 -activeforeground => "blue" 887 ) 888 -> grid 889 ( 890 -row=>$row++, 891 -column=>1, 892 -sticky=>"nw" 893 ); 894 $balloon->attach 895 ( 896 $id3_art_chk, 897 -msg => "Set all mp3 artist tags to user entered string." 898 ); 899 900 my $id3_art_ent = $tab2 -> Entry 901 ( 902 -textvariable=>\$main::id3_art_str 903 ) 904 -> grid 905 ( 906 -row=>$row++, 907 -column=>1, 908 -sticky=>"nw" 909 ); 910 911 my $id3_alb_chk = $tab2 -> Checkbutton 912 ( 913 -text=>"Set Album as:", 914 -variable=>\$main::id3_alb_set, 915 -activeforeground => "blue" 916 ) 917 -> grid 918 ( 919 -row=>$row++, 920 -column=>1, 921 -sticky=>"nw" 922 ); 923 $balloon->attach( 924 $id3_alb_chk, 925 -msg => "Set all mp3 album tags to user entered string." 926 ); 927 928 my $id3_alb_ent = $tab2 -> Entry( 929 -textvariable=>\$main::id3_alb_str 930 ) 931 -> grid( 932 -row=>$row++, 933 -column=>1, 934 -sticky=>"nw" 935 ); 936 937 938 my $id3_genre_chk = $tab2 -> Checkbutton 939 ( 940 -text=>"Set Genre as:", 941 -variable=>\$main::id3_gen_set, 942 -activeforeground => "blue" 943 ) 944 -> grid 945 ( 946 -row=>$row++, 947 -column=>1, 948 -sticky=>"nw" 949 ); 950 $balloon->attach 951 ( 952 $id3_genre_chk, 953 -msg => "Set all mp3 genre tags to user selection" 954 ); 955 956 my $genre_combo = $tab2 -> JComboBox 957 ( 958 -mode=>'readonly', 959 -relief=>'groove', 960 -background=>'white', 961 -textvariable =>\$main::id3_gen_str, 962 -choices=>\@main::genres, 963 -entrywidth=>16, 964 ) 965 -> grid 966 ( 967 -row=>$row++, 968 -column=>1, 969 -sticky=>"nw" 970 ); 971 972 973 my $id3_year_chk = $tab2 -> Checkbutton 974 ( 975 -text=>"Set Year as:", 976 -variable=>\$main::id3_year_set, 977 -activeforeground => "blue" 978 ) 979 -> grid 980 ( 981 -row=>$row++, 982 -column=>1, 983 -sticky=>"nw" 984 ); 985 $balloon->attach 986 ( 987 $id3_year_chk, 988 -msg => "Set all mp3 year tags to user entered year." 989 ); 990 991 my $id3_year_ent = $tab2 -> Entry 992 ( 993 -textvariable=>\$main::id3_year_str 994 ) 995 -> grid 996 ( 997 -row=>$row++, 998 -column=>1, 999 -sticky=>"nw" 1000 ); 1001 1002 my $id3_com_chk = $tab2 -> Checkbutton 1003 ( 1004 -text=>"Set Comment as:", 1005 -variable=>\$main::id3_com_set, 1006 -activeforeground => "blue" 1007 ) 1008 -> grid 1009 ( 1010 -row=>$row++, 1011 -column=>1, 1012 -sticky=>"nw" 1013 ); 1014 $balloon->attach 1015 ( 1016 $id3_com_chk, 1017 -msg => "Set all mp3 comment tags to user entered string." 1018 ); 1019 1020 my $id3_com_ent = $tab2 -> Entry 1021 ( 1022 -textvariable=>\$main::id3_com_str 1023 ) 1024 -> grid 1025 ( 1026 -row=>$row++, 1027 -column=>1, 1028 -sticky=>"nw" 1029 ); 1030 1031 $tab2 -> Label 1032 ( 1033 -text=>" " 1034 ) 1035 ->grid 1036 ( 1037 -row=>$row++, 1038 -column=>1 1039 ); 1040 1041 #-------------------------------------------------------------------------------------------------------------- 1042 # misc tab options 1043 #-------------------------------------------------------------------------------------------------------------- 1044 1045 $tab5 -> Label 1046 ( 1047 -justify=>"left", 1048 -text=>"Misc Options:\n", 1049 -font => 'Arial 10 bold', 1050 ) 1051 -> grid 1052 ( 1053 -row=>1, 1054 -column=>1, 1055 -sticky=>"nw" 1056 ); 1057 1058 my $U_chk = $tab5 -> Checkbutton 1059 ( 1060 -text=>"Uppercase All", 1061 -variable=>\$main::uc_all, 1062 -activeforeground => "blue", 1063 -command=> sub 1064 { 1065 if($main::uc_all == 1) 1066 { 1067 $main::lc_all = 0; 1068 } 1069 } 1070 ) 1071 -> grid 1072 ( 1073 -row=>2, 1074 -column=>1, 1075 -sticky=>"nw" 1076 ); 1077 1078 my $L_chk = $tab5 -> Checkbutton 1079 ( 1080 -text=>"Lowercase All", 1081 -variable=>\$main::lc_all, 1082 -activeforeground => "blue", 1083 -command=> sub 1084 { 1085 if($main::lc_all == 1) 1086 { 1087 $main::uc_all = 0; 1088 } 1089 } 1090 ) 1091 -> grid 1092 ( 1093 -row=>4, 1094 -column=>1, 1095 -sticky=>"nw" 1096 ); 1097 1098 my $i_chk = $tab5 -> Checkbutton 1099 ( 1100 -text=>"International", 1101 -variable=>\$main::intr_char, 1102 -activeforeground => "blue" 1103 ) 1104 -> grid 1105 ( 1106 -row=>8, 1107 -column=>1, 1108 -sticky=>"nw" 1109 ); 1110 $balloon->attach 1111 ( 1112 $i_chk, 1113 -msg => "Converts International characters to their English equivalent" 1114 ); 1115 1116 my $b_chk = $tab5 -> Checkbutton 1117 ( 1118 -text=>"RM Chars", 1119 -variable=>\$main::sp_char, 1120 -activeforeground => "blue" 1121 ) 1122 -> grid 1123 ( 1124 -row=>10, 1125 -column=>1, 1126 -sticky=>"nw" 1127 ); 1128 $balloon->attach 1129 ( 1130 $b_chk, 1131 -msg => "Removes Following Characters from Filename.\n\n\~ \@ \# \% \( \) \{ \} \[ \] \" \< \> \! \` \' \," 1132 ); 1133 1134 my $d_chk = $tab5 -> Checkbutton 1135 ( 1136 -text=>"RM ^Digits", 1137 -variable=>\$main::digits, 1138 -activeforeground => "blue", 1139 -command=> sub 1140 { 1141 if($main::digits == 1) 1142 { 1143 $main::rm_digits = 0; 1144 } 1145 } 1146 ) 1147 -> grid 1148 ( 1149 -row=>14, 1150 -column=>1, 1151 -sticky=>"nw" 1152 ); 1153 $balloon->attach 1154 ( 1155 $d_chk, 1156 -msg => "Removes any digits from begining of filename" 1157 ); 1158 1159 my $N_chk = $tab5 -> Checkbutton 1160 ( 1161 -text=>"RM all Digits", 1162 -variable=>\$main::rm_digits, 1163 -activeforeground => "blue", 1164 -command=> sub 1165 { 1166 if($main::rm_digits == 1) 1167 { 1168 $main::digits = 0; 1169 } 1170 } 1171 ) 1172 -> grid 1173 ( 1174 -row=>16, 1175 -column=>1, 1176 -sticky=>"nw" 1177 ); 1178 1179 my $tab5_label_scene = $tab5 -> Label 1180 ( 1181 -justify=>"left", 1182 -text=>"\nScene Options:\n" 1183 ) 1184 -> grid 1185 ( 1186 -row=>18, 1187 -column=>1, 1188 -sticky=>"nw" 1189 ); 1190 1191 my $unscene_chk = $tab5 -> Checkbutton 1192 ( 1193 -text=>"un-Scenify", 1194 -variable=>\$main::unscene, 1195 -activeforeground => "blue", 1196 -command=> sub 1197 { 1198 if($main::unscene == 1) 1199 { 1200 $main::scene = 0; 1201 } 1202 } 1203 ) 1204 -> grid(-row=>20, -column=>1, -sticky=>"nw"); 1205 1206 $balloon->attach 1207 ( 1208 $unscene_chk, 1209 -msg => "Converts Season and Episode numbers from scene format to normal format.\n\neg: s10e19 to 10x19" 1210 ); 1211 1212 my $scene_chk = $tab5 -> Checkbutton 1213 ( 1214 -text=>"Scenify", 1215 -variable=>\$main::scene, 1216 -activeforeground => "blue", 1217 -command=> sub 1218 { 1219 if($main::scene == 1) 1220 { 1221 $main::unscene = 0; 1222 } 1223 } 1224 ) 1225 -> grid 1226 ( 1227 -row=>22, 1228 -column=>1, 1229 -sticky=>"nw" 1230 ); 1231 $balloon->attach 1232 ( 1233 $scene_chk, 1234 -msg => "Converts Season and Episode numbers to scene format\n\neg: 01x12 to s01e12" 1235 ); 1236 1237 $tab5 -> Label 1238 ( 1239 -justify=>"left", 1240 -text=>"\nPadding options:\n" 1241 ) 1242 -> grid 1243 ( 1244 -row=>24, 1245 -column=>1, 1246 -sticky=>"nw" 1247 ); 1248 1249 my $pad_chk = $tab5 -> Checkbutton 1250 ( 1251 -text=>"Pad - w space", 1252 -variable=>\$main::pad_dash, 1253 -activeforeground => "blue" 1254 ) 1255 -> grid 1256 ( 1257 -row=>26, 1258 -column=>1, 1259 -sticky=>"nw" 1260 ); 1261 $balloon->attach 1262 ( 1263 $pad_chk, 1264 -msg => "Pads - with user set space delimiter\n\neg: Weird Al-Eat It.mp3 to Weird Al - Eat It.mp3" 1265 ); 1266 1267 my $pad_d_chk = $tab5 -> Checkbutton 1268 ( 1269 -text=>"Pad NN w -", 1270 -variable=>\$main::pad_digits, 1271 -activeforeground => "blue" 1272 ) 1273 -> grid 1274 ( 1275 -row=>28, 1276 -column=>1, 1277 -sticky=>"nw" 1278 ); 1279 $balloon->attach 1280 ( 1281 $pad_d_chk, 1282 -msg => "Pads TRACK and SEASONxEPISODE with \" - \"\n\neg: Norther 10 Hollow.mp3 to Norther - 10 - Hollow.mp3" 1283 ); 1284 1285 my $pad_d_w_chk = $tab5 -> Checkbutton 1286 ( 1287 -text=>"Pad NxNN w 0", 1288 -variable=>\$main::pad_digits_w_zero, 1289 -activeforeground => "blue" 1290 ) 1291 -> grid 1292 ( 1293 -row=>30, 1294 -column=>1, 1295 -sticky=>"nw" 1296 ); 1297 $balloon->attach 1298 ( 1299 $pad_d_w_chk, 1300 -msg => "Pads SEASONxEPISODE with 0.\n\neg: 1x1, 01x1, 1x01 to 01x01." 1301 ); 1302 1303 my $chk_split_dddd = $tab5 -> Checkbutton 1304 ( 1305 -text=>"Pad NNNN with x", 1306 -variable=>\$main::split_dddd, 1307 -activeforeground => "blue" 1308 ) 1309 -> grid 1310 ( 1311 -row=>31, 1312 -column=>1, 1313 -sticky=>"nw" 1314 ); 1315 $balloon->attach 1316 ( 1317 $chk_split_dddd, 1318 -msg => "Pads Season and Episode numbers with an x\n\neg:0101 to 01x01, 102 to 1x02" 1319 ); 1320 1321 $tab5 -> Label 1322 ( 1323 -text=>"" 1324 ) 1325 ->grid 1326 ( 1327 -row=>32, 1328 -column=>1 1329 ); 1330 1331 #-------------------------------------------------------------------------------------------------------------- 1332 # Enumerate Tab 1333 #-------------------------------------------------------------------------------------------------------------- 1334 1335 $tab6 -> Label 1336 ( 1337 -text=>"Enumerate Options:\n", 1338 -font => 'Arial 10 bold', 1339 ) 1340 -> grid 1341 ( 1342 -row=>1, 1343 -column=>1, 1344 -columnspan=>2, 1345 -sticky=>"nw" 1346 ); 1347 1348 my $n_chk = $tab6 -> Checkbutton 1349 ( 1350 -text=>"Enumerate", 1351 -variable=>\$main::enum, 1352 -activeforeground => "blue" 1353 ) 1354 -> grid 1355 ( 1356 -row=>2, 1357 -column=>1, 1358 -columnspan=>2, 1359 -sticky=>"nw" 1360 ); 1361 $balloon->attach 1362 ( 1363 $n_chk, 1364 -msg => "Enumerates (Numbers) Files" 1365 ); 1366 1367 $tab6 -> Label 1368 ( 1369 -justify=>"left", 1370 -text=>"\nStyles:\n" 1371 ) 1372 -> grid 1373 ( 1374 -row=>3, 1375 -column=>1, 1376 -columnspan=>2, 1377 -sticky=>"nw" 1378 ); 1379 1380 my $rdb_a = $tab6 -> Radiobutton 1381 ( 1382 -text=>"Numbers only", 1383 -value=>"0", 1384 -variable=>\$main::enum_opt, 1385 -activeforeground => "blue" 1386 ) 1387 -> grid 1388 ( 1389 -row=>4, 1390 -column=>1, 1391 -columnspan=>2, 1392 -sticky=>"nw" 1393 ); 1394 my $rdb_b = $tab6 -> Radiobutton 1395 ( 1396 -text=>"Insert at Start", 1397 -value=>"1", 1398 -variable=>\$main::enum_opt, 1399 -activeforeground => "blue" 1400 ) 1401 -> grid 1402 ( 1403 -row=>5, 1404 -column=>1, 1405 -columnspan=>2, 1406 -sticky=>"nw" 1407 ); 1408 my $rdb_c = $tab6 -> Radiobutton 1409 ( 1410 -text=>"Insert at End", 1411 -value=>"2", 1412 -variable=>\$main::enum_opt, 1413 -activeforeground => "blue" 1414 ) 1415 -> grid 1416 ( 1417 -row=>6, 1418 -column=>1, 1419 -columnspan=>2, 1420 -sticky=>"nw" 1421 ); 1422 1423 $tab6 -> Label 1424 ( 1425 -justify=>"left", 1426 -text=>"\nPadding:\n" 1427 ) 1428 -> grid 1429 ( 1430 -row=>7, 1431 -column=>1, 1432 -columnspan=>2, 1433 -sticky=>"nw" 1434 ); 1435 1436 my $enum_pad_chk = $tab6 -> Checkbutton 1437 ( 1438 -text=>"Pad with zeros", 1439 -variable=>\$main::enum_pad, 1440 -activeforeground => "blue" 1441 ) 1442 -> grid 1443 ( 1444 -row=>8, 1445 -column=>1, 1446 -columnspan=>2, 1447 -sticky=>"nw" 1448 ); 1449 $balloon->attach 1450 ( 1451 $enum_pad_chk, 1452 -msg => "Pad enumrate number with zeros, so length of digits match length set in spinbox below.\n\neg: 001 Family Pic.jpg" 1453 ); 1454 1455 my $spin_pad_enum = $tab6 -> Spinbox 1456 ( 1457 -textvariable=>\$main::enum_pad_zeros, 1458 -from=>1, 1459 -to=>1000, 1460 -increment=>1, 1461 -width=>8 1462 ) 1463 -> grid 1464 ( 1465 -row=>10, 1466 -column=>1, 1467 -sticky=>"ne" 1468 ); 1469 1470 $tab6 -> Label 1471 ( 1472 -justify=>"left", 1473 -text=>"zeros" 1474 ) 1475 -> grid 1476 ( 1477 -row=>10, 1478 -column=>2, 1479 -sticky=>"nw" 1480 ); 1481 1482 $tab6 -> Label 1483 ( 1484 -text=>"\n\n\n\n\n\n\n\n\n\n\n" 1485 ) 1486 ->grid 1487 ( 1488 -row=>22, 1489 -column=>1 1490 ); 1491 1492 #-------------------------------------------------------------------------------------------------------------- 1493 # Truncate 1494 #-------------------------------------------------------------------------------------------------------------- 1495 1496 $tab7 -> Label 1497 ( 1498 -text=>"Truncate Options:\n", 1499 -font => 'Arial 10 bold', 1500 ) 1501 -> grid 1502 ( 1503 -row=>1, 1504 -column=>1, 1505 -columnspan=>1, 1506 -sticky=>"nw" 1507 ); 1508 1509 my $trunc_chk = $tab7 -> Checkbutton 1510 ( 1511 -text=>"Truncate", 1512 -variable=>\$main::truncate, 1513 -activeforeground => "blue" 1514 ) 1515 -> grid 1516 ( 1517 -row=>2, 1518 -column=>1, 1519 -columnspan=>1, 1520 -sticky=>"nw" 1521 ); 1522 $balloon->attach 1523 ( 1524 $trunc_chk, 1525 -msg => "Truncate filenames using settings below" 1526 ); 1527 1528 $tab7 -> Label 1529 ( 1530 -justify=>"left", 1531 -text=>"\nFilename Length: " 1532 ) 1533 -> grid 1534 ( 1535 -row=>3, 1536 -column=>1, 1537 -sticky=>"nw" 1538 ); 1539 1540 my $tfl_ent = $tab7 -> Entry 1541 ( 1542 -textvariable=>\$main::truncate_to, 1543 ) 1544 -> grid 1545 ( 1546 -row=>4, 1547 -column=>1, 1548 -sticky=>"nw" 1549 ); 1550 $balloon->attach 1551 ( 1552 $tfl_ent, 1553 -msg => "Enter the number of characters to truncate to.\n\nNote: Atm this is the same variable as maximum file length\nSo if u save options this number will become the new maximum filelength" 1554 ); 1555 1556 $tab7 -> Label 1557 ( 1558 -justify=>"left", 1559 -text=>"\nStyles:\n" 1560 ) 1561 -> grid 1562 ( 1563 -row=>8, 1564 -column=>1, 1565 -sticky=>"nw" 1566 ); 1567 1568 my $rdb_ts_a = $tab7 -> Radiobutton 1569 ( 1570 -text=>"From Start", 1571 -value=>"0", 1572 -variable=>\$main::truncate_style, 1573 -activeforeground => "blue" 1574 ) 1575 -> grid 1576 ( 1577 -row=>10, 1578 -column=>1, 1579 -sticky=>"nw" 1580 ); 1581 $balloon->attach 1582 ( 1583 $rdb_ts_a, 1584 -msg => "Remove characters from start of filename." 1585 ); 1586 1587 my $rdb_ts_b = $tab7 -> Radiobutton 1588 ( 1589 -text=>"From Middle", 1590 -value=>"2", 1591 -variable=>\$main::truncate_style, 1592 -activeforeground => "blue" 1593 ) 1594 -> grid 1595 ( 1596 -row=>11, 1597 -column=>1, 1598 -sticky=>"nw" 1599 ); 1600 $balloon->attach 1601 ( 1602 $rdb_ts_b, 1603 -msg => "Remove characters from the middle of the filename." 1604 ); 1605 my $rdb_ts_c = $tab7 -> Radiobutton 1606 ( 1607 -text=>"From End", 1608 -value=>"1", 1609 -variable=>\$main::truncate_style, 1610 -activeforeground => "blue" 1611 ) 1612 -> grid 1613 ( 1614 -row=>12, 1615 -column=>1, 1616 -sticky=>"nw" 1617 ); 1618 $balloon->attach 1619 ( 1620 $rdb_ts_c, 1621 -msg => "Remove characters from end of filename." 1622 ); 1623 1624 my $tab7_spacer1 = $tab7 -> Label 1625 ( 1626 -text=>" " 1627 ) 1628 -> grid 1629 ( 1630 -row=>13, 1631 -column=>1, 1632 -sticky=>"nw" 1633 ); 1634 1635 $tab7 -> Label 1636 ( 1637 -justify=>"left", 1638 -text=>"Insert Character\/s: " 1639 ) 1640 -> grid 1641 ( 1642 -row=>14, 1643 -column=>1, 1644 -columnspan=>1, 1645 -sticky=>"nw" 1646 ); 1647 1648 my $tab7_trunc_ent = $tab7 -> Entry 1649 ( 1650 -textvariable=>\$main::trunc_char, 1651 ) 1652 -> grid 1653 ( 1654 -row=>15, 1655 -column=>1, 1656 -columnspan=>1, 1657 -sticky=>"nw" 1658 ); 1659 $balloon->attach 1660 ( 1661 $tab7_trunc_ent, 1662 -msg => "Enter one or more characters to be placed\nin the middle of each file truncated using the\ntruncate from middle style.\n\nleave blank to have nothing put in." 1663 ); 1664 1665 $tab7 -> Label 1666 ( 1667 -text=>"\n\n\n\n\n\n\n\n\n\n" 1668 ) 1669 ->grid 1670 ( 1671 -row=>22, 1672 -column=>1 1673 ); 1674 1675 1676 #-------------------------------------------------------------------------------------------------------------- 1677 # draw filter 1678 #-------------------------------------------------------------------------------------------------------------- 1679 1680 our $f_frame = $main::frm_right2->Frame() 1681 -> pack 1682 ( 1683 -side=>"top", 1684 1685 ); 1686 1687 $f_frame -> Checkbutton 1688 ( 1689 -text=>"Filter", 1690 -variable=>\$main::FILTER, 1691 -activeforeground => "blue", 1692 -command=> sub 1693 { 1694 if($main::FILTER && $main::filter_string eq "") # dont enable filter on an empty string 1695 { 1696 &plog(1, "namefix: tried to enable filtering with an empty filter"); 1697 $main::FILTER = 0; 1698 } 1699 else 1700 { 1701 &ls_dir; 1702 } 1703 } 1704 ) 1705 ->pack 1706 ( 1707 -side=>'left', 1708 ); 1709 1710 1711 $f_frame->Label 1712 ( 1713 -text=>" " 1714 ) 1715 ->pack 1716 ( 1717 -side=>'left', 1718 ); 1719 1720 $f_frame->Entry 1721 ( 1722 -textvariable=>\$main::filter_string, 1723 -width=>35 1724 ) 1725 ->pack 1726 ( 1727 -side=>'left', 1728 ); 1729 1730 $f_frame -> Checkbutton 1731 ( 1732 -text=>"Case Sensitive", 1733 -variable=>\$main::filter_cs, 1734 -activeforeground => "blue" 1735 ) 1736 ->pack 1737 ( 1738 -side=>'left', 1739 ); 1740 1741 $f_frame -> Checkbutton 1742 ( 1743 -text=>"Use RE", 1744 -variable=>\$main::filter_use_re, 1745 -activeforeground => "blue" 1746 ) 1747 ->pack 1748 ( 1749 -side=>'left', 1750 ); 1751 1752 #-------------------------------------------------------------------------------------------------------------- 1753 # No more frames 1754 #-------------------------------------------------------------------------------------------------------------- 1755 1756 if($main::window_g ne "") 1757 { 1758 $mw ->geometry($main::window_g); 1759 } 1760 1761 &draw_menu; 1762 &draw_list; 1763 MainLoop; 1764 1765 1766 #-------------------------------------------------------------------------------------------------------------- 1767 # End 1768 #--------------------------------------------------------------------------------------------------------------