Ejemplo n.º 1
0
        public schedules GetScheduleDetails(string baseURL, string auth, string schedule)
        {
            var client  = new RestClient(baseURL);
            var request = new RestRequest("restapi/v1.0/dms/schedule/contents/" + schedule, Method.GET);

            request.RequestFormat = DataFormat.Json;
            //request.AddUrlSegment("id", schedule);
            request.AddHeader("api_key", auth);

            IRestResponse response = client.Execute(request);

            //var res = response.Content; // raw content as string


            try
            {
                schedules schdl = new schedules();
                //dynamic contents = JsonConvert.DeserializeObject(res);
                RestSharp.Deserializers.JsonDeserializer desserial = new JsonDeserializer();
                schdl = desserial.Deserialize <schedules>(response);
                return(schdl);
            }
            catch
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        public void check(string schedule)
        {
            OpenAPI   client = new OpenAPI();
            string    token, username, password, server;
            string    scheduleName, scheeduleframeId;
            schedules currenetSchedule = new schedules();

            username = Settings.Default.username;
            password = Settings.Default.password;
            server   = Settings.Default.server;

            token = client.getTokenID(username, password, server);

            currenetSchedule = client.GetScheduleDetails(server, token, schedule);

            scheduleName     = currenetSchedule.items.data.scheduleName;
            scheeduleframeId = currenetSchedule.items.data.frameId;

            MessageBox.Show(scheduleName + " \n" + scheeduleframeId);
        }
Ejemplo n.º 3
0
        public void publish(string schedule, string content, string init, string finish, string days)
        {
            OpenAPI client = new OpenAPI();
            string  token, username, password, server;

            DateTime inicio, fin;
            string   strInit, strEnd;


            programSchedule         publish = new programSchedule();
            programScheduleItemlist itms = new programScheduleItemlist();

            schedules currenetSchedule = new schedules(); //retrive  information  from current schedule
            string    frameID, thumbnailPath;

            contentDetail currenetContent = new contentDetail();////retrive  information  from content
            string        contentName, mediaType;


            username = Settings.Default.username;
            password = Settings.Default.password;
            server   = Settings.Default.server;


            inicio = Convert.ToDateTime(init);
            fin    = Convert.ToDateTime(finish);

            strInit = inicio.ToString("yyyy-M-d");
            strEnd  = fin.ToString("yyyy-M-d");


            token = client.getTokenID(username, password, server);

            currenetSchedule = client.GetScheduleDetails(server, token, schedule);
            currenetContent  = client.GetContentDetails(server, token, content);

            contentName   = currenetContent.items.contentName;
            mediaType     = currenetContent.items.mediaType;
            thumbnailPath = currenetContent.items.thumbFilePath;

            frameID = currenetSchedule.items.data.channelList[0].frameList[0].frameId;

            if (days == "")
            {
                days = "mon,tue,wed,thu,fri,sat,sun";
            }



            itms.channelNo     = 1;
            itms.cifsSlideTime = "5";
            itms.contentId     = content;
            itms.contentName   = contentName;
            itms.contentType   = mediaType;
            itms.duration      = "86399";
            itms.frameId       = frameID;
            itms.inputSource   = "";
            itms.isSync        = "";
            itms.monthday      = "";
            itms.playerMode    = "single";
            itms.priority      = 1;
            itms.repeatType    = "day_of_week";
            itms.safetyLock    = "";
            itms.scheduleType  = "LFD";
            itms.startDate     = strInit;
            itms.startTime     = "00:00:00";
            itms.stopDate      = strEnd;
            itms.thumbnailPath = thumbnailPath;
            itms.weekdays      = days;

            List <programScheduleItemlist> Itemlist = new List <programScheduleItemlist>();

            Itemlist.Add(itms);

            publish.backgroundMusic   = "";
            publish.contentMute       = "";
            publish.contentSyncOn     = "0";
            publish.deployReserve     = "false";
            publish.description       = null;
            publish.deviceGroupIds    = "50";//TODO
            publish.deviceType        = "SPLAYER";
            publish.itemList          = Itemlist;
            publish.deviceTypeVersion = 4;  //Splayer  SSSP4
            publish.scheduleGroupId   = 14; //TODO
            publish.scheduleName      = "Publicaado desde API";
            publish.vwlType           = "";


            client.putSchedule(server, token, publish, schedule);
        }