mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
fixes #629 - Deleting a movie only deletes the video file
This commit is contained in:
parent
e191836ea0
commit
7ac2f74817
@ -465,13 +465,16 @@ namespace MediaBrowser.Api
|
|||||||
|
|
||||||
if (item.LocationType == LocationType.FileSystem)
|
if (item.LocationType == LocationType.FileSystem)
|
||||||
{
|
{
|
||||||
if (Directory.Exists(item.Path))
|
foreach (var path in item.GetDeletePaths().ToList())
|
||||||
{
|
{
|
||||||
Directory.Delete(item.Path, true);
|
if (Directory.Exists(path))
|
||||||
}
|
{
|
||||||
else if (File.Exists(item.Path))
|
Directory.Delete(path, true);
|
||||||
{
|
}
|
||||||
File.Delete(item.Path);
|
else if (File.Exists(path))
|
||||||
|
{
|
||||||
|
File.Delete(path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parent != null)
|
if (parent != null)
|
||||||
|
@ -1765,5 +1765,14 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
// See if we can avoid a file system lookup by looking for the file in ResolveArgs
|
// See if we can avoid a file system lookup by looking for the file in ResolveArgs
|
||||||
return metaFileEntry == null ? FileSystem.GetLastWriteTimeUtc(imagePath) : FileSystem.GetLastWriteTimeUtc(metaFileEntry);
|
return metaFileEntry == null ? FileSystem.GetLastWriteTimeUtc(imagePath) : FileSystem.GetLastWriteTimeUtc(metaFileEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the file system path to delete when the item is to be deleted
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual IEnumerable<string> GetDeletePaths()
|
||||||
|
{
|
||||||
|
return new[] { Path };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
public class Game : BaseItem, IHasSoundtracks
|
public class Game : BaseItem, IHasSoundtracks
|
||||||
{
|
{
|
||||||
public List<Guid> SoundtrackIds { get; set; }
|
public List<Guid> SoundtrackIds { get; set; }
|
||||||
|
|
||||||
public Game()
|
public Game()
|
||||||
{
|
{
|
||||||
MultiPartGameFiles = new List<string>();
|
MultiPartGameFiles = new List<string>();
|
||||||
@ -84,5 +84,15 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
}
|
}
|
||||||
return base.GetUserDataKey();
|
return base.GetUserDataKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override IEnumerable<string> GetDeletePaths()
|
||||||
|
{
|
||||||
|
if (!IsInMixedFolder)
|
||||||
|
{
|
||||||
|
return new[] { System.IO.Path.GetDirectoryName(Path) };
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.GetDeletePaths();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -248,5 +248,10 @@ namespace MediaBrowser.Controller.Entities.TV
|
|||||||
{
|
{
|
||||||
get { return LocationType == Model.Entities.LocationType.Virtual && IsUnaired; }
|
get { return LocationType == Model.Entities.LocationType.Virtual && IsUnaired; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override IEnumerable<string> GetDeletePaths()
|
||||||
|
{
|
||||||
|
return new[] { Path };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -258,5 +258,14 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override IEnumerable<string> GetDeletePaths()
|
||||||
|
{
|
||||||
|
if (!IsInMixedFolder)
|
||||||
|
{
|
||||||
|
return new[] { System.IO.Path.GetDirectoryName(Path) };
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.GetDeletePaths();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user