예제 #1
0
 public async Task <Stream> RequestThumbnailAsync(Apiv1Api api, MediaObjectDescriptor objectDescriptor, MediaSegmentDescriptor segmentDescriptor)
 {
     if (UseCineastServer)
     {
         return(await api.ApiV1GetThumbnailsIdGetAsync(objectDescriptor.ObjectId));
     }
     if (HostBaseUrl == null)
     {
         throw new InvalidOperationException("HostBaseUrl is null");
     }
     return(await httpClient.GetStreamAsync(HostBaseUrl + CompletePath(HostThumbnailsPath, objectDescriptor, segmentDescriptor)));
 }
예제 #2
0
        private string CompletePath(string path, MediaObjectDescriptor objectDescriptor, MediaSegmentDescriptor segmentDescriptor)
        {
            string suffix = DefaultSuffix;

            if (objectDescriptor.Mediatype.HasValue)
            {
                if (!suffices.TryGetValue(objectDescriptor.Mediatype.Value, out suffix))
                {
                    suffix = DefaultSuffix;
                }
            }

            //Same as in vitrivr-ng: https://github.com/vitrivr/vitrivr-ng/blob/master/src/app/core/basics/resolver.service.ts
            path = path.Replace(":o", objectDescriptor.ObjectId);
            path = path.Replace(":n", objectDescriptor.Name);
            path = path.Replace(":p", objectDescriptor.Path);
            path = path.Replace(":t", Enum.GetName(typeof(MediaObjectDescriptor.MediatypeEnum), objectDescriptor.Mediatype).ToLower());
            path = path.Replace(":T", Enum.GetName(typeof(MediaObjectDescriptor.MediatypeEnum), objectDescriptor.Mediatype).ToUpper());
            path = path.Replace(":s", segmentDescriptor.SegmentId);
            path = path.Replace(":x", "." + suffix);

            return(path);
        }
예제 #3
0
 public void OnFullQueryResult(StringDoublePair entry, MediaSegmentDescriptor segmentDescriptor, MediaObjectDescriptor objectDescriptor, string objModel)
 {
     results.Add(new QueryResult
     {
         score             = entry.Value.Value,
         segmentDescriptor = segmentDescriptor,
         objectDescriptor  = objectDescriptor,
         objModel          = objModel
     });
 }
            public void OnFullQueryResult(StringDoublePair entry, MediaSegmentDescriptor segmentDescriptor, MediaObjectDescriptor objectDescriptor, string objModel)
            {
                Console.WriteLine("Downloaded Object: ");

                var lines    = objModel.Split('\n');
                int maxLines = Math.Min(lines.Length, 8);

                for (int i = 0; i < maxLines; i++)
                {
                    Console.WriteLine(lines[i]);
                }
                Console.WriteLine("...");
                Console.WriteLine("---------------------------");
                Console.WriteLine();
            }
예제 #5
0
        public void OnFullQueryResult(StringDoublePair entry, MediaSegmentDescriptor segmentDescriptor, MediaObjectDescriptor objectDescriptor, string objModel)
        {
            Debug.Log("Downloaded Object: ");

            var lines    = objModel.Split('\n');
            int maxLines = Mathf.Min(lines.Length, 8);

            for (int i = 0; i < maxLines; i++)
            {
                Debug.Log(lines[i]);
            }
            Debug.Log("...");
            Debug.Log("---------------------------");
            Debug.Log("");

            if (callback != null)
            {
                callback.OnFullQueryResult(entry, segmentDescriptor, objectDescriptor, objModel);
            }
        }