From efd7e2deeebe479e372968e519196cc69734b2e6 Mon Sep 17 00:00:00 2001 From: Dan Garner Date: Mon, 21 Nov 2022 17:46:22 +0000 Subject: [PATCH 1/8] Schedule: Protect against out of memory issues #278 --- Logic/ScheduleManager.cs | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/Logic/ScheduleManager.cs b/Logic/ScheduleManager.cs index d89c1bf..d661561 100644 --- a/Logic/ScheduleManager.cs +++ b/Logic/ScheduleManager.cs @@ -912,7 +912,15 @@ private List ResolveNormalAndInterrupts(List schedul normalIndex = 0; } resolved.Add(resolvedNormal[normalIndex]); - totalSecondsAllocated += resolvedNormal[normalIndex].Duration; + + // Protect against a schedule not having a duration (assume 60) + int duration = resolvedNormal[normalIndex].Duration; + if (duration <= 0) + { + duration = 60; + } + + totalSecondsAllocated += duration; normalIndex++; } @@ -1203,19 +1211,6 @@ private ScheduleItem ParseNodeIntoScheduleItem(XmlNode node) } } - // Duration - if (attributes["duration"] != null) - { - try - { - temp.Duration = int.Parse(attributes["duration"].Value); - } - catch - { - temp.Duration = 0; - } - } - // Cycle playback try { @@ -1239,6 +1234,19 @@ private ScheduleItem ParseNodeIntoScheduleItem(XmlNode node) } } + // Duration (might exist on the default node too) + if (attributes["duration"] != null) + { + try + { + temp.Duration = int.Parse(attributes["duration"].Value); + } + catch + { + temp.Duration = 0; + } + } + // Look for dependents nodes foreach (XmlNode childNode in node.ChildNodes) { From 7122e836ceca4a77cc1e79d4a742ad0508304094 Mon Sep 17 00:00:00 2001 From: Dan Garner Date: Thu, 24 Nov 2022 14:32:06 +0000 Subject: [PATCH 2/8] AXE: videos without extensions cause issues #279 --- Adspace/Ad.cs | 8 +++++++- Adspace/ExchangeManager.cs | 38 ++++++++++++++++++++++++++++++++++++++ Rendering/Region.xaml.cs | 2 +- 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/Adspace/Ad.cs b/Adspace/Ad.cs index d00e4e5..a1874b6 100644 --- a/Adspace/Ad.cs +++ b/Adspace/Ad.cs @@ -101,8 +101,14 @@ public string GetFileName() { return "axe_" + Url.Split('/').Last(); } - else + else if (Type.StartsWith("video")) { + // Workaround for MediaElement not supporting videos without an extension. + string[] types = Type.Split('/'); + return "axe_" + CreativeId + "." + types[1]; + } + else + { return "axe_" + CreativeId; } } diff --git a/Adspace/ExchangeManager.cs b/Adspace/ExchangeManager.cs index 7c67257..a2778ed 100644 --- a/Adspace/ExchangeManager.cs +++ b/Adspace/ExchangeManager.cs @@ -25,6 +25,8 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Diagnostics.Eventing.Reader; +using System.IO; using System.Linq; using System.Threading.Tasks; using System.Xml; @@ -281,6 +283,7 @@ public void Prefetch() string resolvedUrl = url; string urlProp = null; string idProp = null; + string mimeTypeProp = null; if (url.Contains("||")) { // Split the URL @@ -288,6 +291,10 @@ public void Prefetch() resolvedUrl = splits[0]; urlProp = splits[1]; idProp = splits[2]; + if (splits.Length > 3) + { + mimeTypeProp = splits[3]; + } } // We either expect a list of strings or a list of objects. @@ -301,6 +308,19 @@ public void Prefetch() { string fetchUrl = creative.GetValue(urlProp).ToString(); string fileName = "axe_" + creative.GetValue(idProp).ToString(); + + // Handle videos. + // we do this because windows won't play videos without a file name (well it will, but not + // reliably) + if (mimeTypeProp != null && !fileName.Contains('.')) + { + string[] parts = creative.GetValue(mimeTypeProp).ToString().Split('/'); + if (parts.Length > 1 && parts[0] == "video") + { + fileName += '.' + parts[1]; + } + } + if (!CacheManager.Instance.IsValidPath(fileName)) { DownloadAd(fetchUrl, fileName); @@ -897,6 +917,24 @@ private void DownloadAd(string url, string fileName) return; } + // Check to see if we already have a matching file without the extension + if (fileName.Contains('.')) + { + try + { + string pathWithoutExtension = Path.GetFileNameWithoutExtension(fileName); + if (File.Exists(ApplicationSettings.Default.LibraryPath + pathWithoutExtension)) + { + File.Copy(ApplicationSettings.Default.LibraryPath + pathWithoutExtension, ApplicationSettings.Default.LibraryPath + fileName); + return; + } + } + catch + { + LogMessage.Audit("ExchangeManage", "DownloadAd", "Failed to get filename without extension"); + } + } + // Not downloading yet, so do it now creativesDownloading.Add(fileName); diff --git a/Rendering/Region.xaml.cs b/Rendering/Region.xaml.cs index 226312f..49513b6 100644 --- a/Rendering/Region.xaml.cs +++ b/Rendering/Region.xaml.cs @@ -717,7 +717,7 @@ private void StopMedia(Media media) // Macros string uri = url .Replace("[TIMESTAMP]", "" + DateTime.Now.ToString("o", System.Globalization.CultureInfo.InvariantCulture)) - .Replace("[ERRORCODE]", "201"); + .Replace("[ERRORCODE]", "405"); // Call the URL new Flurl.Url(uri).WithTimeout(10).GetAsync().ContinueWith(t => From 89e0e8653bf6fd55894e5f7d8fcb705538d3c9d2 Mon Sep 17 00:00:00 2001 From: Dan Garner Date: Thu, 24 Nov 2022 14:32:56 +0000 Subject: [PATCH 3/8] Bump to 306.4 for testing. --- Logic/ApplicationSettings.cs | 2 +- Properties/AssemblyInfo.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Logic/ApplicationSettings.cs b/Logic/ApplicationSettings.cs index 0734212..10b9822 100644 --- a/Logic/ApplicationSettings.cs +++ b/Logic/ApplicationSettings.cs @@ -52,7 +52,7 @@ private static readonly Lazy /// private List ExcludedProperties; - public string ClientVersion { get; } = "3 R306.3"; + public string ClientVersion { get; } = "3 R306.4"; public string Version { get; } = "6"; public int ClientCodeVersion { get; } = 306; diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 106b2fe..8cfe58c 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -49,6 +49,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.306.0.3")] -[assembly: AssemblyFileVersion("3.306.0.3")] +[assembly: AssemblyVersion("3.306.0.4")] +[assembly: AssemblyFileVersion("3.306.0.4")] [assembly: Guid("3bd467a4-4ef9-466a-b156-a79c13a863f7")] From bf42797b1023893772bea57e4b76d54a925c7230 Mon Sep 17 00:00:00 2001 From: Dan Garner Date: Tue, 13 Dec 2022 11:53:28 +0000 Subject: [PATCH 4/8] Bump version. --- Logic/ApplicationSettings.cs | 4 ++-- Properties/AssemblyInfo.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Logic/ApplicationSettings.cs b/Logic/ApplicationSettings.cs index 10b9822..fb7e745 100644 --- a/Logic/ApplicationSettings.cs +++ b/Logic/ApplicationSettings.cs @@ -52,9 +52,9 @@ private static readonly Lazy /// private List ExcludedProperties; - public string ClientVersion { get; } = "3 R306.4"; + public string ClientVersion { get; } = "3 R307.0"; public string Version { get; } = "6"; - public int ClientCodeVersion { get; } = 306; + public int ClientCodeVersion { get; } = 307; private ApplicationSettings() { diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 8cfe58c..9902158 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -49,6 +49,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.306.0.4")] -[assembly: AssemblyFileVersion("3.306.0.4")] +[assembly: AssemblyVersion("3.307.0.0")] +[assembly: AssemblyFileVersion("3.307.0.0")] [assembly: Guid("3bd467a4-4ef9-466a-b156-a79c13a863f7")] From 6561839773c320f9de5759340971275443d610c5 Mon Sep 17 00:00:00 2001 From: Dan Garner Date: Tue, 13 Dec 2022 14:36:17 +0000 Subject: [PATCH 5/8] Subplaylist: Fix cycle playback playcount when greater than one #273 --- Log/ClientInfo.cs | 2 +- Rendering/Layout.xaml.cs | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Log/ClientInfo.cs b/Log/ClientInfo.cs index 9a78ef2..d2f9cca 100644 --- a/Log/ClientInfo.cs +++ b/Log/ClientInfo.cs @@ -329,7 +329,7 @@ public int GetWidgetGroupSequence(string groupKey) } else { - return -1; + return 0; } } diff --git a/Rendering/Layout.xaml.cs b/Rendering/Layout.xaml.cs index 8e7096f..406097b 100644 --- a/Rendering/Layout.xaml.cs +++ b/Rendering/Layout.xaml.cs @@ -427,18 +427,10 @@ public void LoadFromFile(ScheduleItem scheduleItem, XmlDocument layoutXml, DateT bool isRandom = XmlHelper.GetAttrib(media, "isRandom", "0") == "1"; int playCount = int.Parse(XmlHelper.GetAttrib(media, "playCount", "1")); + // This defaults to 0 if we're the first time here. int sequence = ClientInfo.Instance.GetWidgetGroupSequence(groupKey); - // If the play count is greater than 1, we need to grab the count plays for the current widget - if (playCount > 1 && ClientInfo.Instance.GetWidgetGroupPlaycount(groupKey) < playCount) - { - // Stick with the current widget - mediaNodes.Add(parsedMedia[groupKey][sequence]); - - // Bump plays - ClientInfo.Instance.IncrementWidgetGroupPlaycount(groupKey); - } - else + if (ClientInfo.Instance.GetWidgetGroupPlaycount(groupKey) >= playCount) { // Plays of the current widget have been met, so pick a new one. if (isRandom) @@ -455,11 +447,19 @@ public void LoadFromFile(ScheduleItem scheduleItem, XmlDocument layoutXml, DateT sequence = 0; } } - // Pull out the appropriate widget - mediaNodes.Add(parsedMedia[groupKey][sequence]); + // Set the group sequence (also sets the play count to 1) ClientInfo.Instance.SetWidgetGroupSequence(groupKey, sequence); } + else + { + // Take the same one again (do not adjust sequence) + // Bump plays + ClientInfo.Instance.IncrementWidgetGroupPlaycount(groupKey); + } + + // Pull out the appropriate widget + mediaNodes.Add(parsedMedia[groupKey][sequence]); } else { From 5848ce416c8c07a6cda6239e12ee5ecfe4c4be4f Mon Sep 17 00:00:00 2001 From: Dan Garner Date: Tue, 13 Dec 2022 14:37:28 +0000 Subject: [PATCH 6/8] Campaigns: fix cycle playback showing sequence 1 twice #281 --- Logic/Schedule.cs | 20 ++++++++++++-------- Logic/ScheduleManager.cs | 7 +++++-- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Logic/Schedule.cs b/Logic/Schedule.cs index 0073543..58b85bd 100644 --- a/Logic/Schedule.cs +++ b/Logic/Schedule.cs @@ -514,12 +514,20 @@ public void NextLayout() { // Next sequence sequence++; - } - // Make sure we can get this sequence - if (sequence >= nextLayout.CycleScheduleItems.Count) + // Make sure we can get this sequence + if (sequence >= nextLayout.CycleScheduleItems.Count) + { + sequence = 0; + } + + // Set the sequence and increment the playcount + ClientInfo.Instance.SetCampaignGroupSequence(nextLayout.CycleGroupKey, sequence); + } + else { - sequence = 0; + // We are playing the same one again, so increment the playcount. + ClientInfo.Instance.IncrementCampaignGroupPlaycount(nextLayout.CycleGroupKey); } // Set the next layout @@ -527,10 +535,6 @@ public void NextLayout() { nextLayout = nextLayout.CycleScheduleItems[sequence]; } - - // Set the sequence and increment the playcount - ClientInfo.Instance.SetCampaignGroupSequence(nextLayout.CycleGroupKey, sequence); - ClientInfo.Instance.IncrementCampaignGroupPlaycount(nextLayout.CycleGroupKey); } // Raise the event diff --git a/Logic/ScheduleManager.cs b/Logic/ScheduleManager.cs index d661561..91018df 100644 --- a/Logic/ScheduleManager.cs +++ b/Logic/ScheduleManager.cs @@ -667,8 +667,11 @@ private List ParseCyclePlayback(List schedule) // Add a new empty list resolved.Add(item.CycleGroupKey, new List()); } - - resolved[item.CycleGroupKey].Add(item); + else + { + // We only add the 2nd item onward to our cycle group key. + resolved[item.CycleGroupKey].Add(item); + } } else { From 327802c67c0e1062ae32391eb772ccce036803f2 Mon Sep 17 00:00:00 2001 From: Dan Garner Date: Tue, 13 Dec 2022 14:41:54 +0000 Subject: [PATCH 7/8] Command: update soft close command to call shutdown instead #275 --- Action/Command.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Action/Command.cs b/Action/Command.cs index e15dee4..31a0b3b 100644 --- a/Action/Command.cs +++ b/Action/Command.cs @@ -80,7 +80,7 @@ public bool Run() { // Call close. Application.Current.Dispatcher.Invoke(new System.Action(() => { - Application.Current.MainWindow.Close(); + Application.Current.Shutdown(); })); return true; From da704bc2040aaf9491fd191a07f14c92732565a8 Mon Sep 17 00:00:00 2001 From: Dan Garner Date: Tue, 13 Dec 2022 15:01:32 +0000 Subject: [PATCH 8/8] Update deps for R307 --- XiboClient.csproj | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/XiboClient.csproj b/XiboClient.csproj index 70e16f6..d0b30d1 100644 --- a/XiboClient.csproj +++ b/XiboClient.csproj @@ -298,7 +298,7 @@ 1.8.9 - 102.0.100 + 107.1.120 1.2.0 @@ -307,7 +307,7 @@ 1.16.0 - 3.4.3 + 3.5.2 3.0.6 @@ -322,22 +322,22 @@ 0.3.6 - 6.0.6 + 7.0.1 14.0.1016.290 - 1.0.1245.22 + 1.0.1462.37 - 4.0.1.8 + 4.0.1.10 - 13.0.1 + 13.0.2 - 3.1.0 + 3.1.6 5.0.1 @@ -349,7 +349,7 @@ 3.0.0 - 3.0.0 + 3.1.0