-
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.
uploaded item old foreign keys dropped
- Loading branch information
1 parent
774a339
commit 7d0d778
Showing
8 changed files
with
935 additions
and
63 deletions.
There are no files selected for viewing
12 changes: 3 additions & 9 deletions
12
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 |
---|---|---|
@@ -1,22 +1,16 @@ | ||
using System.Globalization; | ||
using ExifLibrary; | ||
using OneShelf.Common; | ||
using ExifLibrary; | ||
|
||
namespace OneShelf.Videos.BusinessLogic.Services; | ||
|
||
public class ExifService | ||
{ | ||
public async Task<DateTime> SetExifTimestamp(string path, string tempFileName) | ||
public async Task 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)) throw new($"The image contains a datetime, {path}."); | ||
|
||
var dateTime = DateTime.ParseExact(Path.GetFileNameWithoutExtension(path).SelectSingle(x => x.Substring(x.IndexOf('@') + 1)), "dd-MM-yyyy_HH-mm-ss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal); | ||
|
||
image.Properties.Set(ExifTag.DateTime, dateTime); | ||
image.Properties.Set(ExifTag.DateTime, timestamp); | ||
await image.SaveAsync(tempFileName); | ||
|
||
return dateTime; | ||
} | ||
} |
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
Oops, something went wrong.