Ejemplo n.º 1
0
        public void Prepare()
        {
            try
            {
                //PixelsMap.DisComInit();
                lock (_oLock)
                {
                    if (_bPrepared)
                    {
                        (new Logger()).WriteWarning("Voting has already prepared!");
                        return;
                    }
                    _bPrepared = true;
                }
                (new Logger()).WriteDebug("prepare:in");

                ulong nSimulID = (ulong)_cRollImages.nID;
                _cRollImages.SimultaneousSet(nSimulID, 4);
                _cRollTop.SimultaneousSet(nSimulID, 4);
                _cRollBot.SimultaneousSet(nSimulID, 4);
                _cRollMid.SimultaneousSet(nSimulID, 4);

                _cRollImages.Prepare(38);
                _aBytesImages = _cRollImages.PreRenderedFramesGet();
                ClearRoll(_cRollImages);
                _cRollTop.Prepare(61);
                _aBytesTop = _cRollTop.PreRenderedFramesGet();
                ClearRoll(_cRollTop);
                _cRollBot.Prepare(29);
                _aBytesBot = _cRollBot.PreRenderedFramesGet();
                ClearRoll(_cRollBot);
                _cRollMid.Prepare(23);
                _aBytesMid = _cRollMid.PreRenderedFramesGet();
                ClearRoll(_cRollMid);

                AddInitFrames(50);

                _cThreadWorker = new System.Threading.Thread(WorkerUpdater);
                _cThreadWorker.IsBackground = true;
                _cThreadWorker.Priority     = System.Threading.ThreadPriority.Normal;
                _cThreadWorker.Start();

                _cThreadWorker = new System.Threading.Thread(Worker);
                _cThreadWorker.IsBackground = true;
                _cThreadWorker.Priority     = System.Threading.ThreadPriority.Normal;
                _cThreadWorker.Start();

                eStatus = BTL.EffectStatus.Preparing;
                if (null != Prepared)
                {
                    Plugin.EventSend(Prepared, this);
                }
                (new Logger()).WriteDebug("prepare:out");
            }
            catch (Exception ex)
            {
                (new Logger()).WriteError(ex);
                eStatus = BTL.EffectStatus.Error;
            }
        }
Ejemplo n.º 2
0
 public void Stop()
 {
     lock (_oLock)
     {
         if (_bStopped)
         {
             return;
         }
         _bStopped = true;
     }
     try
     {
         (new Logger()).WriteDebug("stop:in");
         if (_cPreferences.cRoll.eStatus == BTL.EffectStatus.Running || _cPreferences.cRoll.eStatus == BTL.EffectStatus.Preparing)
         {
             _cPreferences.cRoll.Stop();
         }
         _cPreferences.cRoll.Dispose();
         (new Logger()).WriteDebug("stop:mid");
     }
     catch (Exception ex)
     {
         (new Logger()).WriteError(ex);
     }
     if (null != Stopped)
     {
         Plugin.EventSend(Stopped, this);
     }
     (new Logger()).WriteDebug("stop:out");
 }
Ejemplo n.º 3
0
 public void Start()
 {
     try
     {
         (new Logger()).WriteDebug("start_in");
         bool bFirst = true;
         foreach (hrc.plugins.PlaylistItem cPLI in _cPLCurrent.aItems)
         {
             if (bFirst)
             {
                 bFirst = false;
                 _cPlaylist.Start();                          // first pli was added in prepare!
                 continue;
             }
             Video cVideo;
             cVideo           = new Video(cPLI.oAsset.cFile.sFile);
             cVideo.nDuration = (ulong)(cPLI.nFramesQty == long.MaxValue || cPLI.nFramesQty < 1 ? cPLI.oAsset.nFramesQty : cPLI.nFramesQty);
             _cPlaylist.VideoAdd(cVideo);
             _ahVideoBinds.Add(cVideo, cPLI);
         }
         if (null != Started)
         {
             Plugin.EventSend(Started, this);
         }
         (new Logger()).WriteDebug("started");
     }
     catch (Exception ex)
     {
         (new Logger()).WriteError(ex);
         Stop();
     }
 }
Ejemplo n.º 4
0
        public void Stop()
        {
            if (bIsStopped)
            {
                return;
            }
            bIsStopped = true;

            try
            {
                (new Logger()).WriteDebug("stop_in");
                if (null != _cPlaylist && _cPlaylist.eStatus != BTL.EffectStatus.Stopped)
                {
                    _cPlaylist.Stop();
                }
            }
            catch (Exception ex)
            {
                (new Logger()).WriteError(ex);
            }
            if (null != Stopped)
            {
                Plugin.EventSend(Stopped, this);
            }
            (new Logger()).WriteDebug("stopped");
        }
