Ejemplo n.º 1
0
 public PostListIterator(VSharpService service, int board, int count)
 {
     _service = service;
     _board   = board;
     _count   = count;
     hasNext  = true;
 }
Ejemplo n.º 2
0
 public ChannelVideoListIterator(VSharpService service, int channelSeq, int count)
 {
     _service    = service;
     _channelSeq = channelSeq;
     _count      = count;
     currentPage = 1;
     hasNext     = true;
 }
Ejemplo n.º 3
0
        public LiveMonitorTask(int channelSeq, int count, TimeSpan period, VSharpService service) : base(channelSeq, period, service)
        {
            _count = count;

            Timer = new Timer(async(s) =>
            {
                if (Checking)
                {
                    return;
                }

                // Set flag to prevent overlapping checks
                Checking = true;

                try
                {
                    ChannelVideoListResponse channelVideoListResponse = await Service.GetChannelVideoListAsync(ChannelSeq, _count, 1);
                    List <Video> videos = channelVideoListResponse.Videos;

                    videos = videos.Where(x => x.VideoType == "LIVE" && x.OnAirStartAt > lastLive).ToList();
                    for (int i = videos.Count - 1; i >= 0; i--)
                    {
                        LiveFound.Invoke(null, CreateLiveFoundEventArgs(videos[i], channelVideoListResponse.ChannelInfo));
                    }

                    if (videos.Any())
                    {
                        lastLive = videos.Max(x => x.OnAirStartAt);
                    }
                }
                catch (Exception e)
                {
                    ExceptionThrown.Invoke(null, e);
                }
                finally
                {
                    Checking = false;
                }
            }, null, Timeout.Infinite, Timeout.Infinite);
        }
Ejemplo n.º 4
0
 public AVideoMonitorTask(int videoSeq, TimeSpan period, VSharpService service) : base(period, service)
 {
     VideoSeq = videoSeq;
 }
Ejemplo n.º 5
0
 public static async Task Main(string[] args)
 {
     VSharpService service = new VSharpService("app_id", Locale.EN);
     VSharpMonitor monitor = new VSharpMonitor(service);
     await Task.Delay(-1);
 }
Ejemplo n.º 6
0
        public SubtitleMonitorTask(int videoSeq, Language language, SubtitleType type, TimeSpan period, VSharpService service) : base(videoSeq, period, service)
        {
            Language = language;
            Type     = type;
            Id       = new SubtitleMonitorTaskId(videoSeq, language, type);

            Timer = new Timer(async(s) =>
            {
                if (Checking)
                {
                    return;
                }

                // Set flag to prevent overlapping checks
                Checking = true;

                try
                {
                    VODInfo vodInfo = await Service.GetVODInfoAsync(VideoSeq);

                    // Only continue if the VOD has caption data
                    if (vodInfo.CaptionInfo == null)
                    {
                        return;
                    }

                    foreach (var details in vodInfo.CaptionInfo.Details)
                    {
                        if (details.Locale == Language.Value && details.Type.ToLower() == Type.Value)
                        {
                            SubtitleAvailable.Invoke(null, CreateSubtitleEventArgs(VideoSeq, details));
                        }
                    }
                }
                catch (Exception e)
                {
                    ExceptionThrown.Invoke(null, e);
                }
                finally
                {
                    Checking = false;
                }
            }, null, Timeout.Infinite, Timeout.Infinite);
        }
Ejemplo n.º 7
0
 public AMonitorTask(TimeSpan period, VSharpService service)
 {
     Service = service;
     _period = period;
 }
Ejemplo n.º 8
0
 public AChannelMonitorTask(int channelSeq, TimeSpan period, VSharpService service) : base(period, service)
 {
     ChannelSeq = channelSeq;
 }