Ejemplo n.º 1
0
        private void ScanForRequiredLogos()
        {
            ITVAccessService tas = TVAccessService.Instance;

            if (!tas.TestConnectionToTVService())
            {
                return;
            }
            channelLogosRequired = tas.GetChannelsBasic()
                                   .Where(ch => logos.FindLocation(ch.Title) == null)
                                   .ToList();
        }
Ejemplo n.º 2
0
        private void Init()
        {
            // load list of channel logos that we don't have yet
            logos = new ChannelLogos();
            ITVAccessService tas = TVAccessService.Instance;

            if (!tas.TestConnectionToTVService())
            {
                return;
            }
            channelLogosRequired = tas.GetChannelsBasic()
                                   .Where(ch => logos.FindLocation(ch.Title) == null)
                                   .ToList();

            // exit if we already got all logos
            if (channelLogosRequired.Count == 0)
            {
                Log.Trace("All channel logos already available, not downloading any...");
                return;
            }

            // try downloading them on starting and exit if successful
            if (PerformCheck())
            {
                return;
            }

            // setup timer
            backgroundTimer = new Timer()
            {
                AutoReset = true,
                Interval  = 60 * 60 * 1000,
            };
            backgroundTimer.Elapsed += new ElapsedEventHandler(TimerElapsed);
            backgroundTimer.Start();
        }
Ejemplo n.º 3
0
        private void cmdConnect_Click(object sender, EventArgs e)
        {
            if (CURRENT_IP == "127.0.0.1" || CURRENT_IP == "localhost")
            {
                mWebStreamClient = ChannelFactory <IWebStreamingService> .CreateChannel(new NetNamedPipeBinding()
                {
                    MaxReceivedMessageSize = 10000000
                }, new EndpointAddress("net.pipe://localhost/MPExtended/StreamingService"));

                mStreamClient = ChannelFactory <IStreamingService> .CreateChannel(new NetNamedPipeBinding()
                {
                    MaxReceivedMessageSize = 10000000
                }, new EndpointAddress("net.pipe://localhost/MPExtended/StreamingService"));

                mServiceClient = ChannelFactory <IMediaAccessService> .CreateChannel(new NetNamedPipeBinding()
                {
                    MaxReceivedMessageSize = 10000000
                }, new EndpointAddress("net.pipe://localhost/MPExtended/MediaAccessService"));

                mTvClient = ChannelFactory <ITVAccessService> .CreateChannel(new NetNamedPipeBinding()
                {
                    MaxReceivedMessageSize = 10000000
                }, new EndpointAddress("net.pipe://localhost/MPExtended/TVAccessService"));
            }
            else
            {
#pragma warning disable 0162
                mWebStreamClient = ChannelFactory <IWebStreamingService> .CreateChannel(new BasicHttpBinding(), new EndpointAddress("http://" + CURRENT_IP + ":4321/MPExtended/StreamingService"));

                mStreamClient = ChannelFactory <IStreamingService> .CreateChannel(new BasicHttpBinding(), new EndpointAddress("http://" + CURRENT_IP + ":4321/MPExtended/StreamingService"));

                mServiceClient = ChannelFactory <IMediaAccessService> .CreateChannel(new BasicHttpBinding(), new EndpointAddress("http://" + CURRENT_IP + ":4321/MPExtended/MediaAccessService"));

                mTvClient = ChannelFactory <ITVAccessService> .CreateChannel(new BasicHttpBinding(), new EndpointAddress("http://" + CURRENT_IP + ":4321/MPExtended/TVAccessService"));

#pragma warning restore 0162
            }

            Log("Initialized");

            // providers
            var config = mServiceClient.GetServiceDescription();
            movieProvider = config.AvailableMovieLibraries.First().Id;
            fileProvider  = config.AvailableFileSystemLibraries.First().Id;

            // load movies
            try
            {
                cbMovies.Items.Clear();
                mMovies = mServiceClient.GetMoviesDetailed(movieProvider, null, null);
                foreach (WebMovieDetailed movie in mMovies)
                {
                    cbMovies.Items.Add(movie.Title);
                }

                Log("Loaded movies");
            }
            catch (Exception)
            {
                Log("Failed to connect to MAS");
            }

            // load chanels
            try
            {
                cbChannels.Items.Clear();
                mChannels = new List <WebChannelBasic>();
                foreach (WebChannelGroup group in mTvClient.GetGroups())
                {
                    WebChannelBasic[] channels = mTvClient.GetChannelsBasic(group.Id).ToArray();
                    foreach (WebChannelBasic ch in channels)
                    {
                        cbChannels.Items.Add(ch.Title);
                        mChannels.Add(ch);
                    }
                }
                Log("Loaded channels");
            }
            catch (Exception)
            {
                Log("Failed to connect to TV4Home");
            }

            // load profiles
            try
            {
                cbProfiles.Items.Clear();
                mProfiles = mWebStreamClient.GetTranscoderProfiles();
                foreach (WebTranscoderProfile profile in mProfiles)
                {
                    cbProfiles.Items.Add(profile.Name);
                }
                cbProfiles.SelectedIndex = 0;
            }
            catch (Exception)
            {
                Log("Failed to load profiles");
            }
        }