mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-14 22:32:19 +01:00
support dvd without video_ts folder
This commit is contained in:
@@ -212,6 +212,20 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public virtual string FileNameWithoutExtension
|
||||
{
|
||||
get
|
||||
{
|
||||
if (LocationType == LocationType.FileSystem)
|
||||
{
|
||||
return System.IO.Path.GetFileNameWithoutExtension(Path);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is just a helper for convenience
|
||||
/// </summary>
|
||||
|
||||
@@ -58,6 +58,20 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override string FileNameWithoutExtension
|
||||
{
|
||||
get
|
||||
{
|
||||
if (LocationType == LocationType.FileSystem)
|
||||
{
|
||||
return System.IO.Path.GetFileName(Path);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance is physical root.
|
||||
/// </summary>
|
||||
|
||||
@@ -21,6 +21,12 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <value>The path.</value>
|
||||
string Path { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the file name without extension.
|
||||
/// </summary>
|
||||
/// <value>The file name without extension.</value>
|
||||
string FileNameWithoutExtension { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the identifier.
|
||||
/// </summary>
|
||||
|
||||
@@ -158,6 +158,22 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||
ProductionYear = yearInName;
|
||||
hasChanges = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Try to get the year from the folder name
|
||||
if (!IsInMixedFolder)
|
||||
{
|
||||
info = LibraryManager.ParseName(System.IO.Path.GetFileName(ContainingFolderPath));
|
||||
|
||||
yearInName = info.Year;
|
||||
|
||||
if (yearInName.HasValue)
|
||||
{
|
||||
ProductionYear = yearInName;
|
||||
hasChanges = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return hasChanges;
|
||||
|
||||
@@ -89,5 +89,41 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
return GetItemLookupInfo<MusicVideoInfo>();
|
||||
}
|
||||
|
||||
public override bool BeforeMetadataRefresh()
|
||||
{
|
||||
var hasChanges = base.BeforeMetadataRefresh();
|
||||
|
||||
if (!ProductionYear.HasValue)
|
||||
{
|
||||
var info = LibraryManager.ParseName(Name);
|
||||
|
||||
var yearInName = info.Year;
|
||||
|
||||
if (yearInName.HasValue)
|
||||
{
|
||||
ProductionYear = yearInName;
|
||||
hasChanges = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Try to get the year from the folder name
|
||||
if (!IsInMixedFolder)
|
||||
{
|
||||
info = LibraryManager.ParseName(System.IO.Path.GetFileName(ContainingFolderPath));
|
||||
|
||||
yearInName = info.Year;
|
||||
|
||||
if (yearInName.HasValue)
|
||||
{
|
||||
ProductionYear = yearInName;
|
||||
hasChanges = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return hasChanges;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -236,6 +235,25 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override string FileNameWithoutExtension
|
||||
{
|
||||
get
|
||||
{
|
||||
if (LocationType == LocationType.FileSystem)
|
||||
{
|
||||
if (VideoType == VideoType.BluRay || VideoType == VideoType.Dvd || VideoType == VideoType.HdDvd)
|
||||
{
|
||||
return System.IO.Path.GetFileName(Path);
|
||||
}
|
||||
|
||||
return System.IO.Path.GetFileNameWithoutExtension(Path);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
internal override bool IsValidFromResolver(BaseItem newItem)
|
||||
{
|
||||
var current = this;
|
||||
|
||||
@@ -1340,6 +1340,12 @@ namespace MediaBrowser.Controller.Providers
|
||||
}
|
||||
}
|
||||
|
||||
// This is valid
|
||||
if (!string.IsNullOrWhiteSpace(linkedItem.Path))
|
||||
{
|
||||
return linkedItem;
|
||||
}
|
||||
|
||||
return string.IsNullOrWhiteSpace(linkedItem.ItemName) || string.IsNullOrWhiteSpace(linkedItem.ItemType) ? null : linkedItem;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user