Skip to content

Commit

Permalink
Merge master into HEAD
Browse files Browse the repository at this point in the history
Conflicts:
	C-3PO.pl
	Transcoder.pm
	install.xml
  • Loading branch information
marco committed Jan 18, 2016
2 parents db55c23 + d03c017 commit 1fc36f0
Show file tree
Hide file tree
Showing 19 changed files with 2,900 additions and 32 deletions.
75 changes: 54 additions & 21 deletions C-3PO.pl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ package main;
my $C3PODir=$Bin;
my ($volume,$directories,$file) =File::Spec->splitpath($0);


#print '$volume is : '.$volume."\n";
#print '$directories is : '.$directories."\n";
#print '$file is : '.$file."\n";
Expand All @@ -71,7 +70,6 @@ package main;
# We are running the compiled version in
# \Bin\MSWin32-x86-multi-thread folder inside the
#plugin folder.

$C3PODir = File::Spec->canonpath(getAncestor($Bin,2));

} elsif ($file eq 'C-3PO'){
Expand All @@ -80,7 +78,6 @@ package main;
#$C3PODir= File::Spec->canonpath(File::Basename::dirname(__FILE__)); #C3PO Folder
$C3PODir = File::Spec->canonpath(getAncestor($Bin,1));


} elsif ($file eq 'C-3PO.pl'){

#running .pl
Expand All @@ -95,15 +92,13 @@ package main;

my $lib = File::Spec->rel2abs(catdir($C3PODir, 'lib'));
my $cpan= File::Spec->rel2abs(catdir($C3PODir,'CPAN'));
my $include= File::Spec->rel2abs(catdir($C3PODir,'include'));
my $winAuto= File::Spec->rel2abs(catdir($C3PODir,'include','auto'));

my @a=($C3PODir,$lib,$cpan,$include,$winAuto);
my @a=($C3PODir,$lib,$cpan);
for my $i (@a){addToArray($i, \@INC);}

require Utils::Config;

$a= Utils::Config::expandINC($C3PODir);
@a= Utils::Config::expandINC($C3PODir);
for my $i (@a){addToArray($i, \@INC);}

#unshift @INC, Utils::Config::expandINC($C3PODir);
Expand Down Expand Up @@ -148,13 +143,9 @@ package main;
require Utils::Config;

#in Base
require FileHandle;
require YAML::XS;
require Data::Dump;

#in include
require Audio::Scan;

#require FileHandle;
#require YAML::XS;
#require Data::Dump;

#In lib.
require Module::Load;
Expand Down Expand Up @@ -201,16 +192,48 @@ sub main{

}

Plugins::C3PO::Logger::infoMessage('BIN '.$Bin);
Plugins::C3PO::Logger::infoMessage('C-3PO '.$C3PODir);
Plugins::C3PO::Logger::infoMessage('inc0'.Data::Dump::dump(@inc0));
Plugins::C3PO::Logger::infoMessage('inc1'.Data::Dump::dump(@inc1));
Plugins::C3PO::Logger::infoMessage('inc2'.Data::Dump::dump(@inc2));
Plugins::C3PO::Logger::infoMessage('INC '.Data::Dump::dump(@INC));
if (defined $options->{'serverFolder'}){

$serverFolder=$options->{'serverFolder'};

my $lib = File::Spec->rel2abs(catdir($serverFolder, 'lib'));
my $cpan= File::Spec->rel2abs(catdir($serverFolder,'CPAN'));

my @a=($serverFolder,$lib,$cpan);
for my $i (@a){addToArray($i, \@INC);}

require Utils::Config;
@a= Utils::Config::expandINC($serverFolder);
for my $i (@a){addToArray($i, \@INC);}

#in LMS CPAN or lib.

require FileHandle;
require YAML::XS;
require Data::Dump;
require Audio::Scan;

}
Plugins::C3PO::Logger::infoMessage('DEBUGLOG '.main::DEBUGLOG);
Plugins::C3PO::Logger::infoMessage('INFOLOG '.main::INFOLOG);
Plugins::C3PO::Logger::infoMessage('loglevel '.$logLevel);

Plugins::C3PO::Logger::debugMessage('BIN '.$Bin);
Plugins::C3PO::Logger::debugMessage('C-3PO '.$C3PODir);
Plugins::C3PO::Logger::debugMessage('Server '.$serverFolder);
Plugins::C3PO::Logger::debugMessage('inc0'.Data::Dump::dump(@inc0));
Plugins::C3PO::Logger::debugMessage('inc1'.Data::Dump::dump(@inc1));
Plugins::C3PO::Logger::debugMessage('inc2'.Data::Dump::dump(@inc2));
Plugins::C3PO::Logger::debugMessage('INC '.Data::Dump::dump(@INC));

Plugins::C3PO::Logger::debugMessage('Inc: '.$INC{'Module/Load.pm'});
Plugins::C3PO::Logger::debugMessage('Inc: '.$INC{'File/HomeDir.pm'});
Plugins::C3PO::Logger::debugMessage('Inc: '.$INC{'Getopt/Long.pm'});
Plugins::C3PO::Logger::debugMessage('Inc: '.$INC{'FileHandle.pm'});
Plugins::C3PO::Logger::debugMessage('Inc: '.$INC{'Data/Dump.pm'});
Plugins::C3PO::Logger::debugMessage('Inc: '.$INC{'YAML/XS.pm'});
Plugins::C3PO::Logger::debugMessage('Inc: '.$INC{'Audio/Scan.pm'});

$isDebug= $options->{debug};
if ($isDebug){
Plugins::C3PO::Logger::infoMessage('Running in debug mode');
Expand Down Expand Up @@ -240,6 +263,13 @@ sub main{
if (!defined $prefs) {Plugins::C3PO::Logger::dieMessage("Invalid pref file in options")}
Plugins::C3PO::Logger::debugMessage ('Prefs: '.Data::Dump::dump($prefs));

#use prefs only if not already in options.
if (!defined $serverFolder){

$serverFolder=$prefs->{'serverFolder'};
if (!defined $serverFolder) {Plugins::C3PO::Logger::dieMessage("Missing ServerFolder")}
Plugins::C3PO::Logger::debugMessage ('server foder: '.$serverFolder);
}
if (!defined $options->{logFolder}){

my $logFolder=$prefs->{'logFolder'};
Expand Down Expand Up @@ -346,7 +376,7 @@ sub executeCommand{
#some hacking on quoting and escaping for differents Os...
$command= Plugins::C3PO::Shared::finalizeCommand($command);

Plugins::C3PO::Logger::infoMessage(qq(executeCommand - Command is: $command));
Plugins::C3PO::Logger::infoMessage(qq(execute command : $command));
Plugins::C3PO::Logger::verboseMessage($main::isDebug ? 'in debug' : 'production');

if ($main::isDebug){
Expand Down Expand Up @@ -382,6 +412,7 @@ sub getOptions{
'd' => \$options->{debug},
'h=s' => \$options->{hello},
'l=s' => \$options->{logFolder},
'x=s' => \$options->{serverFolder},
'p=s' => \$options->{prefFile},
'c=s' => \$options->{clientId},
'i=s' => \$options->{inCodec},
Expand All @@ -392,6 +423,8 @@ sub getOptions{
'u=s' => \$options->{endSec},
'w=s' => \$options->{durationSec},
'r=s' => \$options->{forcedSamplerate},
'nodebuglog' => \$options->{nodebuglog}, #already detected
'noinfolog' => \$options->{noinfolog}, #already detected
);

my $file;
Expand Down
6 changes: 3 additions & 3 deletions Plugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -630,12 +630,12 @@ sub _testC3POEXE{

my $command= qq("$pathToC3PO_exe" -h hello -l "$logFolder");

if (! main::DEBUGLOG) {
if (! (main::DEBUGLOG && $log->is_debug)) {

$command = $command." --nodebuglog";
}

if (! main::INFOLOG){
if (! (main::INFOLOG && $log->is_info)){

$command = $command." --noinfolog";
}
Expand Down Expand Up @@ -1532,4 +1532,4 @@ sub _getStatusLine{

return $tab;
}
1;
1;
15 changes: 10 additions & 5 deletions Transcoder.pm
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,7 @@ sub useC3PO{
my $prefFile = $transcodeTable->{'pathToPrefFile'};
my $pathToC3PO_pl = $transcodeTable->{'pathToC3PO_pl'};
my $logFolder = $transcodeTable->{'logFolder'};
my $serverFolder = $transcodeTable->{'serverFolder'};


$result->{'profile'} = buildProfile($transcodeTable);
Expand All @@ -702,8 +703,11 @@ sub useC3PO{

$command = '[C-3PO] -c $CLIENTID$ ';
}
if (isLMSInfo()) {
$log->info("serverfolder. ".$serverFolder);
}

$command = $command.qq(-p "$prefFile" -l "$logFolder" -i $inCodec -o $outCodec )
$command = $command.qq(-p "$prefFile" -l "$logFolder" -x "$serverFolder" -i $inCodec -o $outCodec )
.'$START$ $END$ $RESAMPLE$ $FILE$';

if (! isLMSDebug()) {
Expand Down Expand Up @@ -881,7 +885,7 @@ sub buildCommand {

}
$command = $transcodeTable->{'command'}||"";
Plugins::C3PO::Logger::infoMessage('B command: '.$command);
Plugins::C3PO::Logger::infoMessage('Transcode command: '.$command);

if ($command eq ""){

Expand All @@ -897,14 +901,14 @@ sub buildCommand {
}
}
$command = $transcodeTable->{'command'}||"";
Plugins::C3PO::Logger::infoMessage('Safe command: '.$command);
Plugins::C3PO::Logger::infoMessage('Safe command : '.$command);

if (needRestoreHeader($transcodeTable)){

$transcodeTable = restoreHeader($transcodeTable);
}
$command = $transcodeTable->{'command'}||"";
Plugins::C3PO::Logger::infoMessage('Final command: '.$command);
Plugins::C3PO::Logger::infoMessage('Final command : '.$command);
return $transcodeTable;
}
sub native{
Expand Down Expand Up @@ -933,6 +937,7 @@ sub restoreHeader{

my $prefFile = $transcodeTable->{'pathToPrefFile'};
my $logFolder = $transcodeTable->{'logFolder'};
my $serverFolder = $transcodeTable->{'serverFolder'};

my $commandString= "";

Expand All @@ -950,7 +955,7 @@ sub restoreHeader{
# qq(-d $main::logLevel -l "$main::logfile" "$testfile" | );

$commandString = $commandString
.qq(-b -p "$prefFile" -l "$logFolder" "$testfile");
.qq(-b -p "$prefFile" -l "$logFolder" -x "$serverFolder" "$testfile");

#Copy debug settngs.
if (! main::DEBUGLOG) {
Expand Down
6 changes: 3 additions & 3 deletions install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<id>91d8fb10-c3po-11e3-ac10-0800200c9a66</id>
<name>PLUGIN_C3PO</name>
<module>Plugins::C3PO::Plugin</module>
<version>1.0.07</version>
<version>1.0.08</version>
<description>PLUGIN_C3PO_DESC</description>
<creator>marcoc1712</creator>
<email>marcoc1712@gmail.com</email>
Expand All @@ -18,7 +18,7 @@
<minVersion>7.8</minVersion>
<maxVersion>*</maxVersion>
</targetApplication>
<zipUrl>http://www.marcoc1712.it/downloads/C3POEXE-v1.0.07-win.zip</zipUrl>
<md5>30d2280cdbbf129c48ada39d36da333f</md5>
<zipUrl>http://www.marcoc1712.it/downloads/C3POEXE-v1.0.08-win.zip</zipUrl>
<md5>9656652cf0ed61c66292eda68723e981</md5>
<file>C-3PO.exe</file>
</extension>
Loading

0 comments on commit 1fc36f0

Please sign in to comment.