コード例 #1
0
        public static Dictionary <String, IList <Movie> > BuildMedia(Context ctx, string url)
        {
            if (null != MovieList)
            {
                return(MovieList);
            }
            MovieList = new Dictionary <String, IList <Movie> >();

            var    movies = new VideoProvider().ParseURL(url);
            string title, videoUrl, bgImageUrl, cardImageUrl, studio = "";
            var    category_name = "Movies";
            var    categoryList  = new List <Movie>();

            foreach (var movie in movies)
            {
                string description = "this is a video";
                title        = movie.Title;
                videoUrl     = movie.VideoUrl;
                bgImageUrl   = movie.BackgroundImage.ToString();
                cardImageUrl = movie.CardImage.ToString();
                studio       = "unknown";

                categoryList.Add(BuildMovieInfo(category_name, title, description, studio,
                                                videoUrl, cardImageUrl,
                                                bgImageUrl));
            }
            MovieList.Add(category_name, categoryList);

            return(MovieList);
        }
コード例 #2
0
 public override Java.Lang.Object LoadInBackground()
 {
     try {
         return(Utils.PutDictionary(VideoProvider.BuildMedia(mContext, mUrl)));
     } catch (Exception e) {
         Log.Error(TAG, "Failed to catch media data", e);
         return(null);
     }
 }
コード例 #3
0
        public static Dictionary <String, IList <Movie> > BuildMedia(Context ctx, string url)
        {
            if (null != MovieList)
            {
                return(MovieList);
            }
            MovieList = new  Dictionary <String, IList <Movie> > ();

            JsonObject jsonObj    = new VideoProvider().ParseURL(url);
            JsonArray  categories = (JsonArray)jsonObj [TAG_GOOGLE_VIDEOS];

            if (null != categories)
            {
                Log.Debug(TAG, "category #: " + categories.Count);
                string title, videoUrl, bgImageUrl, cardImageUrl, studio = "";
                int    count = 0;
                foreach (JsonObject category in categories)
                {
                    var category_name = category [TAG_CATEGORY].ToString().Replace("\"", "");
                    var videos        = (JsonArray)category [TAG_MEDIA];
                    Log.Debug(TAG,
                              "category: " + (count++) + " Name: " + category_name + " video length: "
                              + videos.Count);
                    var categoryList = new List <Movie> ();
                    if (null != videos)
                    {
                        foreach (JsonObject video in videos)
                        {
                            string    description = video [TAG_DESCRIPTION].ToString();
                            JsonArray videoUrls   = (JsonArray)video [TAG_SOURCES];
                            if (null == videoUrls || videoUrls.Count == 0)
                            {
                                continue;
                            }
                            title      = video [TAG_TITLE];
                            videoUrl   = GetVideoPrefix(category_name, videoUrls [0]);
                            bgImageUrl = GetThumbPrefix(category_name, title,
                                                        video [TAG_BACKGROUND].ToString()).ToString();
                            cardImageUrl = GetThumbPrefix(category_name, title,
                                                          video [TAG_CARD_THUMB].ToString()).ToString();
                            studio = video [TAG_STUDIO].ToString();

                            categoryList.Add(BuildMovieInfo(category_name, title, description, studio,
                                                            videoUrl, cardImageUrl,
                                                            bgImageUrl));
                        }
                        MovieList.Add(category_name, categoryList);
                    }
                }
            }
            return(MovieList);
        }
コード例 #4
0
		public static Dictionary<String, IList<Movie>> BuildMedia (Context ctx, string url)
		{
			if (null != MovieList) {
				return MovieList;
			}
			MovieList = new  Dictionary<String, IList<Movie>> ();

			JsonObject jsonObj = new VideoProvider ().ParseURL (url);
			JsonArray categories = (JsonArray)jsonObj [TAG_GOOGLE_VIDEOS];
			if (null != categories) {
				Log.Debug (TAG, "category #: " + categories.Count);
				string title, videoUrl, bgImageUrl, cardImageUrl, studio = "";
				int count = 0;
				foreach (JsonObject category in categories) {
					var category_name = category [TAG_CATEGORY].ToString ().Replace ("\"", "");
					var videos = (JsonArray)category [TAG_MEDIA];
					Log.Debug (TAG,
						"category: " + (count++) + " Name: " + category_name + " video length: "
						+ videos.Count);
					var categoryList = new List<Movie> ();
					if (null != videos) {
						foreach (JsonObject video in videos) {
							string description = video [TAG_DESCRIPTION].ToString ();
							JsonArray videoUrls = (JsonArray)video [TAG_SOURCES];
							if (null == videoUrls || videoUrls.Count == 0) {
								continue;
							}
							title = video [TAG_TITLE];
							videoUrl = GetVideoPrefix (category_name, videoUrls [0]);
							bgImageUrl = GetThumbPrefix (category_name, title,
								video [TAG_BACKGROUND].ToString ()).ToString ();
							cardImageUrl = GetThumbPrefix (category_name, title,
								video [TAG_CARD_THUMB].ToString ()).ToString ();
							studio = video [TAG_STUDIO].ToString ();

							categoryList.Add (BuildMovieInfo (category_name, title, description, studio,
								videoUrl, cardImageUrl,
								bgImageUrl));
						}
						MovieList.Add (category_name, categoryList);
					}
				}
			}
			return MovieList;
		}