Ejemplo n.º 5
0
        public void Prepare()
        {
            try
            {
                DisCom.Init();

                _cRoll            = new Roll();
                _cRoll.eDirection = _cPreferences.eDirection;
                _cRoll.nSpeed     = _cPreferences.nSpeed;
                _cRoll.stArea     = _cPreferences.stArea;
                _cRoll.bCUDA      = _cPreferences.bRollCuda;
                _cRoll.nLayer     = _cPreferences.nLayer;
                _cRoll.bOpacity   = false;
                if (0 < _cPreferences.nPause)
                {
                    _cRoll.EffectIsOffScreen += _cRoll_EffectIsOffScreen;
                }
                _cRoll.Prepare();

                _ahItems          = new Dictionary <string, DateTime>();
                _cTimerRollResume = new System.Threading.Timer(TickRollResume);
                _cTimerRssRequest = new System.Threading.Timer(TickRssRequest);
                TickRssRequest(null);

                if (null != Prepared)
                {
                    Plugin.EventSend(Prepared, this);
                }
                (new Logger()).WriteDebug3("ok");
            }
            catch (Exception ex)
            {
                (new Logger()).WriteError(ex);
            }
        }
Ejemplo n.º 6
0
 public void Stop()
 {
     try
     {
         if (null != _iEffect)
         {
             if (BTL.EffectStatus.Running == _iEffect.eStatus)
             {
                 _iEffect.Stop();
             }
         }
         (new Logger()).WriteDebug("stopped: [blendf=" + _cPreferences.sBlendFile + "][pythonf=" + _cPreferences.sPythonFile + "]");
         if (null != _cPreferences.sPythonFile && File.Exists(_cPreferences.sPythonFile))
         {
             File.Delete(_cPreferences.sPythonFile);
             (new Logger()).WriteDebug("deleted: [pythonf=" + _cPreferences.sPythonFile + "]");
         }
     }
     catch (Exception ex)
     {
         (new Logger()).WriteError(ex);
     }
     if (null != Stopped)
     {
         Plugin.EventSend(Stopped, this);
     }
 }
Ejemplo n.º 7
0
        public void Stop()
        {
            try
            {
                _bStopping = true;


                if (_cPLPhotoLeft.eStatus == BTL.EffectStatus.Running && 0 == _cPLPhotoLeft.nSumDuration)
                {
                    _cPLPhotoLeft.Stop();
                }
                if (_cPLPhotoRight.eStatus == BTL.EffectStatus.Running && 0 == _cPLPhotoRight.nSumDuration)
                {
                    _cPLPhotoRight.Stop();
                }

                lock (_aLoops)
                {
                    foreach (Effect cEffect in _aLoops)
                    {
                        if (cEffect.eStatus == BTL.EffectStatus.Running)
                        {
                            if (cEffect.oTag == "voting_imagesL_loop")
                            {
                                _cPLPhotoLeft.nDuration = _cPLPhotoLeft.nFrameCurrent + _nEmergencyDuration;
                                _cPLPhotoLeft.Skip(false, 0, cEffect);
                            }
                            if (cEffect.oTag == "voting_imagesR_loop")
                            {
                                _cPLPhotoRight.nDuration = _cPLPhotoRight.nFrameCurrent + _nEmergencyDuration;
                                _cPLPhotoRight.Skip(false, 0, cEffect);
                            }
                            if (cEffect.oTag == "voting_top_loop1" || cEffect.oTag == "voting_top_loop2")
                            {
                                _cPLMatTop.nDuration = _cPLMatTop.nFrameCurrent + _nEmergencyDuration;
                                _cPLMatTop.Skip(false, 0, cEffect);
                            }
                            if (cEffect.oTag == "new_votes_loop" || cEffect.oTag == "voting_mid_loop1")
                            {
                                _cPLMatMiddle.nDuration = _cPLMatMiddle.nFrameCurrent + _nEmergencyDuration;
                                _cPLMatMiddle.Skip(false, 0, cEffect);
                            }
                        }
                        else
                        {
                            ((Animation)cEffect).nLoopsQty = 10;
                        }
                    }
                }
                (new Logger()).WriteDebug("stopping");
            }
            catch (Exception ex)
            {
                (new Logger()).WriteError(ex);
            }
            if (null != Stopped)
            {
                Plugin.EventSend(Stopped, this);
            }
        }
Ejemplo n.º 8
0
 public void Prepare()
 {
     try
     {
         //PixelsMap.DisComInit();
         lock (_oLock)
         {
             if (_bPrepared)
             {
                 (new Logger()).WriteWarning("Credits has already prepared!");
                 return;
             }
             _bPrepared = true;
         }
         (new Logger()).WriteDebug("prepare:in");
         _cPreferences.cRoll.Stopped += _cRoll_Stopped;
         _cPreferences.cRoll.SimultaneousSet(_nSimultaneousID, _nSimultaneousTotalQty);                 // сработает при количестве > 1
         _cPreferences.cRoll.Prepare();
         if (null != Prepared)
         {
             Plugin.EventSend(Prepared, this);
         }
         (new Logger()).WriteDebug("prepare:out");
     }
     catch (Exception ex)
     {
         (new Logger()).WriteError(ex);
     }
 }
