Skip to content

Commit

Permalink
Merge pull request #4 from CaptainJet/master
Browse files Browse the repository at this point in the history
Fix winport.pl on newer Perl versions, update README
  • Loading branch information
hilts-vaughan committed Jun 25, 2015
2 parents 455d0c7 + e155b34 commit 17a0925
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
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

0 comments on commit 17a0925

Please sign in to comment.