consolidate knowledge of movie xml file name

pull/702/head
Luke Pulverenti 11 years ago
parent 58afe5dd41
commit 5e00f9f059

@ -192,8 +192,6 @@ namespace MediaBrowser.Providers.Movies
new Regex(@"(?<name>.*)") // last resort matches the whole string as the name
};
public const string AltMetaFileName = "movie.xml";
protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
{
if (HasAltMeta(item))
@ -236,7 +234,10 @@ namespace MediaBrowser.Providers.Movies
{
return item.LocationType == LocationType.FileSystem && item.ResolveArgs.ContainsMetaFileByName("collection.xml");
}
return item.LocationType == LocationType.FileSystem && item.ResolveArgs.ContainsMetaFileByName(AltMetaFileName);
var xmlFileName = MovieProviderFromXml.GetXmlFilename(item);
return item.LocationType == LocationType.FileSystem && item.ResolveArgs.ContainsMetaFileByName(xmlFileName);
}
/// <summary>

@ -52,6 +52,13 @@ namespace MediaBrowser.Providers.Movies
get { return MetadataProviderPriority.First; }
}
internal static string GetXmlFilename(BaseItem item)
{
var filename = "movie.xml";
return Path.Combine(item.MetaLocation, filename);
}
/// <summary>
/// Override this to return the date that should be compared to the last refresh date
/// to determine if this provider should be re-fetched.
@ -60,7 +67,7 @@ namespace MediaBrowser.Providers.Movies
/// <returns>DateTime.</returns>
protected override DateTime CompareDate(BaseItem item)
{
var entry = item.ResolveArgs.GetMetaFileByPath(Path.Combine(item.MetaLocation, "movie.xml"));
var entry = item.ResolveArgs.GetMetaFileByPath(Path.Combine(item.MetaLocation, GetXmlFilename(item)));
return entry != null ? entry.LastWriteTimeUtc : DateTime.MinValue;
}
@ -86,7 +93,7 @@ namespace MediaBrowser.Providers.Movies
{
cancellationToken.ThrowIfCancellationRequested();
var metadataFile = item.ResolveArgs.GetMetaFileByPath(Path.Combine(item.MetaLocation, "movie.xml"));
var metadataFile = item.ResolveArgs.GetMetaFileByPath(Path.Combine(item.MetaLocation, GetXmlFilename(item)));
if (metadataFile != null)
{

@ -119,11 +119,14 @@ namespace MediaBrowser.Providers.Savers
public string GetSavePath(BaseItem item)
{
var video = (Video)item;
if (item.IsInMixedFolder)
{
return Path.ChangeExtension(item.Path, ".xml");
}
var filename = MovieProviderFromXml.GetXmlFilename(item);
return video.IsInMixedFolder ?
Path.ChangeExtension(item.Path, ".xml") :
Path.Combine(item.MetaLocation, "movie.xml");
return Path.Combine(item.MetaLocation, filename);
}
}
}

Loading…
Cancel
Save