예제 #1
0
 public static Lineup FindLineupById(long id)
 {
     using (Lineups lineups = new Lineups(objectStore_))
     {
         return lineups[id];
     }
 }
예제 #2
0
 static Lineup FindQAMLineup()
 {
     Lineups lineups = new Lineups(ChannelEditing.object_store);
     foreach(Lineup lineup in lineups)
     {
         if (lineup.Name == "Scanned (Digital Cable (ClearQAM))")
         {
             return lineup;
         }
     }
     throw new Exception("QAM lineup not found");
 }
예제 #3
0
 public static Lineup FindLineupByUID(string uid)
 {
     using (Lineups lineups = new Lineups(objectStore_))
     {
         foreach (Lineup lineup in lineups)
         {
             if (Misc.UidsContainsIdValue(lineup, uid))
                 return lineup;
         }
         return null;
     }
 }
예제 #4
0
        static Lineup FindQAMLineup()
        {
            Lineups lineups = new Lineups(ChannelEditing.object_store);

            foreach (Lineup lineup in lineups)
            {
                if (lineup.Name == "Scanned (Digital Cable (ClearQAM))")
                {
                    return(lineup);
                }
            }
            throw new Exception("QAM lineup not found");
        }
예제 #5
0
            public List <Lineup> GetWMCScannedLineupsBySDLineupID(string sd_lineup_id)
            {
                var           wmc_lineups = new Lineups(ChannelEditing.object_store);
                List <Lineup> result      = new List <Lineup>();

                foreach (var scanned_lineup in scanned_lineups)
                {
                    if (scanned_lineup.sd_lineup_id == sd_lineup_id)
                    {
                        result.Add(wmc_lineups[scanned_lineup.id]);
                    }
                }
                return(result);
            }
예제 #6
0
 public static Lineup FindLineupByUID(string uid)
 {
     using (Lineups lineups = new Lineups(objectStore_))
     {
         foreach (Lineup lineup in lineups)
         {
             if (Misc.UidsContainsIdValue(lineup, uid))
             {
                 return(lineup);
             }
         }
         return(null);
     }
 }
예제 #7
0
 internal static void ListProviders()
 {
     using (Providers providers = new Providers(ChannelEditing.object_store))
     {
         foreach (Provider provider in providers)
         {
             Console.WriteLine("Copyright: {0} DisplayName: {1} Id: {2} Name: {3} Provider: {4} Uids: {5}",
                               provider.Copyright, provider.DisplayName, provider.Id, provider.Name, provider.Provider,
                               Misc.UidsToString(provider.UIds));
         }
     }
     using (Lineups lineups = new Lineups(ChannelEditing.object_store))
     {
         foreach (Lineup lineup in lineups)
         {
             Console.WriteLine("Lineup ID: {0} Name: {1} UIDs: {2} Provider: {3}",
                               lineup.Id, lineup.Name, Misc.UidsToString(lineup.UIds), lineup.Provider);
         }
     }
 }
예제 #8
0
 internal static void ListProviders()
 {
     using (Providers providers = new Providers(ChannelEditing.object_store))
     {
         foreach(Provider provider in providers)
         {
             Console.WriteLine("Copyright: {0} DisplayName: {1} Id: {2} Name: {3} Provider: {4} Uids: {5}",
                 provider.Copyright, provider.DisplayName, provider.Id, provider.Name, provider.Provider,
                 Misc.UidsToString(provider.UIds));
         }
     }
     using (Lineups lineups = new Lineups(ChannelEditing.object_store))
     {
         foreach(Lineup lineup in lineups)
         {
             Console.WriteLine("Lineup ID: {0} Name: {1} UIDs: {2} Provider: {3}",
                 lineup.Id, lineup.Name, Misc.UidsToString(lineup.UIds), lineup.Provider);
         }
     }
 }
예제 #9
0
            internal Lineup FindOrFixScannedLineupAssociation()
            {
                var wmc_lineups = new Lineups(ChannelEditing.object_store);

                foreach (Lineup lineup in wmc_lineups)
                {
                    if (lineup.Id == id)
                    {
                        return(lineup);
                    }
                }
                foreach (Lineup lineup in wmc_lineups)
                {
                    if (lineup.Name == name)
                    {
                        name = lineup.Name;
                        MessageBox.Show("Scanned lineup with ID matching config not found, but matched by name.  Was TV Setup Rerun?");
                        return(lineup);
                    }
                }
                return(null);
            }
