X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/61d7dd11d4a450a64f2817ee4db0ec7fa5880b42..b9e4a0c3af29391c27e9a020693541b9a86c4d14:/bin/old/addName.pl?ds=inline diff --git a/bin/old/addName.pl b/bin/old/addName.pl deleted file mode 100755 index c5a8069..0000000 --- a/bin/old/addName.pl +++ /dev/null @@ -1,59 +0,0 @@ -#! /usr/bin/perl - -use warnings; -use strict; -# getopts module -use Getopt::Std; -# getstore madule -use LWP::Simple; -# Curent Working Directory module -use Cwd; - -# eguides URL -my $url = 'http://epguides.com'; - -# get options -our($opt_n); -getopts('n') or die; # sets opt_n to true if -n is given - #+or dies when options are unknown - -my $cwd = getcwd(); -my $path = 'tmp'; - -print $cwd . "\n"; - -$cwd =~ /.*\/(.*) (?:\[.*\])*\/Season (\d+)/; -print $1 . " " . $2 . "\n"; -my $file = $1; - - -getstore( "$url/$file", $path); - -open FILE, $path or die $!; -my @lines = ; -close FILE; -unlink($path); - - -my @old_file_names = <*>; - -foreach my $old_file_name (@old_file_names) { -# print $old_file_name . "\n"; - if ($old_file_name =~ /0?(?\d+).*?0?(?\d+)/) { -# print $+{episode} . "\n"; - my $episode = length($+{episode}) == 1 ? '0' . $+{episode} : $+{episode}; - my $pattern = '(0?'.$+{season}.')-([0 ]?'.$+{episode}.').*>(.*) *<\/a>'; - foreach my $line (@lines) { - if ($line =~ /$pattern/) { - my $new_file_name = $1 . "x" . $episode . " " .$3 . ".avi"; -# print "pattern -> " . $pattern . "\n"; - if ($opt_n) { - print $old_file_name . " -> " . $new_file_name . "\n"; - } else { - rename($old_file_name, $new_file_name); - } - last; - } - } - } -}