Permalink
Browse files

ignore uncategorized

  • Loading branch information...
1 parent 9858516 commit 77fc38bf726126b87b1192495e4f5d409ccf4503 @miyagawa committed Nov 6, 2012
Showing with 6 additions and 9 deletions.
  1. +2 −2 folder-watcher/find-and-symlink.pl
  2. +4 −7 folder-watcher/tvshow-symlinks.pl
@@ -4,13 +4,13 @@
my $now = time;
-my($watch, $linkdir, $age) = @ARGV;
+my($linkdir, $age, @watch) = @ARGV;
$age ||= 3600 * 24 * 30;
mkdir $linkdir, 0777 unless -e $linkdir;
my %exists = map { ($_ => 1) } glob "$linkdir/*";
-find(\&want, $watch);
+find(\&want, @watch);
for my $e (keys %exists) {
unlink $e;
@@ -10,11 +10,8 @@
use Unicode::Normalize;
our $BaseDir = "$ENV{HOME}/Movies/Plex";
-our $Uncategorized = "$BaseDir/Uncategorized";
-for ($BaseDir, $Uncategorized) {
- mkdir $_, 0777 unless -e $_;
-}
+mkdir $BaseDir, 0777 unless -e $BaseDir;
if ($ARGV[0] eq '-t') { selftest() }
@@ -31,7 +28,7 @@
for my $file (@ARGV) {
$file = File::Spec->file_name_is_absolute($file) ? $file : "$current/$file";
if (my $info = parse_info($file, $aliases)) {
- my $link = generate_link($info, $file);
+ my $link = generate_link($info, $file) or next;
unlink $link;
symlink $file, $link;
warn "symlinked $link\n";
@@ -121,8 +118,8 @@ sub generate_link {
$path = "$BaseDir/$info->{series}";
$link = sprintf "%s - %04d.%02d.%02d.%s", $info->{series}, @{$info->{date}}, $ext;
} else {
- $path = "$Uncategorized";
- $link = File::Basename::basename($file);
+ warn "Didn't match any episode or date: $file";
+ return;
}
mkpath $path unless $test;

0 comments on commit 77fc38b

Please sign in to comment.