From: <do...@us...> - 2011-05-27 09:12:14
|
Revision: 4229 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4229&view=rev Author: dot-i Date: 2011-05-27 09:12:05 +0000 (Fri, 27 May 2011) Log Message: ----------- Updated to For The Record 1.6.0.0 code (for MediaPortal 1.2 Beta). Modified Paths: -------------- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLink.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLinks.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/LinkedMediaPortalChannel.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateChannelLinkForm.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/DvbEpgThread.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/AssemblyInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SettingName.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/FinishPage.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsContext.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPage.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPageBase.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsWizard.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardForm.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardPage.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecordMain.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideSearchBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/HomeBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/MiniGuide.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Properties/AssemblyInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RecordedBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/SetupForm.Designer.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/SetupForm.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TVZapOSD.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TextId.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Translator.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvFullScreen.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuideDialog.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvHome.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvOSD.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvProgramInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvTeletextBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/UpcomingPrograms.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Utility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/WindowId.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_da.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_de.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_en.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_nl.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_pl.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_sv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ChannelProgramView.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ChannelProgramsList.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/CurrentAndNextProgramView.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/CurrentAndNextProgramsList.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/EditSchedule/EditScheduleController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/EditSchedule/EditScheduleModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/EditSchedule/TitleRuleTypeIndex.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Guide/ChannelPrograms.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Guide/GuideController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Guide/GuideModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Guide/GuideUpcomingProgram.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/KeepUntilControlUtility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/LiveStreamView.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/LiveStreamsList.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ProcessUtility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Properties/AssemblyInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/RecorderTunersCache.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Recordings/RecordingsController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Recordings/RecordingsModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ScheduleNamesCache.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/SearchGuide/SearchGuideController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/SearchGuide/SearchGuideModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/SerializableDictionary.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/SortableBindingList.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/UpcomingOrActiveProgramView.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/UpcomingOrActiveProgramsList.cs trunk/plugins/ForTheRecord/ReferencedAssemblies/Core.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Databases.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Dialogs.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Client.Common.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Entities.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.RecorderTuners.Common.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceAgents.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceContracts.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/PluginBase.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/SetupControls.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TVDatabase.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvBusinessLayer.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvControl.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvLibrary.Interfaces.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Utils.dll Added Paths: ----------- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_no.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_Active.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_ProgramInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_RadioGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_RadioGuideSearch.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_RadioHome.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_RecordedRadio.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_TvGuideSearch.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_Upcoming.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_Alert.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_AlertCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_AlertSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_AlertSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_Recording.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_RecordingCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_RecordingCancelledHistory.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_RecordingInConflict.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_RecordingSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_RecordingSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_RecordingSeriesCancelledHistory.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_RecordingSeriesInConflict.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_RecordingSeriesWithWarning.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_RecordingWithWarning.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_Suggestion.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_SuggestionCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_SuggestionSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_SuggestionSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_logo.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_Active.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_ProgramInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_RadioGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_RadioGuideSearch.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_RadioHome.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_RecordedRadio.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_TvGuideSearch.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_Upcoming.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_Alert.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_AlertCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_AlertSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_AlertSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_Recording.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_RecordingCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_RecordingCancelledHistory.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_RecordingInConflict.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_RecordingSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_RecordingSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_RecordingSeriesCancelledHistory.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_RecordingSeriesInConflict.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_RecordingSeriesWithWarning.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_RecordingWithWarning.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_Suggestion.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_SuggestionCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_SuggestionSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_SuggestionSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_hover_logo-noglow.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_logo.png trunk/plugins/ForTheRecord/ReferencedAssemblies/Common.Utils.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/WindowPlugins.dll Removed Paths: ------------- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/ Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLink.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLink.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLink.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify @@ -93,7 +93,5 @@ public int MPChannelId { get; set; } public string MPChannelName { get; set; } - - public string MPChannelDisplayName { get; set; } } } Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLinks.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLinks.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLinks.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify @@ -183,13 +183,13 @@ { TvDatabase.Channel mpChannel = GetChannelById(link.ChannelType, link.MPChannelId); if (mpChannel == null - || mpChannel.Name != link.MPChannelName) + || mpChannel.DisplayName != link.MPChannelName) { - mpChannel = GetChannelByName(link.ChannelType, link.MPChannelName); + bool duplicateChannelsFound; + mpChannel = GetChannelByDisplayName(link.ChannelType, link.MPChannelName, out duplicateChannelsFound); } if (mpChannel != null) { - link.MPChannelDisplayName = mpChannel.DisplayName; _linksById.Add(link.ChannelId, link); } } @@ -250,7 +250,7 @@ if (_linksById.ContainsKey(channelId)) { ChannelLink link = _linksById[channelId]; - return new LinkedMediaPortalChannel(link.MPChannelId, link.MPChannelName, link.MPChannelDisplayName); + return new LinkedMediaPortalChannel(link.MPChannelId, link.MPChannelName); } TvDatabase.Channel channel = GetChannelByDisplayName(channelType, displayName, @@ -259,7 +259,7 @@ { isAutoLinked = true; _autoLinkedMPChannels[channel.IdChannel] = true; - return new LinkedMediaPortalChannel(channel.IdChannel, channel.Name, channel.DisplayName); + return new LinkedMediaPortalChannel(channel.IdChannel, channel.DisplayName); } return null; @@ -280,7 +280,7 @@ foreach (ChannelLink link in _linksById.Values) { if (link.MPChannelId == channel.IdChannel - && link.MPChannelName == channel.Name) + && link.MPChannelName == channel.DisplayName) { return link; } @@ -316,8 +316,7 @@ try { ClearLinkedMediaPortalChannel(channel); - ChannelLink link = new ChannelLink(channel.ChannelType, channel.ChannelId, channel.DisplayName, mpChannel.IdChannel, mpChannel.Name); - link.MPChannelDisplayName = mpChannel.DisplayName; + ChannelLink link = new ChannelLink(channel.ChannelType, channel.ChannelId, channel.DisplayName, mpChannel.IdChannel, mpChannel.DisplayName); _linksById.Add(link.ChannelId, link); } finally @@ -382,12 +381,6 @@ return InternalGetChannelBy(channelType, "idChannel", id, out duplicateChannelsFound); } - private TvDatabase.Channel GetChannelByName(ChannelType channelType, string name) - { - bool duplicateChannelsFound; - return InternalGetChannelBy(channelType, "name", name, out duplicateChannelsFound); - } - private TvDatabase.Channel InternalGetChannelBy(ChannelType channelType, string columnName, object value, out bool duplicateChannelsFound) { SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(TvDatabase.Channel)); Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/LinkedMediaPortalChannel.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/LinkedMediaPortalChannel.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/LinkedMediaPortalChannel.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify @@ -26,15 +26,13 @@ { internal class LinkedMediaPortalChannel { - public LinkedMediaPortalChannel(int id, string name, string displayName) + public LinkedMediaPortalChannel(int id, string displayName) { this.Id = id; - this.Name = name; this.DisplayName = displayName; } public int Id { get; set; } - public string Name { get; set; } public string DisplayName { get; set; } } } Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateChannelLinkForm.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateChannelLinkForm.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateChannelLinkForm.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -185,14 +185,7 @@ public string ChannelName { - get - { - if (String.Equals(_channel.DisplayName, _channel.Name)) - { - return _channel.DisplayName; - } - return _channel.DisplayName + " (" + _channel.Name + ")"; - } + get { return _channel.DisplayName; } } } } Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/DvbEpgThread.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/DvbEpgThread.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/DvbEpgThread.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify @@ -18,6 +18,10 @@ * http://www.gnu.org/copyleft/gpl.html * */ + +// Uncomment this to enable RTSP-test code +//#define USE_FTR_RTSP + using System; using System.Collections.Generic; using System.Text; @@ -38,6 +42,9 @@ using ForTheRecord.ServiceAgents; using ForTheRecord.RecorderTuners.Common; using ForTheRecord.RecorderTuners.MediaPortalTvServer.Channels; +#if USE_FTR_RTSP +using ForTheRecord.StreamingServer.ServiceAgents; +#endif namespace ForTheRecord.RecorderTuners.MediaPortalTvServer { @@ -51,6 +58,11 @@ { private const string _ftrLiveUserName = "FTRLive"; +#if USE_FTR_RTSP + private const string _rtspUrlSuffixFormat = @"Live-Card{0}-{1}"; + private const string _rtspApplicationName = "MediaPortal TV Server"; +#endif + private object _liveStreamsLock = new object(); private Dictionary<string, LiveStream> _liveStreams = new Dictionary<string, LiveStream>(); private Dictionary<string, IUser> _liveStreamUsers = new Dictionary<string, IUser>(); @@ -60,6 +72,14 @@ get { return "MediaPortal TV Server"; } } +#if USE_FTR_RTSP + public override void Initialize(Guid recorderTunerId, string serverHostName, int tcpPort) + { + base.Initialize(recorderTunerId, serverHostName, tcpPort); + RegisterApplicationInRtspServer(true); + } +#endif + public override string AllocateCard(Channel channel, CardChannelAllocation[] alreadyAllocated, bool useReversePriority) { try @@ -132,7 +152,7 @@ // // Note: "!ChannelAlreadyAllocatedOn(alreadyAllocated, allocation.CardId, channelId)" was // not added since TV Server can record the same channel several times on the same transponder. - if (mpChannel.FreeToAir + if (card.DecryptLimit == 0 || CountNumTimesAllocated(alreadyAllocated, allocation.CardId) < card.DecryptLimit) { // Get the previously allocated channel and its tuning details and let's check if the @@ -192,15 +212,26 @@ public override string[] GetRecordingShares() { + return GetCardFolders(true); + } + + public override string[] GetTimeshiftShares() + { + return GetCardFolders(false); + } + + private static string[] GetCardFolders(bool getRecordingFolder) + { List<string> shares = new List<string>(); List<TvDatabase.Card> cards = Utility.GetAllCards(); foreach (TvDatabase.Card card in cards) { - if (!String.IsNullOrEmpty(card.RecordingFolder)) + string folder = getRecordingFolder ? card.RecordingFolder : card.TimeShiftFolder; + if (!String.IsNullOrEmpty(folder)) { - string uncRecordingFolder = Common.ShareExplorer.GetUncPathForLocalPath(card.RecordingFolder); - shares.Add(String.IsNullOrEmpty(uncRecordingFolder) ? card.RecordingFolder : uncRecordingFolder); + string uncRecordingFolder = Common.ShareExplorer.GetUncPathForLocalPath(folder); + shares.Add(String.IsNullOrEmpty(uncRecordingFolder) ? folder : uncRecordingFolder); } else { @@ -213,7 +244,7 @@ #region Live TV/Radio - public override LiveStreamResult TuneLiveStream(Channel channel, ref LiveStream liveStream) + public override LiveStreamResult TuneLiveStream(Channel channel, CardChannelAllocation upcomingRecordingAllocation, ref LiveStream liveStream) { try { @@ -231,7 +262,7 @@ { if (card.IdCard == tve3User.CardId) { - if (Utility.CardFreeOrUsingSameTransponder(card.IdCard, mpChannel, tve3User)) + if (Utility.CardFreeOrUsingSameTransponder(card, mpChannel, tve3User)) { Log("TuneLiveTvStream(): tuning on card {0} {1}", card.IdCard, card.Name); lock (_liveStreamsLock) @@ -262,7 +293,7 @@ foreach (TvDatabase.Card card in availableCards) { if (!Utility.IsInSameHybridGroup(card, inUseHybridGroups) - && Utility.CardFreeOrUsingSameTransponder(card.IdCard, mpChannel)) + && Utility.CardFreeOrUsingSameTransponder(card, mpChannel)) { string userName = String.Format(CultureInfo.InvariantCulture, "{0}{1}", _ftrLiveUserName, Guid.NewGuid()); @@ -312,6 +343,10 @@ string tsBufferFile = GetTsBufferFile(tve3User); liveStream = new LiveStream(channel, rtspUrl); liveStream.TimeshiftFile = tsBufferFile; +#if USE_FTR_RTSP + string rtspUrlSuffix = String.Format(_rtspUrlSuffixFormat, tve3User.CardId, tve3User.SubChannel); + liveStream.RtspUrl = StartRtspStream(tsBufferFile, rtspUrlSuffix); +#endif } liveStream.Channel = channel; liveStream.CardId = tve3User.CardId.ToString(CultureInfo.InvariantCulture); @@ -348,7 +383,7 @@ } else { - Log(TraceEventType.Error, "StartTimeShifting(): no tuning channel found for {0}", mpChannel.Name); + Log(TraceEventType.Error, "StartTimeShifting(): no tuning channel found for {0}", mpChannel.DisplayName); return LiveStreamResult.ChannelTuneFailed; } } @@ -362,6 +397,11 @@ if (_liveStreams.ContainsKey(liveStream.RtspUrl)) { IUser tve3User = _liveStreamUsers[liveStream.RtspUrl]; + +#if USE_FTR_RTSP + StopRtspStream(liveStream); +#endif + if (TvServerPlugin.TvController_IsTimeShifting(ref tve3User)) { if (!TvServerPlugin.TvController_StopTimeShifting(ref tve3User)) @@ -519,7 +559,7 @@ foreach (TvDatabase.Card card in availableCards) { if (!Utility.IsInSameHybridGroup(card, inUseHybridGroups) - && Utility.CardFreeOrUsingSameTransponder(card.IdCard, mpChannel, tve3User)) + && Utility.CardFreeOrUsingSameTransponder(card, mpChannel, tve3User)) { IChannel tuningChannel = Utility.FindTuningChannelOnCard(mpChannel, card.IdCard); if (tuningChannel != null) @@ -748,5 +788,65 @@ } #endregion + + #region RTSP + +#if USE_FTR_RTSP + private bool RegisterApplicationInRtspServer(bool logError) + { + bool succeeded = StreamingServerHost.Instance.RegisterApplication(_rtspApplicationName); + if (!succeeded && logError) + { + TvLibrary.Log.Log.Error("Couldn't reach RTSP-server to register {0}.", _rtspApplicationName); + } + return succeeded; + } + + private string StartRtspStream(string filePath, string rtspUrlSuffix) + { + string streamUri = null; + // Ensure RTSP-Server is up and running, and we are registered + if (RegisterApplicationInRtspServer(false)) + { + try + { + using (StreamingServiceAgent streamingServiceAgent = new StreamingServiceAgent()) + { + streamUri = streamingServiceAgent.AddStream(filePath, rtspUrlSuffix); + } + } + catch (Exception ex) + { + TvLibrary.Log.Log.Error(ex.Message); + } + } + return streamUri; + } + + private void StopRtspStream(LiveStream stream) + { + // Ensure RTSP-Server is up and running, and we are registered + if (RegisterApplicationInRtspServer(false)) + { + try + { + using (StreamingServiceAgent streamingServiceAgent = new StreamingServiceAgent()) + { + // "rtsp://MEDIASERVER:554/ForTheRecord-Argus-Card2-2" + int index = stream.RtspUrl.LastIndexOf('/') + 1; + string rtspUrlSuffix = stream.RtspUrl.Substring(index); + streamingServiceAgent.RemoveStream(rtspUrlSuffix); + //Logger.Info("Stopped RTSP-Stream " + rtspUrlSuffix); + } + } + catch (Exception ex) + { + TvLibrary.Log.Log.Error(ex.Message); + } + } + } +#endif + + #endregion } } Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/AssemblyInfo.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/AssemblyInfo.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -2,6 +2,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using MediaPortal.Common.Utils; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information @@ -9,9 +10,9 @@ [assembly: AssemblyTitle("ForTheRecord.RecorderTuners.MediaPortalTvServer")] [assembly: AssemblyDescription("For The Record MediaPortal TV Server plugin")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("For The Record")] [assembly: AssemblyProduct("ForTheRecord.RecorderTuners.MediaPortalTvServer")] -[assembly: AssemblyCopyright("Copyright © ForTheRecord 2007-2010")] +[assembly: AssemblyCopyright("Copyright © For The Record 2007-2011")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -34,3 +35,6 @@ // by using the '*' as shown below: [assembly: AssemblyVersion(ForTheRecord.Entities.Constants.AssemblyVersion)] [assembly: AssemblyFileVersion(ForTheRecord.Entities.Constants.AssemblyVersion)] + +// MediaPortal version +[assembly: CompatibleVersion("1.1.7.0")] Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify @@ -25,7 +25,6 @@ using System.Threading; using System.Diagnostics; using System.Globalization; -using System.Runtime.InteropServices; using TvLibrary.Interfaces; using TvEngine.Events; @@ -55,7 +54,6 @@ _suggestedBaseFileName = suggestedBaseFileName; _recordOnCard = recordOnCard; _channel = channel; - SetThreadExecutionState(EXECUTION_STATE.ES_CONTINUOUS | EXECUTION_STATE.ES_SYSTEM_REQUIRED | EXECUTION_STATE.ES_AWAYMODE_REQUIRED); } #region Overrides @@ -64,19 +62,13 @@ { get { - return new TimeSpan(0, 3, 0); + return new TimeSpan(0, 2, 0); } } private IUser _tve3User; private string _tve3RecordingFileName; - protected override void OnThreadEnding() - { - base.OnThreadEnding(); - SetThreadExecutionState(EXECUTION_STATE.ES_CONTINUOUS); - } - protected override bool OnPrepareRecording(RecorderTunerCallbackServiceAgent callbackAgent, ref string errorMessage) { DeleteAllMediaPortalSchedules(); @@ -104,7 +96,7 @@ string fileName = Path.Combine(_recordOnCard.RecordingFolder, baseFileName); string extension = (_recordOnCard.RecordingFormat == 0) ? ".ts" : ".mpg"; - _tve3RecordingFileName = Common.Utility.GetFreeFileName(fileName, extension); + _tve3RecordingFileName = Common.Utility.GetFreeFileName(fileName, extension, 0); string tve3RecordingDirectory = Path.GetDirectoryName(_tve3RecordingFileName); if (!Directory.Exists(tve3RecordingDirectory)) { @@ -207,7 +199,7 @@ if (cardUsers != null) { TvDatabase.TuningDetail tuning = Utility.FindTuningDetailOnCard(_channel, _recordOnCard.IdCard); - foreach (User cardUser in cardUsers) + foreach (IUser cardUser in cardUsers) { if (!cardUser.Name.Equals("epg", StringComparison.InvariantCultureIgnoreCase)) { @@ -299,21 +291,5 @@ } #endregion - - #region P/Invoke - - [FlagsAttribute] - private enum EXECUTION_STATE : uint - { - ES_SYSTEM_REQUIRED = 0x00000001, - ES_DISPLAY_REQUIRED = 0x00000002, - ES_AWAYMODE_REQUIRED = 0x00000040, - ES_CONTINUOUS = 0x80000000 - } - - [DllImport("Kernel32.DLL", CharSet = CharSet.Auto, SetLastError = true)] - private extern static EXECUTION_STATE SetThreadExecutionState(EXECUTION_STATE state); - - #endregion } } Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SettingName.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SettingName.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SettingName.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify @@ -469,10 +469,6 @@ else { message = "Linked to " + linkedChannel.DisplayName; - if (!String.Equals(linkedChannel.DisplayName, linkedChannel.Name)) - { - message += " (" + linkedChannel.Name + ")"; - } rowColor = Color.DarkGreen; } } Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify @@ -407,7 +407,7 @@ TvDatabase.Channel mpChannel = layer.GetChannelByTuningDetail(dvbChannel.NetworkId, dvbChannel.TransportId, dvbChannel.ServiceId); if (mpChannel != null) { - Log.Debug("ForTheRecord.RecorderTuners.MediaPortalTvServer: ImportEpgPrograms(): received {0} programs on {1}", epgChannel.Programs.Count, mpChannel.Name); + Log.Debug("ForTheRecord.RecorderTuners.MediaPortalTvServer: ImportEpgPrograms(): received {0} programs on {1}", epgChannel.Programs.Count, mpChannel.DisplayName); using (ForTheRecordServiceAgent forTheRecordAgent = new ForTheRecordServiceAgent()) using (TvSchedulerServiceAgent tvSchedulerAgent = new TvSchedulerServiceAgent()) @@ -474,7 +474,7 @@ string externalId = mpChannel.ExternalId; if (String.IsNullOrEmpty(externalId)) { - externalId = mpChannel.Name; + externalId = mpChannel.DisplayName; } channel.GuideChannelId = tvGuideAgent.EnsureChannel(externalId, mpChannel.DisplayName, channel.ChannelType); tvSchedulerAgent.AttachChannelToGuide(channel.ChannelId, channel.GuideChannelId.Value); Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify @@ -78,7 +78,7 @@ IChannel tuningChannel = null; try { - List<IChannel> tunings = new TvDatabase.TvBusinessLayer().GetTuningChannelByName(channel); + List<IChannel> tunings = new TvDatabase.TvBusinessLayer().GetTuningChannelsByDbChannel(channel); foreach (IChannel tuning in tunings) { if (TvServerPlugin.TvController_CanTune(cardId, tuning)) @@ -220,29 +220,39 @@ return groupIds; } - public static bool CardFreeOrUsingSameTransponder(int cardId, TvDatabase.Channel channel) + public static bool CardFreeOrUsingSameTransponder(TvDatabase.Card card, TvDatabase.Channel channel) { - return CardFreeOrUsingSameTransponder(cardId, channel, null); + return CardFreeOrUsingSameTransponder(card, channel, null); } - public static bool CardFreeOrUsingSameTransponder(int cardId, TvDatabase.Channel channel, IUser userToIgnore) + public static bool CardFreeOrUsingSameTransponder(TvDatabase.Card card, TvDatabase.Channel channel, IUser userToIgnore) { - IUser[] cardUsers = TvServerPlugin.TvController_GetUsersForCard(cardId); + IUser[] cardUsers = TvServerPlugin.TvController_GetUsersForCard(card.IdCard); if (cardUsers != null) { - TvDatabase.TuningDetail tuning = Utility.FindTuningDetailOnCard(channel, cardId); + TvDatabase.TuningDetail tuning = Utility.FindTuningDetailOnCard(channel, card.IdCard); + + HashSet<int> activeChannels = new HashSet<int>(); + foreach (IUser cardUser in cardUsers) { if (userToIgnore == null || cardUser.Name != userToIgnore.Name) { - if (!cardUser.Name.Equals("epg", StringComparison.InvariantCultureIgnoreCase) - && !Utility.IsSameTransponder(cardId, tuning, cardUser.IdChannel)) + if (!cardUser.Name.Equals("epg", StringComparison.InvariantCultureIgnoreCase)) { - return false; + activeChannels.Add(cardUser.IdChannel); + if (!Utility.IsSameTransponder(card.IdCard, tuning, cardUser.IdChannel)) + { + return false; + } } } } + + return activeChannels.Contains(channel.IdChannel) + || card.DecryptLimit == 0 + || activeChannels.Count < card.DecryptLimit; } return true; } Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/FinishPage.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/FinishPage.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/FinishPage.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsContext.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsContext.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsContext.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPage.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPage.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPage.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPageBase.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPageBase.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPageBase.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsWizard.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsWizard.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsWizard.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardForm.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardForm.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardForm.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardPage.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardPage.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardPage.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -432,6 +432,7 @@ { if (recording == null) { + GUIPropertyManager.SetProperty("#TV.Active.Channel", String.Empty); GUIPropertyManager.SetProperty("#TV.Active.Title", String.Empty); GUIPropertyManager.SetProperty("#TV.Active.Genre", String.Empty); GUIPropertyManager.SetProperty("#TV.Active.Time", String.Empty); @@ -448,6 +449,7 @@ recording.Program.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat), recording.Program.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat)); + GUIPropertyManager.SetProperty("#TV.Active.Channel", recording.Program.Channel.DisplayName); GUIPropertyManager.SetProperty("#TV.Active.Title", recording.Program.Title); GUIPropertyManager.SetProperty("#TV.Active.Genre", recording.Program.Category); GUIPropertyManager.SetProperty("#TV.Active.Time", strTime); Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -75,6 +75,9 @@ private bool _autoFullScreen; private ManualResetEvent _waitForBlackScreenEvent; private int _framesBeforeStopRenderBlackImage; + private int _zapChannelNr = -1; + private static LiveStreamResult result = LiveStreamResult.UnknownError; + private int backupvolume = -1; public ChannelNavigator() { @@ -95,6 +98,7 @@ { Log.Debug("ChannelNavigator.RenderBlackImage()"); _waitForBlackScreenEvent.Reset(); + _framesBeforeStopRenderBlackImage = 0; GUIGraphicsContext.RenderBlackImage = true; _waitForBlackScreenEvent.WaitOne(1000, false); } @@ -104,7 +108,8 @@ { if (GUIGraphicsContext.RenderBlackImage) { - _framesBeforeStopRenderBlackImage = 3; + GUIGraphicsContext.RenderBlackImage = false; + // _framesBeforeStopRenderBlackImage = 3; // Ambass : we need to wait the 3rd frame to avoid persistance of previous channel....Why ????? // Morpheus: number of frames depends on hardware, from 1..5 or higher might be needed! // Probably the faster the graphics card is, the more frames required??? @@ -123,9 +128,9 @@ { if (GUIGraphicsContext.RenderBlackImage) { - Log.Debug("ChannelNavigator.OnVideoReceived() {0}", _framesBeforeStopRenderBlackImage); if (_framesBeforeStopRenderBlackImage > 0) { + Log.Debug("ChannelNavigator.OnVideoReceived() {0}", _framesBeforeStopRenderBlackImage); if (--_framesBeforeStopRenderBlackImage == 0) { GUIGraphicsContext.RenderBlackImage = false; @@ -184,6 +189,29 @@ } /// <summary> + /// Gets the channel number that we will zap to. If not zapping by number or not zapping to anything, returns -1. + /// </summary> + public int ZapChannelNr + { + get + { + return _zapChannelNr; + } + set + { + _zapChannelNr = value; + } + } + + public bool DoingChannelChange { get; set; } + public string TuningResult { get; set; } + + /// <summary> + /// returns true if we press a channel number + /// </summary> + public bool RefreshZapChannelNr { get; set; } + + /// <summary> /// Gets and sets the last viewed channel, null if there is none. /// </summary> public Channel GetPreviousChannel(ChannelType channelType) @@ -404,21 +432,21 @@ return false; } try - { + { _reentrant = true; - //UpdateCurrentChannel(); // Make sure current and next is up to date. KeepCurrentNextUpToDate(ChannelType.Television); KeepCurrentNextUpToDate(ChannelType.Radio); - // Zapping to another group or channel? + // Zapping to another group or channel? if (_zapGroup != null || _zapChannel != null) { // Time to zap? if (DateTime.Now >= _zapTime) { + Log.Debug("ChannelNavigator: CheckChannelChange()_DateTime.Now >= _zapTime,_zapgroup = {0} , _zapchannel = {1}", _zapGroup.GroupName, _zapChannel.DisplayName); // Zapping to another group? if (_zapGroup != null && _zapGroup != _currentChannelGroup) { @@ -439,6 +467,14 @@ // Zap to desired channel Channel zappingTo = _zapChannel; + + if (ForTheRecordMain.Navigator.CurrentChannel != null + && ForTheRecordMain.Navigator.CurrentChannel.ChannelId == zappingTo.ChannelId) + { + Log.Debug("ChannelNavigator: CheckChannelChange()_CurrentChannel.ChannelId = zappingTo.ChannelId --> break off zapping"); + zappingTo = null; + } + _zapChannel = null; if (zappingTo != null) @@ -454,10 +490,16 @@ _navigatorChannels[zappingTo.ChannelType].LastChannel = _currentChannel; _navigatorChannels[zappingTo.ChannelType].LastChannelGroup = _currentChannelGroup; } + _zapChannelNr = -1; + _reentrant = false; return true; } } } + catch (Exception ex) + { + Log.Error("ChannelNavigator: error CheckChannelChange() = {0}", ex.Message); + } finally { _reentrant = false; @@ -476,6 +518,10 @@ RefreshCurrentAndNext(channelType); } } + else + { + RefreshCurrentAndNext(channelType); + } } public bool ZapToChannelNumber(ChannelType channelType, int channelNr, bool useZapDelay) @@ -537,6 +583,7 @@ /// <param name="useZapDelay">If true, the configured zap delay is used. Otherwise it zaps immediately.</param> public void ZapToNextChannel(bool useZapDelay) { + _zapChannelNr = -1; if (_currentChannel != null) { ChannelType channelType = _currentChannel.ChannelType; @@ -560,6 +607,7 @@ /// <param name="useZapDelay">If true, the configured zap delay is used. Otherwise it zaps immediately.</param> public void ZapToPreviousChannel(bool useZapDelay) { + _zapChannelNr = -1; if (_currentChannel != null) { ChannelType channelType = _currentChannel.ChannelType; @@ -606,177 +654,311 @@ private LiveStream _liveStream; private LiveStream _pendingStopLiveStream; + private bool _liveStreamIsRtsp; private void TuneLiveStream(Channel channel) { + Log.Debug("ChannelNavigator: TuneLiveStream(), channel = {0}", channel.DisplayName); if (channel != null) { using (TvSchedulerServiceAgent tvSchedulerAgent = new TvSchedulerServiceAgent()) { - CurrentAndNextProgram currentAndNext = tvSchedulerAgent.GetCurrentAndNextForChannel(channel.ChannelId, false, null); + LiveStream liveStream = _liveStream; + CurrentAndNextProgram currentAndNext = tvSchedulerAgent.GetCurrentAndNextForChannel(channel.ChannelId, true, _liveStream);//null); + if (currentAndNext != null) { - LiveStream liveStream = _liveStream; + TuningResult = string.Empty; - if (liveStream != null) + if (currentAndNext.LiveState != ChannelLiveState.Tunable) { - try + //don't stop the previous channel, so the next tuning will be faster. + Log.Debug("ChannelNavigator: currentAndNext.LiveState != ChannelLiveState.Tunable"); + SetCurrentAndNext(currentAndNext.Channel.ChannelType, currentAndNext); + _currentChannel = channel; + this.DoingChannelChange = true; + RenderBlackImage(); + + //I don't know anything better + if (backupvolume == -1) { - RenderBlackImage(); + backupvolume = g_Player.Volume; + } + g_Player.Volume = 0; - bool resumeGraph = true; - g_Player.PauseGraph(); - g_Player.OnZapping(0x80); - - LiveStreamResult firstResult = LiveStreamResult.Succeeded; - LiveStreamResult result = LiveStreamResult.UnknownError; + if (currentAndNext.LiveState == ChannelLiveState.NoFreeCard || currentAndNext.LiveState == ChannelLiveState.NotTunable) + { + result = LiveStreamResult.NoFreeCardFound; + ... [truncated message content] |