mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 11:56:29 +00:00
big refactoring. get rid of static properties and coupled architecture. prepare system for integration tests
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using System.IO;
|
||||
using Azaion.Common.Database;
|
||||
using Azaion.Common.DTO;
|
||||
|
||||
namespace Azaion.Common.Services;
|
||||
|
||||
public class AnnotationPathResolver : IAnnotationPathResolver
|
||||
{
|
||||
private readonly string _labelsDir;
|
||||
private readonly string _imagesDir;
|
||||
private readonly string _thumbDir;
|
||||
|
||||
public AnnotationPathResolver(DirectoriesConfig config)
|
||||
{
|
||||
_labelsDir = config.LabelsDirectory;
|
||||
_imagesDir = config.ImagesDirectory;
|
||||
_thumbDir = config.ThumbnailsDirectory;
|
||||
}
|
||||
|
||||
public string GetImagePath(Annotation annotation) =>
|
||||
Path.Combine(_imagesDir, $"{annotation.Name}{annotation.ImageExtension}");
|
||||
|
||||
public string GetLabelPath(Annotation annotation) =>
|
||||
Path.Combine(_labelsDir, $"{annotation.Name}.txt");
|
||||
|
||||
public string GetThumbPath(Annotation annotation) =>
|
||||
Path.Combine(_thumbDir, $"{annotation.Name}{Constants.THUMBNAIL_PREFIX}.jpg");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user