/// <summary> /// Erzeugt eine neue Zugriffsinstanz. /// </summary> /// <param name="main">Die zugehörige Anwendung.</param> /// <param name="streamIndex">Teilaufzeichnung, die betrachtet werden soll.</param> /// <param name="timeshift">Gesetzt, wenn der Timeshift Modus aktiviert werden soll.</param> public VCRAdaptor(IViewerSite main, int streamIndex, bool timeshift) : base(main) { // Connect to alternate interfaces ChannelInfo = (IChannelInfo)main; StreamInfo = (IStreamInfo)main; // Remember m_Profile = RemoteInfo.VCRProfile; // Use default if (string.IsNullOrEmpty(m_Profile)) { m_Profile = "*"; } // Construct Url var uri = RemoteInfo.ServerUri; // Connect to stream Connect(StreamInfo.BroadcastIP, StreamInfo.BroadcastPort, uri.Host); // Find all current activities var activities = VCRNETRestProxy.GetActivitiesForProfile(EndPoint, Profile); if (activities.Count < 1) { StartLIVE(true); } else { // Find the activity var current = activities.FirstOrDefault(activity => activity.streamIndex == streamIndex); if (current == null) { StartWatch(null, true); } else if (timeshift && string.IsNullOrEmpty(StreamInfo.BroadcastIP) && (current.files.Length > 0)) { StartReplay(current.files[0], current.name, current, true); } else { StartWatch(string.Format("dvbnet:{0}", streamIndex), true); } } }
/// <summary> /// Ermittelt die Liste der verfügbaren Aufzeichnungen. /// </summary> public override void LoadStations() { // Index to set default upon int startupIndex = -1; // Special if (m_StartupStation != null) { if (m_StartupStation.StartsWith("dvbnet:")) { // Get the index startupIndex = int.Parse(m_StartupStation.Substring(7)); // No direct default m_StartupStation = null; } } // Reset current channel m_DefaultStation = m_StartupStation; m_StartupStation = null; // Forbid restriction on channels Favorites.DisableFavorites(); // All names already in use var duplicates = new Dictionary <string, int>(); // Find all current activities foreach (var activity in VCRNETRestProxy.GetActivitiesForProfile(Adaptor.EndPoint, Profile)) { // Create the information record var item = new JobScheduleInfo(activity); var name = activity.name; // Read counter int cnt; if (duplicates.TryGetValue(name, out cnt)) { name = string.Format("{0} ({1})", name, cnt); } else { cnt = 0; } // Store back duplicates[name] = ++cnt; // Add to list Favorites.AddChannel(name, item); // Remember if (m_DefaultStation == null) { if ((startupIndex < 0) || (startupIndex == activity.streamIndex)) { m_DefaultStation = name; } } } // Finish Favorites.FillChannelList(); }