public Torrent VerifyMusicTorrent()
{
for (int a = 0; a < information.Length; a++)
{
/*Switch statement soley to improve readability*/
switch (a)
{
case 0: //Artist
{
if (information[a] == null)
goto default;
if (SettingsHandler.GetDoubleSpaceRemoval())
{
while (information[0].Contains(" "))
information[0] = information[0].Replace(" ", " ");
}
/*MusicBrainzXMLDocumentCreator createXML = new MusicBrainzXMLDocumentCreator("http://musicbrainz.org/ws/1/artist/?type=xml&name=" + information[0]);
MusicBrainzXMLDocumentArtist[] artists = createXML.ProcessArtist();
/*if (!artists[0].name.Equals(information[0]) && !artists[1].name.Equals(information[0]))
{
string trimmedArtist = information[0].Trim();
if (!artists[0].name.Equals(trimmedArtist) && !artists[1].name.Equals(trimmedArtist))
{
information[0] = IssueWarning("Artist is not perfect match", information[10]);
}
}*/
}
break;
case 1: //Album
{
if (information[a] == null)
goto default;
/*MusicBrainzXMLDocumentCreator createXML = new MusicBrainzXMLDocumentCreator("http://musicbrainz.org/ws/1/release/?type=xml&title=" + information[1]);
MusicBrainzXMLDocumentRelease[] releases = createXML.ProcessRelease();
/*if (!releases[0].releaseTitle.Equals(information[1]) && releases[0].ext_score.Equals("100"))
{
information[1] = IssueWarning("Album is not perfect match", information[10]);
}*/
}
break;
case 2: //Release Type
{
if (information[a] == null)
goto default;
/*MusicBrainzXMLDocumentCreator createXML = new MusicBrainzXMLDocumentCreator("http://musicbrainz.org/ws/1/artist/?type=xml&name=" + information[0]);
MusicBrainzXMLDocumentRelease[] releases = createXML.ProcessRelease();
if (!releases[0].releaseType.Equals(information[2]) && releases[0].ext_score.Equals("100"))
{
information[2] = IssueWarning("Release type is not perfect match", information[10]);
}
else if (!releases[1].releaseType.Equals(information[2]))
{
information[2] = IssueWarning("Release type is not perfect match", information[10]);
}*/
}
break;
case 3:
{
if (information[a] == null)
goto default;
Match match = (Regex.Match(information[3], "(([0-3][0-9][0-9]|V0|V1|V2|APS|APX|V8)+[(]?(VBR)?[)]?)|Lossless"));
if (!match.Success)
{
information[3] = IssueWarning("Bitrate is not perfect match", new FileInfo(information[10]), null);
}
}
break;
case 4:
{
//No Need. Already taken care of during processing with YearHelper
}
break;
case 5:
{
/*Musicbrainz doesn't have physical formats as far as I'm aware, and
* since my means of getting the physical format are String.Contains(...)
* it's pointless to do another check.
* */
}
break;
case 6:
{
/*Bitrates are defined and verified by the birth of the torrent. There's
nothing I can do to check if this is correct*/
}
break;
case 13:
{
if (information[13] != null)
{
if (information[13].EndsWith("EP EP"))
{
information[13] = information[13].Remove(information[13].Length - 2, 2);
information[13] = information[13].Trim();
}
while (information[13].Contains(" "))
{
information[13] = information[13].Replace(" ", " ");
}
if (SettingsHandler.GetUppercaseAllFolderNames())
information[13] = information[13].ToUpper();
else if (SettingsHandler.GetLowercaseAllFolderNames())
information[13] = information[13].ToLower();
try
{
Match match = Regex.Match(information[13], "[<]|[>]|[/]|[|]|[?]|[*]");
if (match.Success)
{
information[13] = IssueError("Illegal characters", new FileInfo(information[13]));
}
}
catch { }
}
if ((SettingsHandler.GetTorrentSaveFolder() + @"\[CSL] -- Handled Torrents\" + information[11]).Length >= 255)
{
IssueError("Torrent save location is greater than 255", new FileInfo(information[10]));
}
}
break;
default:
break;
} //END SWITCH
} //END FOR
return new Torrent(information);
}