#!/bin/perl
#default libraries
use strict;
use warnings;
use Cwd;
use File::Find;
# Get the command line argument for search path (supports network paths in the format of \\HOST\folder)
my $find_path =$ARGV[0];
# Call the find function and provide a search path with a callback function.
find(\&find_files, $find_path);
#############################################
# Search for a given subtitle file.
# This function is called with the original movie file name, and a specific
# subtitle extension.
#############################################
sub find_subs {
# First function parameter is the video file name
my $video_file = shift;
# Second function parameter is the subtitle file extension
my $subs_extension = shift;
# Build the subtitle file name (set video file name, and replace the extension).
my $sub_file = $video_file;
$sub_file =~ s/\.\w+$/\.$subs_extension/i;
# Check if the file exists. Return 1 if exists, 0 if not.
if (-e $sub_file) {
return 1;
}
return 0;
}
#############################################
# find callback. This callback is called for each file found.
#############################################
sub find_files {
# Extract the file which this function was called for using the file::find library.
my $file = $File::Find::name;
# Modify this line if you need more movie file formats. Currently supporting the following files :
return unless $file =~ /mkv$/ || $file =~ /avi$/ || $file =~ /mpeg$/ || $file =~ /mpg$/ || $file =~ /ts$/;
#replace unix style slashes with windows style backslashes
$file =~ s,/,\\,g;
#modify the followig for more subtitle types.
unless (find_subs($file,"srt") || find_subs($file,"sub")) {
print "$file has no subtitles\n";
}
}
duder כתב:אהבתי,
עטפתי בקובץ bat שרץ על כל ספריות הסדרות ובקליק אחד הכל מסונכרן
אפילו יותר מהיר מהשיטה של sendto->Submatch למי שמכיר.
מה שעדן חסר לי ויהיה שדרוג רציני, זו תוכנה שתנטר באופן קבועה את הספריות ואם לקובץ חסר תרגום,
תחפש אותו באתר סרטים או דומיו ותוריד.
(ב YAMJ יש יכולת כזאת, אך היא רצה פעם אחת לכל קובץ)
...
אם אתה מכיר JAVA, אז לא תהיה לך בעיה להוריד את קוד המקור הפתוח של YAMJ, להסתכל ב SRATIMPLUGIN ולשלוף משם את הקוד שעושה את זה. זה אפילו מרוכז בפונקציה אחת שעושה PARSING לדף ה HTML שיורד מאתר סרטים עבור הסרט שנבחר.