Exemplo n.º 1
0
        public static List <VideoData> ParseSearch(string jsonSource)
        {
            object json;

            if (!VideoDataParser.ParseJSON(jsonSource, out json))
            {
                Service.Get <StaRTSLogger>().Error("Failed to parse Search JSON");
                return(null);
            }
            Dictionary <string, List <VideoData> > dictionary = new Dictionary <string, List <VideoData> >();

            if (!VideoDataParser.ParseFeed(json, ref dictionary))
            {
                Service.Get <StaRTSLogger>().Error("Failed to parse Search");
                return(null);
            }
            using (Dictionary <string, List <VideoData> > .ValueCollection.Enumerator enumerator = dictionary.Values.GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    return(enumerator.Current);
                }
            }
            return(null);
        }
Exemplo n.º 2
0
        public static List <string> ParseTag(string jsonSource)
        {
            object obj;

            if (!VideoDataParser.ParseJSON(jsonSource, out obj))
            {
                Service.Get <StaRTSLogger>().Error("Failed to parse Tag JSON");
                return(null);
            }
            if (obj == null)
            {
                Service.Get <StaRTSLogger>().Error("Failed to parse jsonSource");
                return(null);
            }
            Dictionary <string, object> dictionary = obj as Dictionary <string, object>;

            if (dictionary == null)
            {
                Service.Get <StaRTSLogger>().ErrorFormat("Invalid structure for Tag - {0}", new object[]
                {
                    obj.GetType().ToString()
                });
                return(null);
            }
            if (!dictionary.ContainsKey("item_groups"))
            {
                Service.Get <StaRTSLogger>().Error("Failed to find Group in Categories");
                return(null);
            }
            List <object> list = dictionary["item_groups"] as List <object>;

            if (list == null)
            {
                Service.Get <StaRTSLogger>().Error("Null Group in Categories");
                return(null);
            }
            List <string> result = new List <string>();

            for (int i = 0; i < list.Count; i++)
            {
                if (!VideoDataParser.ParseTagGroup(list[i], ref result))
                {
                    Service.Get <StaRTSLogger>().ErrorFormat("Failed to parse Category Group {0}", new object[]
                    {
                        i
                    });
                    return(null);
                }
            }
            return(result);
        }
Exemplo n.º 3
0
        public static VideoData ParseDetails(string videoGuid, string jsonSource)
        {
            if (jsonSource == null)
            {
                return(null);
            }
            object json;

            if (!VideoDataParser.ParseJSON(jsonSource, out json))
            {
                Service.Get <StaRTSLogger>().Error("Failed to parse VideoDetails JSON");
                return(null);
            }
            return(new VideoData(videoGuid, json));
        }
Exemplo n.º 4
0
        public static Dictionary <string, List <VideoData> > ParseUserFeed(string jsonSource)
        {
            if (jsonSource == null)
            {
                return(null);
            }
            object json;

            if (!VideoDataParser.ParseJSON(jsonSource, out json))
            {
                Service.Get <StaRTSLogger>().Error("Failed to parse UserFeed JSON");
                return(null);
            }
            Dictionary <string, List <VideoData> > result = new Dictionary <string, List <VideoData> >();

            if (!VideoDataParser.ParseFeed(json, ref result))
            {
                Service.Get <StaRTSLogger>().Error("Failed to parse UserFeed");
                return(null);
            }
            return(result);
        }