mirror of
https://github.com/sphildreth/roadie
synced 2024-11-25 13:40:22 +00:00
Fixed to image factories.
This commit is contained in:
parent
31e676392c
commit
718ab4cdc9
9 changed files with 22 additions and 14 deletions
|
@ -322,7 +322,7 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
|
||||
// Always update artist image if artist image is found on an artist rescan
|
||||
var imageFiles = ImageHelper.ImageFilesInFolder(artistFolder);
|
||||
var imageFiles = ImageHelper.ImageFilesInFolder(artistFolder, SearchOption.AllDirectories);
|
||||
if (imageFiles != null && imageFiles.Any())
|
||||
{
|
||||
var imageFile = imageFiles.First();
|
||||
|
|
|
@ -780,7 +780,7 @@ namespace Roadie.Library.Factories
|
|||
|
||||
if (release.Thumbnail == null)
|
||||
{
|
||||
var imageFiles = ImageHelper.ImageFilesInFolder(releasePath);
|
||||
var imageFiles = ImageHelper.ImageFilesInFolder(releasePath, SearchOption.AllDirectories);
|
||||
if (imageFiles != null && imageFiles.Any())
|
||||
{
|
||||
foreach (var imageFile in imageFiles)
|
||||
|
|
|
@ -57,9 +57,9 @@ namespace Roadie.Library.Imaging
|
|||
return new string[6] { "*.bmp", "*.jpeg", "*.jpe", "*.jpg", "*.png", "*.gif" };
|
||||
}
|
||||
|
||||
public static string[] ImageFilesInFolder(string folder)
|
||||
public static string[] ImageFilesInFolder(string folder, SearchOption searchOption)
|
||||
{
|
||||
return ImageHelper.GetFiles(folder, ImageHelper.ImageExtensions(), SearchOption.AllDirectories);
|
||||
return ImageHelper.GetFiles(folder, ImageHelper.ImageExtensions(), searchOption);
|
||||
}
|
||||
|
||||
public static string[] ImageMimeTypes()
|
||||
|
@ -172,17 +172,17 @@ namespace Roadie.Library.Imaging
|
|||
return Regex.IsMatch(fileinfo.Name, @"(label|recordlabel|record_label)\.(jpg|jpeg|png|bmp|gif)", RegexOptions.IgnoreCase);
|
||||
}
|
||||
|
||||
public static IEnumerable<FileInfo> FindImageTypeInDirectory(DirectoryInfo directory, ImageType type)
|
||||
public static IEnumerable<FileInfo> FindImageTypeInDirectory(DirectoryInfo directory, ImageType type, SearchOption folderSearchOptions = SearchOption.AllDirectories)
|
||||
{
|
||||
var result = new List<FileInfo>();
|
||||
if (directory == null || !directory.Exists)
|
||||
{
|
||||
return null;
|
||||
return result;
|
||||
}
|
||||
var imageFilesInFolder = ImageFilesInFolder(directory.FullName);
|
||||
var imageFilesInFolder = ImageFilesInFolder(directory.FullName, folderSearchOptions);
|
||||
if (imageFilesInFolder == null || !imageFilesInFolder.Any())
|
||||
{
|
||||
return null;
|
||||
return result;
|
||||
}
|
||||
foreach(var imageFile in imageFilesInFolder)
|
||||
{
|
||||
|
|
|
@ -334,7 +334,7 @@ namespace Roadie.Api.Services
|
|||
}
|
||||
|
||||
// Always update artist image if artist image is found on an artist rescan
|
||||
var imageFiles = ImageHelper.ImageFilesInFolder(artistFolder);
|
||||
var imageFiles = ImageHelper.ImageFilesInFolder(artistFolder, SearchOption.AllDirectories);
|
||||
if (imageFiles != null && imageFiles.Any())
|
||||
{
|
||||
var imageFile = imageFiles.First();
|
||||
|
@ -732,7 +732,7 @@ namespace Roadie.Api.Services
|
|||
result.Images = this.DbContext.Images.Where(x => x.ArtistId == artist.Id).Select(x => MakeFullsizeImage(x.RoadieId, x.Caption)).ToArray();
|
||||
|
||||
var artistFolder = artist.ArtistFileFolder(this.Configuration, this.Configuration.LibraryFolder);
|
||||
var artistImagesInFolder = ImageHelper.FindImageTypeInDirectory(new DirectoryInfo(artistFolder), ImageType.ArtistSecondary);
|
||||
var artistImagesInFolder = ImageHelper.FindImageTypeInDirectory(new DirectoryInfo(artistFolder), ImageType.ArtistSecondary, SearchOption.TopDirectoryOnly);
|
||||
if (artistImagesInFolder.Any())
|
||||
{
|
||||
result.Images = result.Images.Concat(artistImagesInFolder.Select((x, i) => MakeFullsizeSecondaryImage(id, ImageType.ArtistSecondary, i)));
|
||||
|
|
|
@ -836,7 +836,7 @@ namespace Roadie.Api.Services
|
|||
}
|
||||
var artistFolder = release.Artist.ArtistFileFolder(this.Configuration, this.Configuration.LibraryFolder);
|
||||
var releaseFolder = release.ReleaseFileFolder(artistFolder);
|
||||
var releaseImagesInFolder = ImageHelper.FindImageTypeInDirectory(new DirectoryInfo(releaseFolder), ImageType.ReleaseSecondary);
|
||||
var releaseImagesInFolder = ImageHelper.FindImageTypeInDirectory(new DirectoryInfo(releaseFolder), ImageType.ReleaseSecondary, SearchOption.TopDirectoryOnly);
|
||||
if(releaseImagesInFolder.Any())
|
||||
{
|
||||
result.Images = result.Images.Concat(releaseImagesInFolder.Select((x, i) => MakeFullsizeSecondaryImage(id, ImageType.ReleaseSecondary, i)));
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"Roadie.Api": {
|
||||
"commandName": "Project",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
"ASPNETCORE_ENVIRONMENT": "Production"
|
||||
},
|
||||
"applicationUrl": "http://localhost:5123/"
|
||||
}
|
||||
|
|
|
@ -96,6 +96,10 @@ namespace Roadie.Api
|
|||
mySqlOptions =>
|
||||
{
|
||||
mySqlOptions.ServerVersion(new Version(5, 5), Pomelo.EntityFrameworkCore.MySql.Infrastructure.ServerType.MariaDb);
|
||||
mySqlOptions.EnableRetryOnFailure(
|
||||
maxRetryCount: 10,
|
||||
maxRetryDelay: TimeSpan.FromSeconds(30),
|
||||
errorNumbersToAdd: null);
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -104,6 +108,10 @@ namespace Roadie.Api
|
|||
mySqlOptions =>
|
||||
{
|
||||
mySqlOptions.ServerVersion(new Version(5, 5), Pomelo.EntityFrameworkCore.MySql.Infrastructure.ServerType.MariaDb);
|
||||
mySqlOptions.EnableRetryOnFailure(
|
||||
maxRetryCount: 10,
|
||||
maxRetryDelay: TimeSpan.FromSeconds(30),
|
||||
errorNumbersToAdd: null);
|
||||
}
|
||||
));
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
"Audience": "http://localhost:5500"
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"RoadieDatabaseConnection": "server=voyager;userid=roadie;password=MenAtW0rk668;persistsecurityinfo=True;database=roadie_dev;ConvertZeroDateTime=true"
|
||||
"RoadieDatabaseConnection": "server=voyager;userid=roadie;password=MenAtW0rk668;persistsecurityinfo=True;database=roadie_dev;ConvertZeroDateTime=true;Max Pool Size=200;"
|
||||
},
|
||||
"RoadieSettings": {
|
||||
"SiteName": "Roadie",
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
"Audience": "http://localhost:5500"
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"RoadieDatabaseConnection": "server=voyager;userid=roadie;password=MenAtW0rk668;persistsecurityinfo=True;database=roadie;ConvertZeroDateTime=true"
|
||||
"RoadieDatabaseConnection": "server=voyager;userid=roadie;password=MenAtW0rk668;persistsecurityinfo=True;database=roadie;ConvertZeroDateTime=true;Max Pool Size=200;"
|
||||
},
|
||||
"CORSOrigins": "http://localhost:8080|https://localhost:8080|http://localhost:80|https://localhost:80",
|
||||
"RoadieSettings": {
|
||||
|
|
Loading…
Reference in a new issue