Ejemplo n.º 9
0
        public void Prepare()
        {
            eStatus   = BTL.EffectStatus.Preparing;
            _cPrepare = new ManualResetEvent(false);
            try
            {
                //PixelsMap.DisComInit();

                if (!Directory.Exists(Path.Combine(_cPreferences.sFolderMat, "voting_bot_loop")))
                {
                    Render(_cPreferences.cMat.OuterXml, (IPlugin) => _cPrepare.Set());
                    _cPrepare.WaitOne();
                    _cPrepare.Reset();
                }
                PrepareVotes();
                _cPrepare.WaitOne();
                _cPrepare.Reset();
                PreparePlaylists();
                if (null != Prepared)
                {
                    Plugin.EventSend(Prepared, this);
                }
            }
            catch (Exception ex)
            {
                eStatus = BTL.EffectStatus.Error;
                (new Logger()).WriteError(ex);
            }
        }
Ejemplo n.º 10
0
 public void Start()
 {
     _cRoll.Start();
     if (null != Started)
     {
         Plugin.EventSend(Started, this);
     }
 }
Ejemplo n.º 11
0
        public void Stop()
        {
            lock (_oLock)
            {
                if (_bStopped)
                {
                    return;
                }
                _bStopped = true;
            }
            try
            {
                (new Logger()).WriteDebug("stop:in");
                if (_bStarted)
                {
                    (new Logger()).WriteDebug("waiting for roll stopping");
                    _cPreferences.cRoll.nDuration = _cPreferences.cRoll.nFrameCurrent + 75;
                    DateTime dtKill = DateTime.Now.AddSeconds(10);
                    while (_cPreferences.cRoll.eStatus != BTL.EffectStatus.Stopped)
                    {
                        System.Threading.Thread.Sleep(40);
                        if (DateTime.Now > dtKill)
                        {
                            (new Logger()).WriteDebug("stop:mid: break waiting");
                            break;
                        }
                    }
                    (new Logger()).WriteDebug("stop:mid: roll stopped");
                }
                else
                {
                    System.Threading.Thread.Sleep(200);
                }

                if (_cPreferences.cRoll.eStatus == BTL.EffectStatus.Running || _cPreferences.cRoll.eStatus == BTL.EffectStatus.Preparing)
                {
                    _cPreferences.cRoll.Stop();
                }
                _cPreferences.cRoll.Dispose();

                if (null != _cThreadWorker && _cThreadWorker.IsAlive)
                {
                    _cThreadWorker.Abort();
                    //_cThreadWorker.Join();
                }
                (new Logger()).WriteDebug("stop:mid");
            }
            catch (Exception ex)
            {
                (new Logger()).WriteError(ex);
            }
            if (null != Stopped)
            {
                Plugin.EventSend(Stopped, this);
            }
            (new Logger()).WriteDebug("stop:out");
        }
Ejemplo n.º 12
0
        public void Prepare()
        {
            try
            {
                //PixelsMap.DisComInit();
                lock (_oLock)
                {
                    if (bPrepared)
                    {
                        (new Logger()).WriteWarning("Comingup has already prepared!");
                        return;
                    }
                    bPrepared = true;
                }
                (new Logger()).WriteDebug("prepare:in");
                _cPreferences.cOverTop.Stopped += COverTop_Stopped;

                foreach (btl.Roll cR in _cPreferences.aRoll)
                {
                    _aEffects.Add(cR);
                }
                _aEffects.Add(_cPreferences.cHashTag);
                _aEffects.Add(_cPreferences.cOverTop);
                _aEffects.Add(_cPreferences.cOverBot);

                ulong  nSimulID    = (ulong)DateTime.Now.Subtract(DateTime.MinValue).Ticks;
                ushort nEffectsQty = (ushort)(_aEffects.Count + 1);

                _cCredits.SetSimultaneousParams(nSimulID, nEffectsQty);
                _cCredits.Prepare();

                int nI = 0;
                foreach (BTL.IEffect cE in _aEffects)
                {
                    cE.SimultaneousSet(nSimulID, nEffectsQty);
                    cE.Prepare();
                    if (cE is btl.Roll && nI++ < 2)
                    {
                        System.Threading.Thread.Sleep(500); // паузы при заборе фрагментов клипов, а то один раз дало сбой - не хватило времени эфиру взять клипы. // устарело, но зазор пусть будет ))
                    }
                }
                lock (_oLockStatus)
                {
                    _estatus         = BTL.EffectStatus.Preparing;
                    _dtStatusChanged = DateTime.Now;
                }
                if (null != Prepared)
                {
                    Plugin.EventSend(Prepared, this);
                }
                (new Logger()).WriteDebug("prepare:out");
            }
            catch (Exception ex)
            {
                (new Logger()).WriteError(ex);
            }
        }
