chore: catch errors on FormatDescription
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
@@ -40,6 +41,8 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Utilities
|
|||||||
/// <param name="description">String to format.</param>
|
/// <param name="description">String to format.</param>
|
||||||
/// <returns>A string with \n replaced by br tags.</returns>
|
/// <returns>A string with \n replaced by br tags.</returns>
|
||||||
public static string FormatDescription(string description)
|
public static string FormatDescription(string description)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
var maxLength = 500;
|
var maxLength = 500;
|
||||||
if (Plugin.Instance != null)
|
if (Plugin.Instance != null)
|
||||||
@@ -50,11 +53,17 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Utilities
|
|||||||
if (description.Length > maxLength)
|
if (description.Length > maxLength)
|
||||||
{
|
{
|
||||||
description = description.Substring(0, maxLength);
|
description = description.Substring(0, maxLength);
|
||||||
description = description.Replace("\n", "<br>", System.StringComparison.CurrentCulture);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
description = description.Replace("\n", "<br>", System.StringComparison.CurrentCulture);
|
||||||
|
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return "Error getting description";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get video name from file path on the disk.
|
/// Get video name from file path on the disk.
|
||||||
|
|||||||
Reference in New Issue
Block a user