当前位置: 首页>>代码示例>>C#>>正文


C# Channel.Persist方法代码示例

本文整理汇总了C#中TvDatabase.Channel.Persist方法的典型用法代码示例。如果您正苦于以下问题:C# Channel.Persist方法的具体用法?C# Channel.Persist怎么用?C# Channel.Persist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TvDatabase.Channel的用法示例。


在下文中一共展示了Channel.Persist方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ImportChannels

        /// <summary>
        /// Imports the channels.
        /// </summary>
        /// <param name="delay">The delay in ms between each record.</param>
        /// <returns></returns>
        public int ImportChannels(int delay)
        {
            ClearCache();

             ImportStats stats = new ImportStats();

             if (_lineupHasChanged && _remapChannelsOnLineupChange)
            VerifyChannelMapping(delay);

             // Refresh the channel cache
             _mpChannelCache = (IList)Channel.ListAll();

             foreach (SchedulesDirect.SoapEntities.TVLineup lineup in _results.Data.Lineups.List)
             {
            Log.WriteFile("Processing lineup {0} [id={1} type={2} postcode={3}]", lineup.Name, lineup.ID, lineup.Type, lineup.PostalCode);
            foreach (SchedulesDirect.SoapEntities.TVStationMap tvStationMap in lineup.StationMap)
            {
               if (ShowProgress != null)
                  ShowProgress(this, stats);

               SchedulesDirect.SoapEntities.TVStation tvStation = _results.Data.Stations.StationById(tvStationMap.StationId);
               if (tvStation == null)
               {
                  Log.WriteFile("Unable to find stationId #{0} specified in lineup", tvStationMap.StationId);
                  continue;
               }

               if (tvStationMap.ChannelMajor < 0)
               {
                  Log.WriteFile("TVStationMap ChannelMajor Not Valid. StationID: {3} ChannelMajor: {0} ChannelMinor: {1} SchedulesDirectChannel: {2}", tvStationMap.ChannelMajor, tvStationMap.ChannelMinor, tvStationMap.SchedulesDirectChannel, tvStationMap.StationId);
                  continue;
               }

               Channel mpChannel = FindTVChannel(tvStation, tvStationMap, lineup.IsLocalBroadcast());
               // Update the channel and map it
               if (mpChannel != null)
               {
                  mpChannel.GrabEpg = false;
                  mpChannel.LastGrabTime = DateTime.Now;
                  mpChannel.ExternalId = BuildXmlTvId(lineup.IsLocalBroadcast(), tvStation, tvStationMap);  //tvStation.ID + XMLTVID;
                  if (_renameChannels)
                  {
                     string oldName = mpChannel.DisplayName;
                     mpChannel.DisplayName = BuildChannelName(tvStation, tvStationMap);
                     mpChannel.DisplayName = BuildChannelName(tvStation, tvStationMap);
                     RenameLogo(oldName, mpChannel.DisplayName);
                  }
                  stats._iChannels++;

                  mpChannel.Persist();

                  Log.WriteFile("Updated channel {1} [id={0} xmlid={2}]", mpChannel.IdChannel, mpChannel.DisplayName, mpChannel.ExternalId);
               }
               else if ((_createChannels == true && lineup.IsAnalogue() == false)
                  || (_createChannels == true && _createAnalogChannels == true && lineup.IsAnalogue() == true))
               {
                  // Create the channel
                  string cname = BuildChannelName(tvStation, tvStationMap);
                  string xId   = BuildXmlTvId(lineup.IsLocalBroadcast(), tvStation, tvStationMap);

                  mpChannel = new Channel(false, true, 0, Schedule.MinSchedule, false, Schedule.MinSchedule, 10000, true, xId, cname);
                  mpChannel.Persist();

                  TvLibrary.Implementations.AnalogChannel tuningDetail = new TvLibrary.Implementations.AnalogChannel();

                  tuningDetail.IsRadio = false;
                  tuningDetail.IsTv = true;
                  tuningDetail.Name = cname;
                  tuningDetail.Frequency = 0;
                  tuningDetail.ChannelNumber = tvStationMap.ChannelMajor;

                  //(int)PluginSettings.ExternalInput;
                  //tuningDetail.VideoSource = PluginSettings.ExternalInput;
                  tuningDetail.VideoSource = _ExternalInput; // PluginSettings.ExternalInput;

                  // Too much overhead using settings directly for country
                  if (_ExternalInputCountry != null)
                     tuningDetail.Country = _ExternalInputCountry; // PluginSettings.ExternalInputCountry;

                  if (lineup.IsLocalBroadcast())
                     tuningDetail.TunerSource = DirectShowLib.TunerInputType.Antenna;
                  else
                     tuningDetail.TunerSource = DirectShowLib.TunerInputType.Cable;

                  //mpChannel.XMLId                  = tvStation.ID + XMLTVID;
                  //mpChannel.Name                   = BuildChannelName(tvStation, tvStationMap);
                  //mpChannel.AutoGrabEpg            = false;
                  //mpChannel.LastDateTimeEpgGrabbed = DateTime.Now;
                  //mpChannel.External               = true; // This may change with cablecard support one day
                  //mpChannel.ExternalTunerChannel   = tvStationMap.ChannelMajor.ToString();
                  //mpChannel.Frequency              = 0;
                  //mpChannel.Number                 = (int)PluginSettings.ExternalInput;

                  tvLayer.AddTuningDetails(mpChannel, tuningDetail);

//.........这里部分代码省略.........
开发者ID:ijprest,项目名称:mp-schedulesdirect,代码行数:101,代码来源:EpgListingsImporter.cs

示例2: btnPlaylist_Click

 private void btnPlaylist_Click(object sender, EventArgs e)
 {
   OpenFileDialog dlg = new OpenFileDialog();
   dlg.AddExtension = false;
   dlg.CheckFileExists = true;
   dlg.CheckPathExists = true;
   dlg.Filter = "playlists (*.m3u;*.pls;*.b4s;*.wpl)|*.m3u;*.pls;*.b4s;*.wpl";
   dlg.Multiselect = false;
   dlg.Title = "Select the playlist file to import";
   if (dlg.ShowDialog(this) != DialogResult.OK)
     return;
   IPlayListIO listIO = PlayListFactory.CreateIO(dlg.FileName);
   PlayList playlist = new PlayList();
   if (!listIO.Load(playlist, dlg.FileName))
   {
     MessageBox.Show("There was an error parsing the playlist file", "Error", MessageBoxButtons.OK,
                     MessageBoxIcon.Error);
     return;
   }
   TvBusinessLayer layer = new TvBusinessLayer();
   int iInserted = 0;
   foreach (PlayListItem item in playlist)
   {
     if (string.IsNullOrEmpty(item.FileName))
       continue;
     if (string.IsNullOrEmpty(item.Description))
       item.Description = item.FileName;
     Channel channel = new Channel(true, false, 0, Schedule.MinSchedule, false,
                                   Schedule.MinSchedule, 10000, true, "", item.Description);
     channel.Persist();
     layer.AddWebStreamTuningDetails(channel, item.FileName, 0);
     layer.AddChannelToRadioGroup(channel, TvConstants.RadioGroupNames.AllChannels);
     iInserted++;
   }
   MessageBox.Show("Imported " + iInserted + " new channels from playlist");
   OnSectionActivated();
 }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:37,代码来源:RadioChannels.cs


注:本文中的TvDatabase.Channel.Persist方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。