Ejemplo n.º 13
0
 public void Start()
 {
     (new Logger()).WriteDebug("start:in");
     _cPreferences.cRoll.Start();
     if (null != Started)
     {
         Plugin.EventSend(Started, this);
     }
     (new Logger()).WriteDebug("start:out");
 }
Ejemplo n.º 14
0
 public void Start()
 {
     ThreadPool.QueueUserWorkItem(Worker);
     _eStatus         = BTL.EffectStatus.Running;
     _dtStatusChanged = DateTime.Now;
     if (null != Started)
     {
         Plugin.EventSend(Started, this);
     }
 }
Ejemplo n.º 15
0
 void iEffect_Stopped(BTL.Play.Effect cSender)
 {
     try
     {
         (new Logger()).WriteDebug("self stopped: [blendf=" + _cPreferences.sBlendFile + "][pythonf=" + _cPreferences.sPythonFile + "]");
         if (null != Stopped)
         {
             Plugin.EventSend(Stopped, this);
         }
     }
     catch (Exception ex)
     {
         (new Logger()).WriteError(ex);
     }
 }
Ejemplo n.º 16
0
        public void Prepare()
        {
            try
            {
                (new Logger()).WriteDebug2("prepare_in");
                _cDBI       = new DBInteract();
                _cPLCurrent = null;
                _nPLID      = _cDBI.TryToGetIDFromCommands();
                (new Logger()).WriteDebug2("pl_id=" + _nPLID);
                _ahVideoBinds = new Dictionary <Video, helpers.replica.cues.plugins.PlaylistItem>();

                _cPlaylist                 = new btl.Playlist();
                _cPlaylist.stArea          = _cPreferences.stArea;
                _cPlaylist.stMergingMethod = _cPreferences.stMerging;
                _cPlaylist.nLayer          = _cPreferences.nLayer;
                _cPlaylist.bOpacity        = false;
                _cPlaylist.bStopOnEmpty    = true;
                _cPlaylist.aChannelsAudio  = new byte[] { 0, 1 };
                _cPlaylist.EffectStarted  += _cPlaylist_EffectStarted;
                _cPlaylist.EffectStopped  += _cPlaylist_EffectStopped;
                _cPlaylist.EffectFailed   += _cPlaylist_EffectFailed;
                _cPlaylist.Stopped        += _cPlaylist_Stopped;
                _cPlaylist.Prepare();


                Video cVideo;
                _cPLCurrent = _cDBI.AdvancedPlaylistGet(_nPLID > 0 ? _nPLID : _cPreferences.nPlaylistID);
                (new Logger()).WriteDebug2("pl_id=" + (_nPLID > 0 ? _nPLID : _cPreferences.nPlaylistID));
                helpers.replica.cues.plugins.PlaylistItem cPLI = _cPLCurrent.aItems[0];
                cVideo           = new Video(cPLI.oAsset.cFile.sFile);
                cVideo.nDuration = (ulong)(cPLI.nFramesQty == long.MaxValue || cPLI.nFramesQty < 1 ? cPLI.oAsset.nFramesQty : cPLI.nFramesQty);
                cVideo.Prepare();
                _cPlaylist.VideoAdd(cVideo);
                _ahVideoBinds.Add(cVideo, cPLI);

                if (null != Prepared)
                {
                    Plugin.EventSend(Prepared, this);
                }
                (new Logger()).WriteDebug2("prepare_ok");
            }
            catch (Exception ex)
            {
                (new Logger()).WriteError(ex);
                Stop();
            }
        }
Ejemplo n.º 17
0
 public void Start()
 {
     lock (_oLock)
     {
         if (_bStopped || _bStarted)
         {
             return;
         }
         _bStarted = true;
     }
     (new Logger()).WriteDebug("start:in");
     _cPreferences.cRoll.Start();
     if (null != Started)
     {
         Plugin.EventSend(Started, this);
     }
     (new Logger()).WriteDebug("start:out");
 }
Ejemplo n.º 18
0
 public void Prepare()
 {
     try
     {
         _bStopped = true;
         _aqSMSs   = new Queue <SMS>();
         (_cSMSChat = new SMSChat(_cPreferences)).Init();
         _eStatus         = BTL.EffectStatus.Preparing;
         _dtStatusChanged = DateTime.Now;
         if (null != Prepared)
         {
             Plugin.EventSend(Prepared, this);
         }
         (new Logger()).WriteDebug3("ok");
     }
     catch (Exception ex)
     {
         (new Logger()).WriteError(ex);
     }
 }
Ejemplo n.º 19
0
        public void Start()
        {
            (new Logger()).WriteDebug("start:in");
            _cCredits.Start();
            foreach (BTL.IEffect cE in _aEffects)
            {
                cE.Start();
            }

            lock (_oLockStatus)
            {
                _estatus         = BTL.EffectStatus.Running;
                _dtStatusChanged = DateTime.Now;
            }
            if (null != Started)
            {
                Plugin.EventSend(Started, this);
            }
            (new Logger()).WriteDebug("start:out");
        }