예제 #10
0
        public static void matchLineups()
        {
            // get all active channels in lineup(s) from EPG123
            List <Channel> epg123Channels = new List <Channel>();

            using (Lineups lineups = new Lineups(Store.objectStore))
            {
                foreach (Lineup lineup in lineups)
                {
                    if (lineup.Name.StartsWith("EPG123") && !lineup.Name.Equals(lu_name))
                    {
                        epg123Channels.AddRange(lineup.GetChannels());
                    }
                }
            }

            // ensure there are channels to match to
            if (epg123Channels.Count == 0)
            {
                Logger.WriteError("There are no EPG123 listings in the database to perform any mappings.");
                return;
            }

            foreach (Channel channel in Store.mergedLineup.GetChannels())
            {
                MergedChannel mergedChannel;
                try
                {
                    mergedChannel = (MergedChannel)channel;
                }
                catch
                {
                    continue;
                }
                if (mergedChannel.ChannelType == ChannelType.UserHidden)
                {
                    continue;
                }

                // using the mergedchannel channel number, determine whether to match&enable, unmatch&disable, disable, or nothing
                Channel epg123Channel = null;
                using (Lineups lineups = new Lineups(Store.objectStore))
                {
                    foreach (Lineup lineup in lineups)
                    {
                        if (!lineup.Name.StartsWith("EPG123") || lineup.Name.Equals(lu_name))
                        {
                            continue;
                        }

                        while ((epg123Channel = lineup.GetChannelFromNumber(mergedChannel.OriginalNumber, mergedChannel.OriginalSubNumber)) != null)
                        {
                            if (channelsContain(ref epg123Channels, ref epg123Channel))
                            {
                                break;
                            }
                            else
                            {
                                Logger.WriteVerbose(string.Format("Removing {0} from channel {1} in lineup {2}.", epg123Channel.CallSign, mergedChannel.ChannelNumber, lineup.Name));
                                lineup.RemoveChannel(epg123Channel);
                                lineup.Update();
                            }
                        }
                        if (epg123Channel != null)
                        {
                            break;
                        }
                    }
                }

                // perform match if not already primary channel
                if ((epg123Channel != null) && !mergedChannel.PrimaryChannel.IsSameAs(epg123Channel))
                {
                    try
                    {
                        if (mergedChannel.PrimaryChannel.Lineup.Name.StartsWith("Scanned"))
                        {
                            Logger.WriteVerbose(string.Format("Matching {0} to channel {1}", epg123Channel.CallSign, mergedChannel.ChannelNumber));

                            // add this channel lineup to the device group if necessary
                            foreach (Device device in mergedChannel.Lineup.DeviceGroup.Devices)
                            {
                                try
                                {
                                    if (!device.Name.ToLower().Contains("delete") &&
                                        (device.ScannedLineup != null) && device.ScannedLineup.IsSameAs(mergedChannel.PrimaryChannel.Lineup) &&
                                        ((device.WmisLineups == null) || !device.WmisLineups.Contains(epg123Channel.Lineup)))
                                    {
                                        device.SubscribeToWmisLineup(epg123Channel.Lineup);
                                        device.Update();
                                    }
                                }
                                catch (Exception ex)
                                {
                                    Logger.WriteVerbose(string.Format("Failed to associate lineup {0} with device {1} ({2}). {3}", epg123Channel.Lineup,
                                                                      device.Name ?? "NULL", (device.ScannedLineup == null) ? "NULL" : device.ScannedLineup.Name, ex.Message));
                                }
                            }

                            // update primary channel and service
                            if (!mergedChannel.SecondaryChannels.Contains(mergedChannel.PrimaryChannel))
                            {
                                mergedChannel.SecondaryChannels.Add(mergedChannel.PrimaryChannel);
                            }
                            mergedChannel.PrimaryChannel   = epg123Channel;
                            mergedChannel.Service          = epg123Channel.Service;
                            mergedChannel.UserBlockedState = UserBlockedState.Enabled;
                            mergedChannel.Update();
                        }
                        else
                        {
                            Logger.WriteVerbose(string.Format("Skipped matching {0} to channel {1} due to channel already having an assigned listing.",
                                                              epg123Channel.CallSign, mergedChannel.ChannelNumber));
                        }
                    }
                    catch (Exception ex)
                    {
                        string prefix = string.Format("Error trying to match {0} to channel {1}.", epg123Channel.CallSign, mergedChannel.ChannelNumber);

                        // report the channels that contain errors
                        if (mergedChannel.PrimaryChannel == null)
                        {
                            Logger.WriteError(string.Format("{0} PrimaryChannel is null. {1}", prefix, ex.Message));
                        }
                        else if (mergedChannel.PrimaryChannel.Lineup == null)
                        {
                            Logger.WriteError(string.Format("{0} PrimaryChannel.Lineup is null. {1}", prefix, ex.Message));
                        }
                        else if (mergedChannel.PrimaryChannel.Lineup.Name == null)
                        {
                            Logger.WriteError(string.Format("{0} PrimaryChannel.Lineup.Name is null. {1}", prefix, ex.Message));
                        }
                        else
                        {
                            Logger.WriteError(prefix + " " + ex.Message);
                        }
                    }
                }
                else if ((mergedChannel.UserBlockedState < UserBlockedState.Blocked) && mergedChannel.PrimaryChannel.Lineup.Name.StartsWith("Scanned"))
                {
                    // disable the channel in the guide
                    mergedChannel.UserBlockedState = UserBlockedState.Blocked;
                    mergedChannel.Update();
                }

                // finish it
                Store.mergedLineup.FullMerge(false);
                Store.mergedLineup.Update();
            }
        }
예제 #11
0
 public static bool IsLineupInLineups(Lineups lineups, Lineup lineup)
 {
     foreach (Lineup l in lineups)
         if (AreSameLineup(l, lineup)) return true;
     return false;
 }