コード例 #1
0
        private void SavePic(MySelfie.Scraper.InstagramObject.Datum data, string originalURL, string fileName)
        {
            var azureURL = this.StorePicture(originalURL, fileName);
            var urls = data.images.standard_resolution.url;
            var hashTags = "";

            try
            {
                hashTags = String.Join("|", data.tags.Select(x => x.To<string>()));
            }
            catch
            {

            }

            using (var db = new MySelfieEntities())
            {
                var entity = new Photo();

                entity.Username = data.user.username;
                entity.Text = data.caption.text;
                //entity.SocialCreatedAt = new DateTime(long.Parse(data.created_time));
                entity.SocialCreatedAt = DateTime.UtcNow;
                entity.SocialID = long.Parse(data.caption.id);
                entity.SocialIDstring = data.id;

                entity.HashTags = hashTags;
                entity.Urls = urls;

                entity.Filename = azureURL;
                entity.OriginalURL = originalURL;

                entity.Source = "Instagram";
                entity.HasPhoto = true;
                entity.CreatedAt = DateTime.UtcNow;
                entity.Approved = false;
                entity.Status = "new";
                entity.WallId = this._wallId;

                db.Photos.Add(entity);

                try
                {
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    Logger.Log("SaveTweetPic error: " + ex.ToString());
                }
            }
        }
コード例 #2
0
 public void Add(MySelfie.Scraper.InstagramObject.Datum data)
 {
     this.SavePic(data, data.images.standard_resolution.url, CreateFileName(data.id));
 }
コード例 #3
0
ファイル: InstagramModel.cs プロジェクト: bennygrub/msl
 public InstagramModel(MySelfie.Scraper.InstagramObject.Datum data)
 {
     this.data = data;
 }