Ejemplo n.º 20
0
 public void Stop()
 {
     try
     {
         if (null == _cTimerRssRequest)
         {
             return;
         }
         _cTimerRssRequest.Change(Timeout.Infinite, Timeout.Infinite);
         _cTimerRssRequest = null;
         _cRoll.Stop();
         (new Logger()).WriteDebug("stop");
     }
     catch (Exception ex)
     {
         (new Logger()).WriteError(ex);
     }
     if (null != Stopped)
     {
         Plugin.EventSend(Stopped, this);
     }
 }
Ejemplo n.º 21
0
        public void Prepare()
        {
            lock (_oLock)
            {
                if (_bPrepared)
                {
                    (new Logger()).WriteWarning("Blender has already prepared!");
                    return;
                }
                _bPrepared = true;
            }
            try
            {
                if (null != _cPreferences.iVideo)
                {
                    if (!_cPreferences.bExists)
                    {
                        (new Logger()).WriteDebug2("render from prepare [pf=" + _cPreferences.sPythonFile + "]");
                        Render(_cPreferences.sBlendFile, _cPreferences.sPythonFile, _cPreferences.sOutputTarget, "0", _cPreferences.bUseOutput, _cPreferences.bZip);
                    }
                    _cPreferences.EffectVideoInit();
                    (_iEffect = (BTL.IEffect)_cPreferences.iVideo).Prepare();
                }
                else
                {
                    _eStatus = BTL.EffectStatus.Preparing;
                }

                if (null != Prepared)
                {
                    Plugin.EventSend(Prepared, this);
                }
                (new Logger()).WriteDebug3("prepared");
            }
            catch (Exception ex)
            {
                (new Logger()).WriteError(ex);
            }
        }
Ejemplo n.º 22
0
        public void Stop()
        {
            try
            {
                if (null == _cTimerRequest)
                {
                    return;
                }
                _RollFeedStop = true;
                _cTimerRequest.Change(Timeout.Infinite, Timeout.Infinite);
                _cTimerRequest = null;
                if (_cPLBackground != null)
                {
                    _cPLBackground.Skip(false, 0);
                }
                if (_cPLMask != null)
                {
                    _cPLMask.Skip(false, 0);
                }
                if (_cPLBackground != null)
                {
                    while (_cPLBackground.eStatus != BTL.EffectStatus.Stopped)
                    {
                        Thread.Sleep(5);
                    }
                }

                _cRoll.Stop();
                (new Logger()).WriteDebug("stop");
            }
            catch (Exception ex)
            {
                (new Logger()).WriteError(ex);
            }
            if (null != Stopped)
            {
                Plugin.EventSend(Stopped, this);
            }
        }
Ejemplo n.º 23
0
 public void Stop()
 {
     lock (_oLock)
     {
         if (_bStopped)
         {
             return;
         }
         _bStopped = true;
     }
     try
     {
         (new Logger()).WriteDebug("stop:in");
         if (((IPlugin)_cCredits).eStatus == BTL.EffectStatus.Running)
         {
             _cCredits.Stop();
         }
         foreach (BTL.IEffect cE in _aEffects)
         {
             cE.Dispose();
         }
         (new Logger()).WriteDebug("stop:mid");
     }
     catch (Exception ex)
     {
         (new Logger()).WriteError(ex);
     }
     lock (_oLockStatus)
     {
         _estatus         = BTL.EffectStatus.Stopped;
         _dtStatusChanged = DateTime.Now;
     }
     if (null != Stopped)
     {
         Plugin.EventSend(Stopped, this);
     }
     (new Logger()).WriteDebug("stop:out");
 }
Ejemplo n.º 24
0
        public void Prepare()
        {
            try
            {
                //PixelsMap.DisComInit();
                lock (_oLock)
                {
                    if (_bPrepared)
                    {
                        (new Logger()).WriteWarning("Hashtags has already prepared!");
                        return;
                    }
                    _bPrepared = true;
                }
                (new Logger()).WriteDebug("prepare:in");
                _cPreferences.cRoll.Stopped += _cRoll_Stopped;
                _cPreferences.cRoll.EffectAdd(_cPreferences.cPlaylist, null, 0);
                _cCurrentTI = _cPreferences.aTextItems[0];

                _cPreferences.cRoll.Prepare(2);
                AddTransition(Transition.Initial);

                _cThreadWorker = new System.Threading.Thread(Worker);
                _cThreadWorker.IsBackground = true;
                _cThreadWorker.Priority     = System.Threading.ThreadPriority.Normal;
                _cThreadWorker.Start();

                if (null != Prepared)
                {
                    Plugin.EventSend(Prepared, this);
                }
                (new Logger()).WriteDebug("prepare:out");
            }
            catch (Exception ex)
            {
                (new Logger()).WriteError(ex);
            }
        }
