Second part of correction #3997 (#4017)

- try/catch block for torrent parsing
Sonarr test button was failed because an invalid torrent.
This commit is contained in:
morpheus133
2018-10-17 08:09:33 +02:00
committed by garfield69
parent cae6d4ed73
commit c846eb4330

View File

@@ -129,9 +129,10 @@ namespace Jackett.Common.Indexers
// Check torrents only till we reach the query Limit // Check torrents only till we reach the query Limit
for(int i=0; (i<rows.Length && ((already_founded + releases.Count) < limit )); i++) for(int i=0; (i<rows.Length && ((already_founded + releases.Count) < limit )); i++)
{
try
{ {
CQ qRow = rows[i].Cq(); CQ qRow = rows[i].Cq();
var key = dom["link[rel=alternate]"].First().Attr("href").Split('=').Last(); var key = dom["link[rel=alternate]"].First().Attr("href").Split('=').Last();
release = new ReleaseInfo(); release = new ReleaseInfo();
@@ -185,14 +186,14 @@ namespace Jackett.Common.Indexers
var temp = release.Title; var temp = release.Title;
// releasedata everithing after Name.S0Xe0X // releasedata everithing after Name.S0Xe0X
String releasedata =release.Title.Split(new[] { seasonep }, StringSplitOptions.None)[1].Trim(); String releasedata = release.Title.Split(new[] { seasonep }, StringSplitOptions.None)[1].Trim();
/* if the release name not contains the language we add it because it is know from category */ /* if the release name not contains the language we add it because it is know from category */
if (cat.Contains("hun") && !releasedata.Contains("hun")) if (cat.Contains("hun") && !releasedata.Contains("hun"))
releasedata += ".hun"; releasedata += ".hun";
// release description contains [imdb: ****] but we only need the data before it for title // release description contains [imdb: ****] but we only need the data before it for title
String[] description = {release.Description, ""}; String[] description = { release.Description, "" };
if (release.Description.Contains("[imdb:")) if (release.Description.Contains("[imdb:"))
{ {
description = release.Description.Split('['); description = release.Description.Split('[');
@@ -203,16 +204,21 @@ namespace Jackett.Common.Indexers
// if search is done for S0X than we dont want to put . between S0X and E0X // if search is done for S0X than we dont want to put . between S0X and E0X
Match match = Regex.Match(releasedata, @"^E\d\d?"); Match match = Regex.Match(releasedata, @"^E\d\d?");
if (seasonep.Length==3 && match.Success) if (seasonep.Length == 3 && match.Success)
release.Title = (description[0].Trim() + "." + seasonep.Trim() + releasedata.Trim('.')).Replace(' ', '.'); release.Title = (description[0].Trim() + "." + seasonep.Trim() + releasedata.Trim('.')).Replace(' ', '.');
// add back imdb points to the description [imdb: 8.7] // add back imdb points to the description [imdb: 8.7]
release.Description = temp+" "+ description[1]; release.Description = temp + " " + description[1];
release.Description = release.Description.Trim(); release.Description = release.Description.Trim();
releases.Add(release); releases.Add(release);
} }
} }
}
catch (FormatException ex)
{
logger.Error("Problem of parsing Torrent:" + rows[i].InnerHTML);
logger.Error("Exception was the following:" + ex);
}
} }
} }
catch (Exception ex) catch (Exception ex)