コード例 #1
0
ファイル: WMModel.cs プロジェクト: psymon75/WebradioManager
        /**
        // \fn public bool UpdateTranscoder(WebradioTranscoder transcoder, bool debug, int webradioId)
        //
        // \brief Updates the transcoder.
        //
        // \author Simon Menetrey
        // \date 26.05.2014
        //
        // \param transcoder The transcoder.
        // \param debug      true to debug.
        // \param webradioId Identifier for the webradio.
        //
        // \return true if it succeeds, false if it fails.
        **/
        public bool UpdateTranscoder(WebradioTranscoder transcoder, bool debug, int webradioId)
        {
            try
            {
                bool wasRunning = false;
                if (transcoder.IsRunning())
                {
                    wasRunning = true;
                    transcoder.Process.Kill();
                }

                this.Bdd.UpdateTranscoder(transcoder);
                transcoder.GenerateConfigFile(this.Webradios[webradioId].Playlists);
                if (wasRunning)
                    transcoder.Start(debug);
                this.UpdateObservers(webradioId);
                return true;
            }
            catch
            {
                return false;
            }
        }
コード例 #2
0
ファイル: WMModel.cs プロジェクト: psymon75/WebradioManager
        /**
        // \fn public bool StartTranscoder(WebradioTranscoder transcoder, bool debug, int webradioId)
        //
        // \brief Starts a transcoder.
        //
        // \author Simon Menetrey
        // \date 26.05.2014
        //
        // \param transcoder The transcoder.
        // \param debug      true to debug.
        // \param webradioId Identifier for the webradio.
        //
        // \return true if it succeeds, false if it fails.
        **/
        public bool StartTranscoder(WebradioTranscoder transcoder, bool debug, int webradioId)
        {
            try
            {
                if (transcoder.Start(debug))
                {
                    this.ActiveTranscoders.Add(transcoder);
                    UpdateObservers(webradioId);
                    return true;
                }
                else
                    return false;

            }
            catch
            {
                return false;
            }
        }