Ejemplo n.º 25
0
        public void Start()
        {
            eStatus = BTL.EffectStatus.Running;
            _cPLMatTop.Start();
            _cPLMatBottom.Start();
            _cPLMatMiddle.Start();

            _cPreferences.PollUpdate();

            //DNF
            //System.Threading.Thread _cThreadFramesGettingWorker;
            //_cThreadFramesGettingWorker = new System.Threading.Thread(FramesGettingWorker);
            //_cThreadFramesGettingWorker.IsBackground = true;
            //_cThreadFramesGettingWorker.Priority = System.Threading.ThreadPriority.Normal;
            //_cThreadFramesGettingWorker.Start();



            if (null != Started)
            {
                Plugin.EventSend(Started, this);
            }
        }
Ejemplo n.º 26
0
        public void Start()
        {
            if (null == _iEffect)
            {
                System.Threading.ThreadPool.QueueUserWorkItem(delegate(object o)
                {
                    try
                    {
                        if (null != _cPreferences.cData)
                        {
                            _cPreferences.cData.Request(Render);
                        }
                        else
                        {
                            (new Logger()).WriteDebug2("render from start [pf=" + _cPreferences.sPythonFile + "]");
                            Render(_cPreferences.sBlendFile, _cPreferences.sPythonFile, _cPreferences.sOutputTarget, "0", _cPreferences.bUseOutput, _cPreferences.bZip);
                        }
                        Stop();
                    }
                    catch (Exception ex)
                    {
                        (new Logger()).WriteError(ex);
                    }
                });
            }
            else
            {
                _iEffect.Stopped += iEffect_Stopped;
                _iEffect.Start();
            }

            (new Logger()).WriteDebug("started: [blendf=" + _cPreferences.sBlendFile + "][pythonf=" + _cPreferences.sPythonFile + "]");
            if (null != Started)
            {
                Plugin.EventSend(Started, this);
            }
        }
Ejemplo n.º 27
0
        public void Stop()
        {
            lock (_oLockStop)
            {
                if (_bStopped)
                {
                    return;
                }
                _bStopped = true;
            }
            try
            {
                _cSMSChat.IsChatTerminating = true;
                (new Logger()).WriteNotice("Stop: IsChatTerminating = true");
                DateTime dtNow = DateTime.Now.AddSeconds(5);
                while ((_cSMSChat.IsChatTerminating || _cSMSChat.IsInfoOnAir) && DateTime.Now < dtNow)
                {
                    Thread.Sleep(50);
                }

                while (!_bWorkerSMSEnd && !_bWorkerEnd)
                {
                    Thread.Sleep(50);
                }

                _cSMSChat.Stop();
                _cSMSChat.Release();
                (new Logger()).WriteNotice("Stop: after _cSMSChat.Release();");
                lock (_oLock)
                {
                    _cSMSChat = null;
                }
            }
            catch (Exception ex)
            {
                (new Logger()).WriteError(ex);
            }
            finally
            {
                try
                {
                    DBInteract cDBI   = new DBInteract();
                    bool       bIsAir = cDBI.IsThereAnyStartedLiveBroadcast();
                    (new Logger()).WriteDebug2("ChatLogStopAdd [isair=" + bIsAir + "][type=" + _cPreferences.eBroadcastType + "][release=" + _cPreferences.bMessagesRelease + "]");
                    if (_cPreferences.bMessagesRelease && !(_cPreferences.eBroadcastType == Preferences.BroadcastType.linear && bIsAir) && !(_cPreferences.eBroadcastType == Preferences.BroadcastType.live && !bIsAir))
                    {
                        bool bOk = cDBI.ChatLogStopAdd(DateTime.Now.AddSeconds(4));
                        (new Logger()).WriteNotice("ChatLogStopAdd - " + bOk);
                    }
                    else if (_bChatWasAddedToLogsOnStart)
                    {
                        bool bOk = cDBI.ChatLogStopAdd(DateTime.Now.AddSeconds(4));
                        (new Logger()).WriteNotice("ChatLogStopAdd-2 - " + bOk);
                    }
                    _bChatWasAddedToLogsOnStart = false;
                    _eStatus         = BTL.EffectStatus.Stopped;
                    _dtStatusChanged = DateTime.Now;
                    _cPreferences    = null;
                    if (null != Stopped)
                    {
                        Plugin.EventSend(Stopped, this);
                    }
                }
                catch (Exception ex)
                {
                    (new Logger()).WriteError("Stop: ", ex);
                }
            }
        }
