Skip to content
Permalink
Browse files

MP1-4954: Change minimal URL length from > 7 to > 10

MP1-4954: Source code cosmetic in Utils.cs
  • Loading branch information...
andrewjswan committed Apr 17, 2019
1 parent 79f3094 commit f23fd2c03d971a05cd8192915e98d9bebf941778
@@ -3349,7 +3349,7 @@ private void RefreshMissingCovers(object sender, DoWorkEventArgs e)
_progressDialog.SetLine1("Downloading cover for: " + movie.Title);

// Skip no thumb URL movie ...
if (string.IsNullOrEmpty(movie.ThumbURL) || movie.ThumbURL.Length <= 7 || (!movie.ThumbURL.StartsWith(@"http://") && !movie.ThumbURL.StartsWith(@"https://")))
if (string.IsNullOrEmpty(movie.ThumbURL) || movie.ThumbURL.Length <= 10 || (!movie.ThumbURL.StartsWith(@"http://") && !movie.ThumbURL.StartsWith(@"https://")))
{
if (_progressDialog.Count < movies.Count - 1)
_progressDialog.Count++;
@@ -3896,7 +3896,7 @@ private void SaveActorInfo()
imdbActor.DateOfDeath = tbDeathDate.Text;
imdbActor.PlaceOfDeath = tbDeathPlace.Text;

if (!string.IsNullOrEmpty(tbThumbLoc.Text) && tbThumbLoc.Text.Length >= 7)
if (!string.IsNullOrEmpty(tbThumbLoc.Text) && tbThumbLoc.Text.Length > 10)
{
bool isUrl = (tbThumbLoc.Text.StartsWith(@"http://") || tbThumbLoc.Text.StartsWith(@"file://") || tbThumbLoc.Text.StartsWith(@"https://"));
if (isUrl)
@@ -86,12 +86,12 @@ public void GetLocalFanart(int movieId, string localFile, int index)

bool isUrl = true;

if (localFile.Length > 7 && localFile.Substring(0, 7).Equals("file://"))
if (localFile.Length > 10 && localFile.StartsWith(@"file://"))
{
localFile = localFile.Replace("file://", "");
isUrl = false;
}
else if (localFile.Length > 7 && !localFile.StartsWith(@"http://") && !localFile.StartsWith(@"https://"))
else if (localFile.Length > 10 && !localFile.StartsWith(@"http://") && !localFile.StartsWith(@"https://"))
{
return;
}
@@ -1769,7 +1769,8 @@ public static bool IsISOImage(string fileName)
{
string extension = Path.GetExtension(fileName).ToLowerInvariant();
// check for "http" to prevent exception
if (string.IsNullOrEmpty(fileName) || fileName.StartsWith("http://") || fileName.StartsWith("https://") || !File.Exists(fileName) || (extension == ".tsbuffer" || extension == ".ts"))
if (string.IsNullOrEmpty(fileName) || fileName.StartsWith("http://") || fileName.StartsWith("https://") ||
!File.Exists(fileName) || (extension == ".tsbuffer" || extension == ".ts"))
return false;

string vDrive = DaemonTools.GetVirtualDrive();
@@ -913,7 +913,7 @@ private void Refresh()
string titleCoverFilename = string.Empty;
string imageExt = string.Empty;

if (!string.IsNullOrEmpty(imageUrl) && imageUrl.Length > 7 && !imageUrl.StartsWith(@"file://") && !imageUrl.StartsWith(@"http://") && !imageUrl.StartsWith(@"https://"))
if (!string.IsNullOrEmpty(imageUrl) && imageUrl.Length > 10 && !imageUrl.StartsWith(@"file://") && !imageUrl.StartsWith(@"http://") && !imageUrl.StartsWith(@"https://"))
{
imageExt = Util.Utils.GetFileExtension(imageUrl);
if ((Util.Utils.IsPicture(imageUrl) || imageExt.ToLowerInvariant() == ".tbn") && File.Exists(imageUrl))
@@ -922,7 +922,7 @@ private void Refresh()
}
}

if (!string.IsNullOrEmpty(imageUrl) && imageUrl.Length > 7 && (imageUrl.StartsWith(@"file://") || imageUrl.StartsWith(@"http://") || imageUrl.StartsWith(@"https://")))
if (!string.IsNullOrEmpty(imageUrl) && imageUrl.Length > 10 && (imageUrl.StartsWith(@"file://") || imageUrl.StartsWith(@"http://") || imageUrl.StartsWith(@"https://")))
{
// Set cover thumb filename (movieTitle{movieId})
titleCoverFilename = _currentMovie.Title + "{" + _currentMovie.ID + "}";
@@ -1699,8 +1699,8 @@ private void OnFanartRefresh()
// Cover refresh
private void OnCoverRefresh()
{
if (string.IsNullOrEmpty(_currentMovie.ThumbURL) || _currentMovie.ThumbURL.Length <= 7 ||
(_currentMovie.ThumbURL.Length > 7 && !_currentMovie.ThumbURL.StartsWith(@"http://") && !_currentMovie.ThumbURL.StartsWith(@"https://")))
if (string.IsNullOrEmpty(_currentMovie.ThumbURL) || _currentMovie.ThumbURL.Length <= 10 ||
(_currentMovie.ThumbURL.Length > 10 && !_currentMovie.ThumbURL.StartsWith(@"http://") && !_currentMovie.ThumbURL.StartsWith(@"https://")))
{
return;
}

0 comments on commit f23fd2c

Please sign in to comment.
You can’t perform that action at this time.