';
$ThisLine .= 'view | ';
$ThisLine .= ''.FixTextFields($row['filename']).' | ';
$tagvalues = '';
foreach ($FieldsToCompare as $fieldname) {
$tagvalues .= $fieldname.' = '.@implode(" \n", @$Comments['all'][$fieldname])." \n";
}
$ThisLine .= 'all | ';
foreach ($TagsToCompare as $tagtype => $CompareThisTagType) {
if ($CompareThisTagType) {
$tagvalues = '';
foreach ($FieldsToCompare as $fieldname) {
if ($tagtype == 'id3v1') {
getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v1.php', __FILE__, true);
if (($fieldname == 'genre') && !getid3_id3v1::LookupGenreID(@$Comments['all'][$fieldname][0])) {
// non-standard genres can never match, so just ignore
$tagvalues .= $fieldname.' = '.@$Comments[$tagtype][$fieldname][0]."\n";
} elseif ($fieldname == 'comment') {
if (rtrim(substr(@$Comments[$tagtype][$fieldname][0], 0, 28)) != rtrim(substr(@$Comments['all'][$fieldname][0], 0, 28))) {
//echo __LINE__.'
';
//echo '';
//var_dump($tagtype);
//var_dump($fieldname);
//echo '';
//exit;
$tagvalues .= $fieldname.' = [['.@$Comments[$tagtype][$fieldname][0].']]'."\n";
if (trim(strtolower(RemoveAccents(substr(@$Comments[$tagtype][$fieldname][0], 0, 28)))) == trim(strtolower(RemoveAccents(substr(@$Comments['all'][$fieldname][0], 0, 28))))) {
$SemiMatched[$tagtype] = true;
} else {
$Mismatched[$tagtype] = true;
}
$FileOK = false;
} else {
$tagvalues .= $fieldname.' = '.@$Comments[$tagtype][$fieldname][0]."\n";
}
} elseif ($fieldname == 'track') {
// intval('01/20') == intval('1')
if (intval(@$Comments[$tagtype][$fieldname][0]) != intval(@$Comments['all'][$fieldname][0])) {
//echo __LINE__.'
';
//echo '';
//var_dump($tagtype);
//var_dump($fieldname);
//echo '';
//exit;
$tagvalues .= $fieldname.' = [['.@$Comments[$tagtype][$fieldname][0].']]'."\n";
$Mismatched[$tagtype] = true;
$FileOK = false;
} else {
$tagvalues .= $fieldname.' = '.@$Comments[$tagtype][$fieldname][0]."\n";
}
} elseif (rtrim(substr(@$Comments[$tagtype][$fieldname][0], 0, 30)) != rtrim(substr(@$Comments['all'][$fieldname][0], 0, 30))) {
//echo __LINE__.'
';
//echo '';
//var_dump($tagtype);
//var_dump($fieldname);
//echo '';
//exit;
$tagvalues .= $fieldname.' = [['.@$Comments[$tagtype][$fieldname][0].']]'."\n";
if (strtolower(RemoveAccents(trim(substr(@$Comments[$tagtype][$fieldname][0], 0, 30)))) == strtolower(RemoveAccents(trim(substr(@$Comments['all'][$fieldname][0], 0, 30))))) {
$SemiMatched[$tagtype] = true;
} else {
$Mismatched[$tagtype] = true;
}
$FileOK = false;
if (strlen(trim(@$Comments[$tagtype][$fieldname][0])) > 0) {
$EmptyTags[$tagtype] = false;
}
} else {
$tagvalues .= $fieldname.' = '.@$Comments[$tagtype][$fieldname][0]."\n";
if (strlen(trim(@$Comments[$tagtype][$fieldname][0])) > 0) {
$EmptyTags[$tagtype] = false;
}
}
} elseif (($tagtype == 'ape') && ($fieldname == 'year')) {
if ((@$Comments['ape']['date'][0] != @$Comments['all']['year'][0]) && (@$Comments['ape']['year'][0] != @$Comments['all']['year'][0])) {
$tagvalues .= $fieldname.' = [['.@$Comments['ape']['date'][0].']]'."\n";
$Mismatched[$tagtype] = true;
$FileOK = false;
if (strlen(trim(@$Comments['ape']['date'][0])) > 0) {
$EmptyTags[$tagtype] = false;
}
} else {
$tagvalues .= $fieldname.' = '.@$Comments[$tagtype][$fieldname][0]."\n";
if (strlen(trim(@$Comments[$tagtype][$fieldname][0])) > 0) {
$EmptyTags[$tagtype] = false;
}
}
} elseif (($fieldname == 'genre') && !empty($Comments['all'][$fieldname]) && !empty($Comments[$tagtype][$fieldname]) && in_array($Comments[$tagtype][$fieldname][0], $Comments['all'][$fieldname])) {
$tagvalues .= $fieldname.' = '.@$Comments[$tagtype][$fieldname][0]."\n";
if (strlen(trim(@$Comments[$tagtype][$fieldname][0])) > 0) {
$EmptyTags[$tagtype] = false;
}
} elseif (@$Comments[$tagtype][$fieldname][0] != @$Comments['all'][$fieldname][0]) {
//echo __LINE__.'
';
//echo '';
//var_dump($tagtype);
//var_dump($fieldname);
//var_dump($Comments[$tagtype][$fieldname][0]);
//var_dump($Comments['all'][$fieldname][0]);
//echo '';
//exit;
$skiptracknumberfield = false;
switch ($fieldname) {
case 'track':
case 'tracknumber':
case 'track_number':
if (intval(@$Comments[$tagtype][$fieldname][0]) == intval(@$Comments['all'][$fieldname][0])) {
$skiptracknumberfield = true;
}
break;
}
if (!$skiptracknumberfield) {
$tagvalues .= $fieldname.' = [['.@$Comments[$tagtype][$fieldname][0].']]'."\n";
if (trim(strtolower(RemoveAccents(@$Comments[$tagtype][$fieldname][0]))) == trim(strtolower(RemoveAccents(@$Comments['all'][$fieldname][0])))) {
$SemiMatched[$tagtype] = true;
} else {
$Mismatched[$tagtype] = true;
}
$FileOK = false;
if (strlen(trim(@$Comments[$tagtype][$fieldname][0])) > 0) {
$EmptyTags[$tagtype] = false;
}
}
} else {
$tagvalues .= $fieldname.' = '.@$Comments[$tagtype][$fieldname][0]."\n";
if (strlen(trim(@$Comments[$tagtype][$fieldname][0])) > 0) {
$EmptyTags[$tagtype] = false;
}
}
}
if ($EmptyTags[$tagtype]) {
$FileOK = false;
$ThisLine .= '';
} elseif ($SemiMatched[$tagtype]) {
$ThisLine .= ' | ';
} elseif ($Mismatched[$tagtype]) {
$ThisLine .= ' | ';
} else {
$ThisLine .= ' | ';
}
$ThisLine .= ''.$tagtype.'';
$ThisLine .= ' | ';
}
}
$ThisLine .= '
';
if (!$FileOK) {
$NotOKfiles++;
echo '';
flush();
if (!empty($_REQUEST['autofix'])) {
$AnyMismatched = false;
foreach ($Mismatched as $key => $value) {
if ($value && ($EmptyTags["$key"] === false)) {
$AnyMismatched = true;
}
}
if ($AnyMismatched && empty($_REQUEST['autofixforcesource'])) {
echo $ThisLine;
} else {
$TagsToSynch = '';
foreach ($EmptyTags as $key => $value) {
if ($value) {
switch ($key) {
case 'id3v1':
$TagsToSynch .= '1';
break;
case 'id3v2':
$TagsToSynch .= '2';
break;
case 'ape':
$TagsToSynch .= 'A';
break;
}
}
}
$autofixforcesource = (@$_REQUEST['autofixforcesource'] ? $_REQUEST['autofixforcesource'] : 'all');
$TagsToSynch = (@$_REQUEST['autofixforcedest'] ? $_REQUEST['autofixforcedest'] : $TagsToSynch);
$errors = array();
if (SynchronizeAllTags($row['filename'], $autofixforcesource, $TagsToSynch, $errors)) {
$Autofixedfiles++;
echo '