Пример #1
0
        /**
         * Creates an object of a given metadataobject and sets the meta data
         *
         * Currently is only lat/lon supported
         *
         * @param meta - the meta data object.
         *
         * */
        public static MultimediaObject ConvertFrom(MetaDataObject meta)
        {
            MultimediaObject output = new MultimediaObject();

            output.id = meta.objectId;
            output.AddMetaData(meta);
            return(output);
        }
Пример #2
0
        public static MultimediaObject ConvertFrom(CineastObject obj)
        {
            MultimediaObject output = new MultimediaObject();

            output.id   = obj.objectId;
            output.name = obj.name;
            output.path = obj.path;
            return(output);
        }
Пример #3
0
        public static List <MultimediaObject> Convert(MetaDataObject[] metas)
        {
            List <MultimediaObject> objects = new List <MultimediaObject>();

            foreach (MetaDataObject meta in metas)
            {
                MultimediaObject obj = ConvertFrom(meta);
                if (objects.Contains(obj))
                {
                    objects.Find(o => o.Equals(obj)).Merge(obj);
                }
                else
                {
                    objects.Add(obj);
                }
            }

            return(objects);
        }
Пример #4
0
        public static List <MultimediaObject> Convert(CineastObject[] objects)
        {
            List <MultimediaObject> list = new List <MultimediaObject>();

            foreach (CineastObject obj in objects)
            {
                MultimediaObject mmo = ConvertFrom(obj);
                if (list.Contains(mmo))
                {
                    list.Find(o => o.Equals(mmo)).Merge(mmo);
                }
                else
                {
                    list.Add(mmo);
                }
            }

            return(list);
        }
Пример #5
0
 /**
  * -1 == empty similar result
  * -2 == empty result object
  * -3 == not found
  */
 public static int GetIndexOf(MultimediaObject needle, SimilarResult haystack)
 {
     if (haystack.IsEmpty())
     {
         return(-1);
     }
     foreach (ResultObject resultObject in haystack.results)
     {
         if (resultObject.IsEmpty())
         {
             return(-2);
         }
         foreach (ContentObject contentObject in resultObject.content)
         {
             if (contentObject.key.Equals(needle.id + "_1"))// FIX hardcoded segment id
             {
                 return(Array.IndexOf(resultObject.content, contentObject));
             }
         }
     }
     return(-3);
 }
Пример #6
0
 public static string GetThumbnailUrl(MultimediaObject mmo)
 {
     return(Configuration.imagesHost + "thumbnails/" + mmo.id + "/" + mmo.id + "_1.png");
 }
Пример #7
0
 public static string GetImageUrl(MultimediaObject mmo)
 {
     return(Configuration.imagesHost + "/images/" + mmo.path);
 }
Пример #8
0
 private int Comparison(MultimediaObject mmo1, MultimediaObject mmo2)
 {
     return(mmo1.resultIndex - mmo2.resultIndex);
 }