better method to obtain the folderName

geogolem 8 years ago
parent e6dfd89300
commit 05a83e4e95

@ -45,6 +45,7 @@ namespace NzbDrone.Api.Movie
public bool Monitored { get; set; }
public MovieStatusType MinimumAvailability { get; set; }
public bool IsAvailable { get; set; }
public string FolderName { get; set; }
public int Runtime { get; set; }
public DateTime? LastInfoSync { get; set; }
@ -135,6 +136,7 @@ namespace NzbDrone.Api.Movie
MinimumAvailability = model.MinimumAvailability,
IsAvailable = model.IsAvailable(),
FolderName = model.FolderName(),
SizeOnDisk = size,

@ -5,6 +5,7 @@ using NzbDrone.Common.Extensions;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.MediaFiles;
using System.IO;
namespace NzbDrone.Core.Tv
{
@ -54,6 +55,11 @@ namespace NzbDrone.Core.Tv
public bool HasFile => MovieFileId > 0;
public string FolderName()
{
return new DirectoryInfo(Path).Name;
}
public bool IsAvailable(int delay = 0)
{
//the below line is what was used before delay was implemented, could still be used for cases when delay==0

@ -137,8 +137,7 @@ module.exports = Marionette.ItemView.extend({
if (rootFolder !== 'noChange') {
var rootFolderPath = RootFolders.get(parseInt(rootFolder, 10));
var currentPath = m.get('path');
var folderName = currentPath.substring(currentPath.lastIndexOf('\\')+1);
var folderName = m.get('folderName');
m.set('path', rootFolderPath.get('path')+ folderName);
}
}

Loading…
Cancel
Save