Ejemplo n.º 28
0
        public void Prepare()
        {
            try
            {
                //PixelsMap.DisComInit();
                lock (_oLock)
                {
                    if (_bPrepared)
                    {
                        (new Logger()).WriteWarning("Credits has already prepared!");
                        return;
                    }
                    _bPrepared = true;
                }
                (new Logger()).WriteDebug("prepare:in");
                btl.Roll cRoll = _cPreferences.cRoll;

                cRoll.Stopped += _cRoll_Stopped;
                btl.Text      cText;
                btl.Animation cAnim;
                //btl.Roll.Keyframe[] aKFHold = new btl.Roll.Keyframe[1] { new btl.Roll.Keyframe() { eType = Roll.Keyframe.Type.hold, nFrame = 0, nPosition = 0 } };



                bool bFirstTime = true;
                bool bLastTime  = false;
                int  nOdd       = 1;
                //cRoll.nDuration = 200;

                foreach (helpers.data.Data.WeatherItem cWI in _cPreferences.aWeatherItems)
                {
                    if (cWI == _cPreferences.aWeatherItems[_cPreferences.aWeatherItems.Count - 1])
                    {
                        bLastTime = true;
                    }
                    if (bFirstTime)
                    {
                        cRoll.EffectAdd(_cPreferences.ahItems["backgr_intro"].cVideo, null, false, false);
                        cRoll.Prepare(53);
                    }
                    // city
                    cText = (btl.Text)_cPreferences.ahItems["text_city_" + nOdd].cVideo;
                    cRoll.RemoveEffect(cText);
                    IdleEffect(cText);
                    cText.sText = cWI.sCity;
                    cText.iMask = _cPreferences.ahItems["mask_city_loop_" + nOdd].cVideo;
                    IdleEffect(cText.iMask);
                    cRoll.EffectAdd(cText, _cPreferences.ahItems["text_city_" + nOdd].aKFs[0], float.MinValue, false, 0, false, false);
                    cRoll.Prepare(3);
                    // time  81
                    cAnim = (btl.Animation)_cPreferences.ahItems["backgr_pink"].cVideo;
                    cRoll.RemoveEffect(cAnim);
                    IdleEffect(cAnim);
                    cRoll.EffectAdd(_cPreferences.ahItems["backgr_pink"].cVideo, null, false, false);

                    cText = (btl.Text)_cPreferences.ahItems["text_time"].cVideo;
                    cRoll.RemoveEffect(cText);
                    IdleEffect(cText);
                    cText.sText = cWI.sTime;
                    cText.iMask = _cPreferences.ahItems["mask_time"].cVideo;
                    IdleEffect(cText.iMask);
                    cRoll.EffectAdd(cText, _cPreferences.ahItems["text_time"].aKFs[0], float.MinValue, false, 0, false, false);
                    cRoll.Prepare(2);
                    // temperature
                    if (bFirstTime)
                    {
                        cRoll.EffectAdd(_cPreferences.ahItems["backgr_black_in"].cVideo, null, false, false);
                    }

                    cText = (btl.Text)_cPreferences.ahItems["text_temperature"].cVideo;
                    cRoll.RemoveEffect(cText);
                    cText.bWaitForOutDissolve = false;
                    IdleEffect(cText);
                    cText.sText = cWI.sTemperature.StartsWith("-") || cWI.sTemperature.StartsWith("+") ? cWI.sTemperature.Substring(0, 1) + " " + cWI.sTemperature.Substring(1) : cWI.sTemperature;
                    if (bFirstTime)
                    {
                        cText.iMask = _cPreferences.ahItems["mask_tempr_in"].cVideo;
                        IdleEffect(cText.iMask);
                    }
                    if (bFirstTime)
                    {
                        cRoll.EffectAdd(cText, _cPreferences.ahItems["text_temperature"].aKFs[0], float.MinValue, false, 0, false, false);
                    }
                    else if (bLastTime)
                    {
                        cRoll.EffectAdd(cText, _cPreferences.ahItems["text_temperature"].aKFs[1], float.MinValue, false, 0, false, false);
                    }
                    else
                    {
                        cRoll.EffectAdd(cText, _cPreferences.ahItems["text_temperature"].aKFs[2], float.MinValue, false, 0, false, false);
                    }
                    cRoll.Prepare(2);
                    // icon
                    try
                    {
                        cAnim = (btl.Animation)btl.Effect.EffectGet(_cPreferences.ahItems["animation_icon"].XMLReplace("{%FOLDER%}", cWI.sIcon));
                        cRoll.EffectAdd(cAnim, _cPreferences.ahItems["animation_icon"].aKFs[0], float.MinValue, false, 0, false, false);
                    }
                    catch (Exception ex)
                    {
                        (new Logger()).WriteError("icon problem [icon=" + cWI.sIcon + "]<br>" + ex);
                    }
                    cRoll.Prepare(6);
                    // ---
                    if (bFirstTime)
                    {
                        cRoll.EffectAdd(_cPreferences.ahItems["backgr_black_loop"].cVideo, null, false, false);
                        cRoll.EffectAdd(_cPreferences.ahItems["backgr_final_loop"].cVideo, null, false, false);
                        bFirstTime = false;
                    }
                    cRoll.Prepare(68);

                    nOdd = nOdd == 1 ? 2 : 1;
                }
                //cRoll.Prepare(5);
                StopEffect(_cPreferences.ahItems["backgr_black_loop"].cVideo);
                cAnim = (btl.Animation)_cPreferences.ahItems["backgr_black_out"].cVideo;
                StopEffect(cAnim);
                cRoll.EffectAdd(_cPreferences.ahItems["backgr_black_out"].cVideo, null, false, false);
                cText = (btl.Text)_cPreferences.ahItems["text_yandex"].cVideo;
                cRoll.EffectAdd(cText, null, false, false);
                cRoll.Prepare(110);
                cAnim = (btl.Animation)_cPreferences.ahItems["backgr_final_pink"].cVideo;
                StopEffect(cAnim);
                cRoll.EffectAdd(cAnim, null, false, false);
                cRoll.Prepare(8);
                StopEffect(_cPreferences.ahItems["backgr_final_loop"].cVideo);
                StopEffect(cText);
                cRoll.Prepare(20);

                if (null != Prepared)
                {
                    Plugin.EventSend(Prepared, this);
                }
                (new Logger()).WriteDebug("prepare:out");
            }
            catch (Exception ex)
            {
                (new Logger()).WriteError(ex);
            }
        }
