Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Webreaper committed Nov 23, 2021
2 parents 2156a13 + f199e0b commit 90bc6d1
Show file tree
Hide file tree
Showing 25 changed files with 1,506 additions and 211 deletions.
Binary file modified .DS_Store
Binary file not shown.
3 changes: 2 additions & 1 deletion Damselfly.Core.ImageProcessing/ImageMagickProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public ImageMagickProcessor()
private void CheckToolStatus()
{
ProcessStarter improcess = new ProcessStarter();
imAvailable = improcess.StartProcess("convert", "--version");
imAvailable = improcess.StartProcess(imageMagickExe, "--version");

if (imAvailable)
{
Expand Down Expand Up @@ -164,6 +164,7 @@ public async Task<ImageProcessResult> CreateThumbs(FileInfo source, IDictionary<
catch (Exception ex)
{
Logging.LogError("Conversion failed. Unable to start process: {0}", ex.Message);
Logging.LogError($"Failed commandline was: {exeToUse} {args}");
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion Damselfly.Core.ImageProcessing/SkiaSharpProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Damselfly.Core.ImageProcessing
public class SkiaSharpProcessor : IImageProcessor
{
// SkiaSharp doesn't handle .heic files... yet
private static readonly string[] s_imageExtensions = { ".jpg", ".jpeg", ".png", /*".heic", */".webp", ".bmp", ".dng", ".cr2" };
private static readonly string[] s_imageExtensions = { ".jpg", ".jpeg", ".png", /*".heic", */".webp", ".bmp", ".dng", ".cr2", ".orf", ".nef"};

public static ICollection<string> SupportedFileExtensions { get { return s_imageExtensions; } }

Expand Down
4 changes: 2 additions & 2 deletions Damselfly.Core.Utils/Damselfly.Core.Utils.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<ItemGroup>
<PackageReference Include="Serilog" Version="2.11.0-dev-01371" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.1-dev-00947" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1-dev-00879" />
<PackageReference Include="Humanizer" Version="2.11.10" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
<PackageReference Include="Humanizer" Version="2.13.14" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
1 change: 1 addition & 0 deletions Damselfly.Core.Utils/Utils/ProcessStarter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public bool StartProcess(string exe, string args, IDictionary<string,string> env
process.StartInfo.RedirectStandardError = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;

if (envVars != null)
{
Expand Down
2 changes: 1 addition & 1 deletion Damselfly.Core/Damselfly.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.0" />
<PackageReference Include="SendGrid" Version="9.24.4" />
<PackageReference Include="SendGrid" Version="9.25.0" />
<PackageReference Include="MailKit" Version="3.0.0-preview1" />
<PackageReference Include="runtime.osx.10.10-x64.CoreCompat.System.Drawing" Version="6.0.5.128" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.EntityFrameworkCore" Version="6.0.0" />
Expand Down
4 changes: 3 additions & 1 deletion Damselfly.Core/Models/ImageContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ public class ImageMetaData
public virtual Image Image { get; set; }
public int ImageId { get; set; }

public DateTime DateTaken { get; set; }
public int Width { get; set; }
public int Height { get; set; }
public int Rating { get; set; } // 1-5, stars
Expand All @@ -221,7 +222,8 @@ public class ImageMetaData
public string FNum { get; set; }
public string Exposure { get; set; }
public bool FlashFired { get; set; }
public DateTime DateTaken { get; set; }
public double? Latitude { get; set; }
public double? Longitude { get; set; }

public int? CameraId { get; set; }
public virtual Camera Camera { get; set; }
Expand Down
3 changes: 3 additions & 0 deletions Damselfly.Core/ScopedServices/ViewDataService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class SideBarState
{
public bool ShowFolderList { get; set; } = false;
public bool ShowTags { get; set; } = false;
public bool ShowMap { get; set; } = false;
public bool ShowBasket { get; set; } = false;
public bool ShowExport { get; set; } = false;
public bool ShowImageProps { get; set; } = false;
Expand All @@ -28,6 +29,7 @@ public override bool Equals(object obj)
return ShowBasket == other.ShowBasket &&
ShowFolderList == other.ShowFolderList &&
ShowExport == other.ShowExport &&
ShowMap == other.ShowMap &&
ShowTags == other.ShowTags &&
ShowImageProps == other.ShowImageProps;
}
Expand All @@ -54,6 +56,7 @@ public void SetSideBarState(SideBarState state)

public bool ShowFolderList { get => sidebarState.ShowFolderList; }
public bool ShowTags { get => sidebarState.ShowTags; }
public bool ShowMap { get => sidebarState.ShowMap; }
public bool ShowBasket { get => sidebarState.ShowBasket; }
public bool ShowExport { get => sidebarState.ShowExport; }
public bool ShowImageProps { get => sidebarState.ShowImageProps; }
Expand Down
36 changes: 28 additions & 8 deletions Damselfly.Core/Services/MetaDataService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ public void StartService()
/// </summary>
/// <param name="image">Image object, which will be updated with metadata</param>
/// <param name="keywords">Array of keyword tags in the image EXIF data</param>
private void GetImageMetaData(ref ImageMetaData imgMetaData, out string[] keywords)
private bool GetImageMetaData(ref ImageMetaData imgMetaData, out string[] keywords)
{
bool metaDataReadSuccess = false;
var image = imgMetaData.Image;
keywords = new string[0];

Expand All @@ -107,6 +108,8 @@ private void GetImageMetaData(ref ImageMetaData imgMetaData, out string[] keywor

if (metadata != null)
{
metaDataReadSuccess = true;

var jpegDirectory = metadata.OfType<JpegDirectory>().FirstOrDefault();

if (jpegDirectory != null)
Expand Down Expand Up @@ -171,6 +174,19 @@ private void GetImageMetaData(ref ImageMetaData imgMetaData, out string[] keywor
imgMetaData.FlashFired = ((flash & 0x1) != 0x0);
}

var gpsDirectory = metadata.OfType<GpsDirectory>().FirstOrDefault();

if (gpsDirectory != null)
{
var location = gpsDirectory.GetGeoLocation();

if (location != null)
{
imgMetaData.Longitude = location.Longitude;
imgMetaData.Latitude = location.Latitude;
}
}

var IPTCdir = metadata.OfType<IptcDirectory>().FirstOrDefault();

if (IPTCdir != null)
Expand Down Expand Up @@ -230,7 +246,10 @@ private void GetImageMetaData(ref ImageMetaData imgMetaData, out string[] keywor
catch (Exception ex)
{
Logging.Log("Error reading image metadata for {0}: {1}", image.FullPath, ex.Message);
metaDataReadSuccess = false;
}

return metaDataReadSuccess;
}

private string FilteredDescription(string desc)
Expand Down Expand Up @@ -289,16 +308,17 @@ public async Task ScanMetaData( int imageId )
else
db.ImageMetaData.Update(imgMetaData);

// Scan the image from the
GetImageMetaData(ref imgMetaData, out var exifKeywords);

// Update the timestamp
// Update the timestamp regardless of whether we succeeded to read the metadata
imgMetaData.LastUpdated = updateTimeStamp;

// Scan for sidecar files
sideCarTags = GetSideCarKeywords(img, exifKeywords, writeSideCarTagsToImages);
// Scan the image from the
if (GetImageMetaData(ref imgMetaData, out var exifKeywords))
{
// Scan for sidecar files
sideCarTags = GetSideCarKeywords(img, exifKeywords, writeSideCarTagsToImages);

imageKeywords = sideCarTags.Union(exifKeywords, StringComparer.OrdinalIgnoreCase).ToList();
imageKeywords = sideCarTags.Union(exifKeywords, StringComparer.OrdinalIgnoreCase).ToList();
}

if (imgMetaData.DateTaken != img.SortDate)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.0" />
<PackageReference Include="Z.EntityFramework.Plus.EFCore" Version="6.13.0" />
<PackageReference Include="Z.EntityFramework.Plus.EFCore" Version="6.13.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<ProjectReference Include="..\Damselfly.Core.DbModels\Damselfly.Core.DbModels.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="EFCore.BulkExtensions" Version="6.0.2" />
<PackageReference Include="Z.EntityFramework.Plus.EFCore" Version="6.13.0" />
<PackageReference Include="EFCore.BulkExtensions" Version="6.0.4" />
<PackageReference Include="Z.EntityFramework.Plus.EFCore" Version="6.13.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
Loading

0 comments on commit 90bc6d1

Please sign in to comment.