Example #1
0
 /*public static int Update(Videos v)
 {
     v.changed = DateTime.Now;
     return UpdateByQuery(String.Format(Q_UPDATE_BY_VIDEO_ID.Replace("\r\n", ""),
              v.authorid, v.title, v.URI, v.description,
             v.thumbnail, v.created, v.changed, v.allow_public, v.statusid,
             v.bcvideoid, v.filename, v.old_URI, v.base_url, v.videoid));
 }*/
 /*([id]
    ,[accountid]
    ,[creationdate]
    ,[enddate]
    ,[flvurl]
    ,[itemstate]
    ,[lastmodified]
    ,[length]
    ,[linktext]
    ,[linkurl]
    ,[longdescription]
    ,[name]
    ,[playstotal]
    ,[playstrailingweek]
    ,[publishdate]
    ,[referenceid]
    ,[shortdescription]
    ,[thumbnailurl]
    ,[videostillurl])*/
 public static int Insert(Videos video)
 {
     return NonQuery(String.Format(Q_INSERT.Replace("\r\n", ""), video.id, video.accountid,
         video.creationdate, video.enddate, video.flvurl, video.itemstate, video.lastmodified,
         video.length, video.linktext, video.linkurl, video.longdescription, video.name, video.playstotal,
         video.playstrailingweek, video.publishdate, video.referenceid, video.shortdescription, video.thumbnailurl,
         video.videostillurl));
 }
Example #2
0
        public static List<Videos> LoadFromDataReader(SqlDataReader m_rdr)
        {
            List<Videos> videos = new List<Videos>();
            while (m_rdr.Read())
            {
                Videos v = new Videos();
                if (!DBNull.Value.Equals(m_rdr["videostillurl"]))
                    v.videostillurl = m_rdr["videostillurl"].ToString();
                if (!DBNull.Value.Equals(m_rdr["thumbnailurl"]))
                    v.thumbnailurl = m_rdr["thumbnailurl"].ToString();
                if (!DBNull.Value.Equals(m_rdr["shortdescription"]))
                    v.shortdescription = m_rdr["shortdescription"].ToString();
                if (!DBNull.Value.Equals(m_rdr["referenceid"]))
                    v.referenceid = m_rdr["referenceid"].ToString();
                if (!DBNull.Value.Equals(m_rdr["publishdate"]))
                    v.publishdate = Convert.ToDateTime(m_rdr["publishdate"]);
                if (!DBNull.Value.Equals(m_rdr["id"]))
                    v.id = m_rdr["id"].ToString();
                if (!DBNull.Value.Equals(m_rdr["accountid"]))
                    v.accountid = m_rdr["accountid"].ToString();
                if (!DBNull.Value.Equals(m_rdr["creationdate"]))
                    v.creationdate = Convert.ToDateTime(m_rdr["creationdate"]);
                if (!DBNull.Value.Equals(m_rdr["enddate"]))
                    v.enddate = Convert.ToDateTime(m_rdr["enddate"]);
                if (!DBNull.Value.Equals(m_rdr["flvurl"]))
                    v.flvurl = m_rdr["flvurl"].ToString();
                if (!DBNull.Value.Equals(m_rdr["itemstate"]))
                    v.itemstate = m_rdr["itemstate"].ToString();
                if (!DBNull.Value.Equals(m_rdr["lastmodified"]))
                    v.lastmodified = Convert.ToDateTime(m_rdr["lastmodified"]);
                if (!DBNull.Value.Equals(m_rdr["length"]))
                    v.length = m_rdr["length"].ToString();
                if (!DBNull.Value.Equals(m_rdr["linktext"]))
                    v.linktext = m_rdr["linktext"].ToString();
                if (!DBNull.Value.Equals(m_rdr["linkurl"]))
                    v.linkurl = m_rdr["linkurl"].ToString();
                if (!DBNull.Value.Equals(m_rdr["longdescription"]))
                    v.longdescription = m_rdr["longdescription"].ToString();
                if (!DBNull.Value.Equals(m_rdr["name"]))
                    v.name = m_rdr["name"].ToString();
                if (!DBNull.Value.Equals(m_rdr["playstotal"]))
                    v.playstotal = Convert.ToInt32(m_rdr["playstotal"]);
                if (!DBNull.Value.Equals(m_rdr["playstrailingweek"]))
                    v.playstotal = Convert.ToInt32(m_rdr["playstrailingweek"]);

                videos.Add(v);

            }
            return videos;
        }
Example #3
0
        public static void PopulateBCVideoTable(string tokenStr,string accountType)
        {
            BrightcoveApi api = BrightcoveApiFactory.CreateApi(tokenStr,string.Empty,"http");

            BrightcoveItemCollection<BrightcoveVideo> videos = api.FindAllVideos(50, 0);
            bool cont = true;
            int ii = 1;
            while (cont)
            {
                BrightcoveItemCollection<BrightcoveVideo> vid = api.FindAllVideos(50, ii);
                if (vid.Count > 0)
                {
                    videos.AddRange(vid);

                    ii++;
                }
                else
                    cont = false;
            }

            int count = 0;
            for (int i = 0; i < videos.Count; ++i)
            {
                try
                {
                    count++;
                    Console.WriteLine(videos[i].FlvUrl);
                    Videos vid = new Videos();

                    vid.id = videos[i].Id.ToString();
                    vid.accountid = accountType;//videos[i].AccountId.ToString();
                    vid.creationdate = videos[i].CreationDate == DateTime.MinValue ? DateTime.Now : videos[i].CreationDate;
                    vid.enddate = videos[i].EndDate == DateTime.MinValue ? DateTime.Now : videos[i].EndDate;
                    vid.flvurl = videos[i].FlvUrl;
                    vid.itemstate = videos[i].ItemState.ToString();
                    vid.lastmodified = videos[i].LastModifiedDate == DateTime.MinValue ? DateTime.Now : videos[i].LastModifiedDate;
                    vid.length = videos[i].Length.ToString();
                    vid.linktext = videos[i].LinkText;
                    vid.linkurl = videos[i].LinkUrl;
                    vid.longdescription = videos[i].LongDescription;
                    vid.name = videos[i].Name;
                    vid.playstotal = videos[i].PlaysTotal;
                    vid.playstrailingweek = videos[i].PlaysTrailingWeek;
                    vid.publishdate = videos[i].PublishedDate == DateTime.MinValue ? DateTime.Now : videos[i].PublishedDate;
                    vid.referenceid = videos[i].ReferenceId;
                    vid.shortdescription = videos[i].ShortDescription;
                    vid.startdate = videos[i].StartDate == DateTime.MinValue ? DateTime.Now : videos[i].StartDate;
                    vid.thumbnailurl = videos[i].ThumbnailUrl;
                    vid.videostillurl = videos[i].VideoStillUrl;

                    if(videos[i].FlvUrl.Contains("rtmp:")){
                        int  debug = 0;
                    }
                    Videos.Insert(vid);

                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
        }