Ejemplo n.º 29
0
        public void Prepare()
        {
            try
            {
                //PixelsMap.DisComInit();

                _cRoll                   = new btl.Roll();
                _cRoll.eDirection        = _cPreferences.eDirection;
                _cRoll.nSpeed            = _cPreferences.nSpeed;
                _cRoll.stArea            = _cPreferences.stArea;
                _cRoll.stMergingMethod   = _cPreferences.stRollMerging;
                _cRoll.nLayer            = _cPreferences.nLayer;
                _cRoll.bOpacity          = false;
                _cRoll.EffectIsOnScreen += _cRoll_EffectIsOnScreen;
                _nWaitAndStop            = 0;

                if (_cPreferences.cBackground != null)
                {
                    _stAreaComposite = new Area((short)(_cPreferences.stArea.nLeft - _cPreferences.cBackground.stArea.nLeft), (short)(_cPreferences.stArea.nTop - _cPreferences.cBackground.stArea.nTop), _cPreferences.stArea.nWidth, _cPreferences.stArea.nHeight);
                    _cRoll.stArea    = _cPreferences.cBackground.stArea;

                    _cAnimIn = new Animation(_cPreferences.cBackground.sIn, 1, false);
                    _cAnimIn.Prepare();
                    _cAnimLoop = new Animation(_cPreferences.cBackground.sLoop, 0, true);
                    _cAnimLoop.Prepare();
                    _cAnimOut = new Animation(_cPreferences.cBackground.sOut, 1, false);
                    _cAnimOut.Prepare();
                    _cPLBackground = new Playlist();
                    _cPLBackground.bStopOnEmpty = true;
                    _cPLBackground.EffectAdd(_cAnimIn);
                    _cPLBackground.EffectAdd(_cAnimLoop);
                    _cPLBackground.EffectAdd(_cAnimOut);
                    _cPLBackground.Prepare();

                    if (_cPreferences.cBackground.sMaskIn != null && _cPreferences.cBackground.sMaskIn.Length > 0)
                    {
                        _cMaskIn = new Animation(_cPreferences.cBackground.sMaskIn, 1, false);
                        _cMaskIn.Prepare();
                        _cMaskLoop = new Animation(_cPreferences.cBackground.sMaskLoop, 0, true);
                        _cMaskLoop.Prepare();
                        _cMaskOut = new Animation(_cPreferences.cBackground.sMaskOut, 1, false);
                        _cMaskOut.Prepare();
                        _cMaskAllOff = new Animation(_cPreferences.cBackground.sMaskAllOff, 0, true);
                        _cMaskAllOff.Prepare();
                        _cPLMask = new Playlist();
                        _cPLMask.bStopOnEmpty = false;
                        _cPLMask.EffectAdd(_cMaskIn);
                        _cPLMask.EffectAdd(_cMaskLoop);
                        _cPLMask.EffectAdd(_cMaskOut);
                        _cPLMask.EffectAdd(_cMaskAllOff);
                        _cPLMask.Prepare();
                    }
                }
                else
                {
                    _stAreaComposite = new Area(0, 0, _cPreferences.stArea.nWidth, _cPreferences.stArea.nHeight);
                }
                _cRoll.Prepare();


                _aItems        = new List <Item>();
                _cTimerRequest = new System.Threading.Timer(TickRequest);
                TickRequest(null);
                _cRollFeed = new Thread(RollFeed);
                _cRollFeed.IsBackground = true;
                _cRollFeed.Start();
                _cTimerStop = new System.Threading.Timer(AsyncStop);
                if (null != Prepared)
                {
                    Plugin.EventSend(Prepared, this);
                }
                (new Logger()).WriteDebug3("ok");
            }
            catch (Exception ex)
            {
                (new Logger()).WriteError(ex);
            }
        }