-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from pavel-zhur/feature/photos-instant
Feature/photos instant
- Loading branch information
Showing
103 changed files
with
31,915 additions
and
407 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
OneShelf.Videos/OneShelf.Videos.BusinessLogic/Services/ExifService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using ExifLibrary; | ||
|
||
namespace OneShelf.Videos.BusinessLogic.Services; | ||
|
||
public class ExifService | ||
{ | ||
public async Task<bool> SetExifTimestamp(string path, string tempFileName, DateTime timestamp) | ||
{ | ||
var image = await ImageFile.FromFileAsync(path); | ||
if (image.Errors.Any()) throw new($"Some image errors, {path}."); | ||
if (image.Properties.Contains(ExifTag.DateTime)) | ||
{ | ||
File.Copy(path, tempFileName); | ||
return false; | ||
} | ||
|
||
image.Properties.Set(ExifTag.DateTime, timestamp); | ||
await image.SaveAsync(tempFileName); | ||
|
||
return true; | ||
} | ||
} |
Oops, something went wrong.