Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix winport.pl on newer Perl versions, update README #4

Merged
merged 2 commits into from
Jun 25, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ If you're running on Linux, you will need to look up how to get the tools above

## Every Operating System

You will probably need `Log::Log4perl` for your Perl installation. You can do this step just in case if you're not sure if it's installed.
You will probably need `Log::Log4perl` and `XML::LibXML` for your Perl installation. You can do this step just in case if you're not sure if it's installed.

1. Open a terminal or command prompt on your operating system
2. Type `cpan Log::Log4perl` and then press return/enter
3. The CPAN manager should install the logging module, you should be able to exit the terminal now.
3. Repeat step 2, but type `cpan XML::LibXML` instead
4. The CPAN manager should install the logging module, and the XML module, you should be able to exit the terminal now.

If you are using Mono, the first run always takes a little bit (about a minute). Please be patient.

Expand Down
16 changes: 8 additions & 8 deletions UnlinkMKV-GUI/UnlinkMKV-GUI/winport.pl
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ package UnlinkMKV {
}
}
close $H;
if (defined @{$seg->{attachments}} && @{$seg->{attachments}} > 0) {
if (exists $seg->{attachments} && @{$seg->{attachments}} > 0) {
my $dir = cwd();
TRACE "chdir $self->{tmp}/attach";
chdir("$self->{tmp}/attach");
Expand Down Expand Up @@ -482,7 +482,7 @@ package UnlinkMKV {
@aopt = undef;
@aopt = qw/-map 0 -acodec ac3 -ab 320k/;
}
$self->sys($self->{opt}->{ffmpeg}, '-i', "\"" . $part . "\"", @vopt, @aopt, "\"" . "$part-fixed.mkv" . "\"");
$self->sys($self->{opt}->{ffmpeg}, '-i', "\"" . $part . "\"", @vopt, @aopt, "\"" . "$part-fixed.mkv" . "\"", '2>&1');
$self->replace($part, "$part-fixed.mkv");
}
less();
Expand Down Expand Up @@ -555,7 +555,7 @@ package UnlinkMKV {
my $file = shift;
my $size = int(((-s $file)/1024+.5)*1.1);
my $br = 2000;
foreach my $line (split /\n/, $self->sys($self->{opt}->{ffmpeg}, '-i', $file)) {
foreach my $line (split /\n/, $self->sys($self->{opt}->{ffmpeg}, '-i', $file, '2>&1')) {
if($line =~ /duration: (\d+):(\d+):(\d+\.\d+),/i) {
my $duration = ($1*3600)+($2*60)+int($3+.5);
$br = int(($size / $duration)+.5);
Expand Down Expand Up @@ -626,7 +626,7 @@ package UnlinkMKV {


# We use this instead of CRC32 so we can avoid requiring compiling native C code for usage
sub mycrc32 {
sub mycrc32 {
my ($input, $init_value, $polynomial) = @_;

$init_value = 0 unless (defined $init_value);
Expand Down Expand Up @@ -655,7 +655,7 @@ package UnlinkMKV {
$crc = $crc ^ 0xffffffff;

return $crc;
}
}



Expand Down Expand Up @@ -808,16 +808,16 @@ package UnlinkMKV {
my ($pid, $in, $out, $err, $sel, $buf);
my $cmd = "$app @_";
TRACE "sys > $cmd";
my $dbuffer = `$cmd`;
return $dbuffer;
my $dbuffer = `$cmd`;
return $dbuffer;

$err = gensym();
more();

$pid = open3($in, $out, $err, $app, @_) or LOGDIE "failed to open $app: @_";
$sel = new IO::Select;
$sel->add($out,$err);
SYSLOOP: while(my @ready = $sel->can_read) {
while(my @ready = $sel->can_read) {
foreach my $fh (@ready) {
my $line = <$fh>;
if(not defined $line) {
Expand Down