Skip to content

Commit

Permalink
Renamed Metadata variables to be more backwards compatible.
Browse files Browse the repository at this point in the history
  • Loading branch information
Spiess committed Oct 26, 2021
1 parent b78d67b commit fd3dec4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ public class ObjectData
/// </summary>
private List<SegmentData> _segments;

public ObjectMetadataStore ObjectMetadata { get; private set; }
public ObjectMetadataStore Metadata { get; private set; }

/// <summary>
/// Constructs a new instance with the given id, for lazy loading.
/// </summary>
public ObjectData(string id)
{
_id = id;
ObjectMetadata = new ObjectMetadataStore(_id);
Metadata = new ObjectMetadataStore(_id);
}

/// <summary>
Expand All @@ -48,7 +48,7 @@ public ObjectData(string id)
public ObjectData(MediaObjectDescriptor descriptor)
{
_id = descriptor.ObjectId;
ObjectMetadata = new ObjectMetadataStore(_id);
Metadata = new ObjectMetadataStore(_id);
Initialize(descriptor);
}

Expand Down Expand Up @@ -89,7 +89,7 @@ private async Task InitializeAsync(bool withMetadata = true)

if (withMetadata)
{
await ObjectMetadata.InitializeAsync();
await Metadata.InitializeAsync();
}
}
finally
Expand Down Expand Up @@ -122,14 +122,14 @@ public void Initialize(MediaObjectDescriptor descriptor)

public void InitializeMeta(MediaObjectMetadataQueryResult meta)
{
if (ObjectMetadata.Initialized)
if (Metadata.Initialized)
{
Debug.LogWarning("Attempt to initialize already initialized object metadata for media object with id " +
$"\"{Id}\". Using cached data.");
return;
}

ObjectMetadata.Initialize(meta);
Metadata.Initialize(meta);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@ public class SegmentData
// TODO: Consider combining lazy loading requests into batch requests every x seconds to reduce request overhead
private static readonly SemaphoreSlim InitLock = new SemaphoreSlim(1, 1);

public SegmentMetadataStore SegmentMetadata { get; private set; }
public SegmentMetadataStore Metadata { get; private set; }


public SegmentData(string id)
{
_id = id;
SegmentMetadata = new SegmentMetadataStore(_id);
Metadata = new SegmentMetadataStore(_id);
}

public SegmentData(MediaSegmentDescriptor descriptor)
{
_descriptor = descriptor;
_id = descriptor.SegmentId;
SegmentMetadata = new SegmentMetadataStore(_id);
Metadata = new SegmentMetadataStore(_id);
Initialized = true;
}

Expand Down Expand Up @@ -70,7 +70,7 @@ private async Task InitializeAsync(bool withMetadata = true)

if (withMetadata)
{
await SegmentMetadata.InitializeAsync();
await Metadata.InitializeAsync();
}
}
finally
Expand Down Expand Up @@ -105,14 +105,14 @@ public void Initialize(MediaSegmentDescriptor data)

public void InitializeMeta(MediaSegmentMetadataQueryResult meta)
{
if (SegmentMetadata.Initialized)
if (Metadata.Initialized)
{
Debug.LogWarning("Attempt to initialize already initialized segment metadata for media object with " +
$"id \"{Id}\". Using cached data.");
return;
}

SegmentMetadata.Initialize(meta);
Metadata.Initialize(meta);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ public static async Task BatchFetchObjectDataWithMeta(List<ObjectData> objects)

public static async Task BatchFetchObjectMetadata(IEnumerable<ObjectData> objects)
{
var toInitObj = objects.Where(obj => !obj.ObjectMetadata.Initialized).ToList();
var toInitObj = objects.Where(obj => !obj.Metadata.Initialized).ToList();
var toInit = toInitObj.Select(obj => obj.Id).ToList();
Debug.Log($"Having to initialise {toInit.Count} obj's metadata");
var result = await Task.Run(() =>
CineastWrapper.MetadataApi.FindMetadataForObjectIdBatchedAsync(new OptionallyFilteredIdList(ids: toInit)));
foreach (var obj in toInitObj)
{
obj.ObjectMetadata.Initialize(result);
obj.Metadata.Initialize(result);
}
Debug.Log("Finished fetching obj");
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "org.vitrivr.unityinterface.cineastapi",
"version": "1.0.0-SNAPSHOT",
"version": "0.0.1",
"displayName": "Cineast Unity Interface",
"description": "An all-unity client for [Cineast](https://github.com/vitrivr/cineast/).",
"unity": "2019.4",
Expand Down

0 comments on commit fd3dec4

Please sign in to comment.