这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
6c7cea3
Merge pull request #2 from xibosignage/master
dasgarner Jan 26, 2015
7ee4220
Adding missing solution file.
dasgarner Jan 28, 2015
4a1395d
Merge pull request #4 from dasgarner/develop
dasgarner Jan 28, 2015
fb0264d
Contribution Notice
dasgarner Jan 29, 2015
b1b478e
Merge pull request #5 from dasgarner/develop
dasgarner Jan 29, 2015
3d42ccf
Updated Region to populate high update interval for text media
dasgarner Feb 10, 2015
6c2ae35
Adjusted so that CEF doesn't initialise if it is disabled.
dasgarner Feb 10, 2015
1a42d59
Removed localvideo from isvalid check to allow external streams.
dasgarner Feb 10, 2015
f18edbc
Log Message and Stat Log dispatch Thread Safety. xibosignage/xibo#196
dasgarner Feb 10, 2015
604aaf5
Set the update interval high for ANY media item that doesn't provide …
dasgarner Feb 12, 2015
eb3238c
LibraryAgent was deleting a file it shouldn't. xibosignage/xibo#161
dasgarner Feb 12, 2015
eec7c9d
Update Flash.cs
JianjianHuang Feb 19, 2015
1a82dbd
Throttle the log/stat file sending to prevent Out of Memory errors. x…
dasgarner Feb 27, 2015
98883bd
Extra logic for layouts with regions that expire at exactly the same …
dasgarner Feb 27, 2015
dabbba2
Try to force videos to clean themselves up after they are finished. A…
dasgarner Feb 27, 2015
ed158cd
Explicitly remove event handlers when tidying up the VideoPlayer
dasgarner Feb 27, 2015
b5e98f7
Tidy up some expiry logic so that the player doesn't assess anything …
dasgarner Feb 28, 2015
8b93cb4
Bumped Version 1.7.1
dasgarner Feb 28, 2015
32e52f5
Merge pull request #7 from dasgarner/develop
dasgarner Feb 28, 2015
59a08c7
Merge pull request #6 from JianjianHuang/JianjianHuang-patch-1
dasgarner Feb 28, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Contributing
We'd love to work with you and accept your contributions. For small changes like bug fixes, typos, etc. Please Fork us and submit a pull request with the details of what you have changed.

For larger changes, you will have to electronically sign a statement that indicates two things:

* You are willingly licensing your contributions under the terms of the open source license of the project that you're contributing to.

* You are legally able to license your contributions as stated.

This is called a Contributor Licence Agreement or "CLA" for short.

The standard licence for Xibo is the [AGPLv3](LICENSE). For more information please see [CONTRIBUTING](https://github.com/xibosignage/xibo/blob/master/CONTRIBUTING.md).
45 changes: 36 additions & 9 deletions Control/Region.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Xibo - Digitial Signage - http://www.xibo.org.uk
* Copyright (C) 2006-2014 Daniel Garner
* Copyright (C) 2006-2015 Daniel Garner
*
* This file is part of Xibo.
*
Expand Down Expand Up @@ -38,8 +38,8 @@ class Region : Panel

private Media _media;
private RegionOptions _options;
public bool _hasExpired = false;
public bool _layoutExpired = false;
private bool _hasExpired = false;
private bool _layoutExpired = false;
private int _currentSequence = -1;

// Stat objects
Expand Down Expand Up @@ -101,6 +101,23 @@ public RegionOptions regionOptions
}
}

/// <summary>
/// Inform the region that the layout has expired
/// </summary>
public void setLayoutExpired()
{
_layoutExpired = true;
}

/// <summary>
/// Has this region expired
/// </summary>
/// <returns></returns>
public bool hasExpired()
{
return _hasExpired;
}

///<summary>
/// Evaulates the change in options
///</summary>
Expand Down Expand Up @@ -343,6 +360,9 @@ private void ParseOptionsForMediaNode(XmlNode mediaNode, XmlAttributeCollection
// There will be some stuff on option nodes
XmlNode optionNode = mediaNode.FirstChild;

// Track if an update interval has been provided in the XLF
bool updateIntervalProvided = false;

// Loop through each option node
foreach (XmlNode option in optionNode.ChildNodes)
{
Expand Down Expand Up @@ -371,6 +391,8 @@ private void ParseOptionsForMediaNode(XmlNode mediaNode, XmlAttributeCollection
}
else if (option.Name == "updateInterval")
{
updateIntervalProvided = true;

try
{
_options.updateInterval = int.Parse(option.InnerText);
Expand Down Expand Up @@ -410,6 +432,10 @@ private void ParseOptionsForMediaNode(XmlNode mediaNode, XmlAttributeCollection
_options.javaScript = raw.InnerText;
}
}

// Media Types without an update interval should be set to something rather high
if (!updateIntervalProvided)
_options.updateInterval = int.MaxValue;
}

/// <summary>
Expand Down Expand Up @@ -508,10 +534,9 @@ private Media CreateNextMediaNode(RegionOptions options)
/// <param name="media"></param>
private void StartMedia(Media media)
{
media.RenderMedia();

Trace.WriteLine(new LogMessage("Region - StartMedia", "Starting media"), LogType.Audit.ToString());

media.RenderMedia();
Controls.Add(media);
}

Expand All @@ -536,8 +561,7 @@ private void StopMedia(Media media)
}
catch (Exception ex)
{
Debug.WriteLine("No media to remove");
Debug.WriteLine(ex.Message);
Trace.WriteLine(new LogMessage("Region - Stop Media", "Unable to dispose. Ex = " + ex.Message), LogType.Audit.ToString());
}
}

Expand Down Expand Up @@ -585,6 +609,10 @@ private void media_DurationElapsedEvent(int filesPlayed)
// Increment the _current sequence by the number of filesPlayed (minus 1)
_currentSequence = _currentSequence + (filesPlayed - 1);

// If this layout has been expired we know that everything will soon be torn down, so do nothing
if (_layoutExpired)
return;

// make some decisions about what to do next
try
{
Expand Down Expand Up @@ -641,8 +669,7 @@ protected override void Dispose(bool disposing)
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
Debug.WriteLine("There was no media to dispose", "Region - Dispose");
Trace.WriteLine(new LogMessage("Region - Dispose", "Unable to dispose media. Ex = " + ex.Message), LogType.Audit.ToString());
}
finally
{
Expand Down
4 changes: 4 additions & 0 deletions Log/ClientInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ public void AddToLogGrid(string message, LogType logType)
return;
}

// Prevent the log grid getting too large (clear at 500 messages)
if (logDataGridView.RowCount > 500)
logDataGridView.Rows.Clear();

int newRow = logDataGridView.Rows.Add();

LogMessage logMessage;
Expand Down
6 changes: 3 additions & 3 deletions Log/LogMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ public override string ToString()
// Just do this with a string builder rather than an XML builder.
String theMessage;

theMessage = String.Format("<message>{0}</message>", SecurityElement.Escape(_message));
theMessage += String.Format("<method>{0}</method>", _method);
theMessage += String.Format("<logdate>{0}</logdate>", LogDate);
theMessage = String.Format("<logdate>{0}</logdate>", LogDate);
theMessage += String.Format("<thread>{0}</thread>", _thread);
theMessage += String.Format("<method>{0}</method>", _method);
theMessage += String.Format("<message>{0}</message>", SecurityElement.Escape(_message));

if (_scheduleId != 0) theMessage += String.Format("<scheduleid>{0}</scheduleid>", _scheduleId.ToString());
if (_layoutId != 0) theMessage += String.Format("<layoutid>{0}</layoutid>", _scheduleId.ToString());
Expand Down
106 changes: 61 additions & 45 deletions Log/StatLog.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Xibo - Digitial Signage - http://www.xibo.org.uk
* Copyright (C) 2009-2014 Spring Signage Ltd
* Copyright (C) 2009-2015 Spring Signage Ltd
*
* This file is part of Xibo.
*
Expand Down Expand Up @@ -32,6 +32,7 @@ namespace XiboClient
{
class StatLog
{
public static object _locker = new object();
private Collection<Stat> _stats;
private HardwareKey _hardwareKey;

Expand Down Expand Up @@ -194,58 +195,73 @@ private void FlushToFile()
/// </summary>
private void ProcessQueueToXmds()
{
Debug.WriteLine(new LogMessage("FlushToXmds", String.Format("IN")), LogType.Audit.ToString());

// If we haven't had a successful connection recently, then don't log
if (ApplicationSettings.Default.XmdsLastConnection.AddSeconds((int)ApplicationSettings.Default.CollectInterval) < DateTime.Now)
return;

// Get a list of all the log files waiting to be sent to XMDS.
string[] logFiles = Directory.GetFiles(ApplicationSettings.Default.LibraryPath, "*" + ApplicationSettings.Default.StatsLogFile + "*");

foreach (string fileName in logFiles)
try
{
// If we have some, create an XMDS object
using (xmds.xmds logtoXmds = new xmds.xmds())
{
logtoXmds.Url = ApplicationSettings.Default.XiboClient_xmds_xmds;

// construct the log message
StringBuilder builder = new StringBuilder();
builder.Append("<log>");

foreach (string entry in File.ReadAllLines(fileName))
builder.Append(entry);

builder.Append("</log>");
// If we haven't had a successful connection recently, then don't log
if (ApplicationSettings.Default.XmdsLastConnection.AddSeconds((int)ApplicationSettings.Default.CollectInterval) < DateTime.Now)
return;

try
{
logtoXmds.SubmitStats(ApplicationSettings.Default.ServerKey, _hardwareKey.Key, builder.ToString());

// Delete the file we are on
File.Delete(fileName);
}
catch (WebException webEx)
{
// Increment the quantity of XMDS failures and bail out
ApplicationSettings.Default.IncrementXmdsErrorCount();
lock (_locker)
{
// Get a list of all the log files waiting to be sent to XMDS.
string[] logFiles = Directory.GetFiles(ApplicationSettings.Default.LibraryPath, "*" + ApplicationSettings.Default.StatsLogFile + "*");

// Log this message, but dont abort the thread
Trace.WriteLine(new LogMessage("ProcessQueueToXmds", "WebException: " + webEx.Message), LogType.Error.ToString());
// Track processed files
int filesProcessed = 0;

// Drop out the loop
break;
}
catch (Exception e)
// Loop through each file
foreach (string fileName in logFiles)
{
Trace.WriteLine(new LogMessage("FlushToXmds", string.Format("Exception when submitting to XMDS: {0}", e.Message)), LogType.Error.ToString());
// Only process as many files in one go as configured
if (filesProcessed >= ApplicationSettings.Default.MaxLogFileUploads)
break;

// If we have some, create an XMDS object
using (xmds.xmds logtoXmds = new xmds.xmds())
{
logtoXmds.Url = ApplicationSettings.Default.XiboClient_xmds_xmds;

// construct the log message
StringBuilder builder = new StringBuilder();
builder.Append("<log>");

foreach (string entry in File.ReadAllLines(fileName))
builder.Append(entry);

builder.Append("</log>");

try
{
logtoXmds.SubmitStats(ApplicationSettings.Default.ServerKey, _hardwareKey.Key, builder.ToString());

// Delete the file we are on
File.Delete(fileName);
}
catch (WebException webEx)
{
// Increment the quantity of XMDS failures and bail out
ApplicationSettings.Default.IncrementXmdsErrorCount();

// Log this message, but dont abort the thread
Trace.WriteLine(new LogMessage("ProcessQueueToXmds", "WebException: " + webEx.Message), LogType.Error.ToString());

// Drop out the loop
break;
}
catch (Exception e)
{
Trace.WriteLine(new LogMessage("FlushToXmds", string.Format("Exception when submitting to XMDS: {0}", e.Message)), LogType.Error.ToString());
}

filesProcessed++;
}
}
}
}

// Log out
Debug.WriteLine(new LogMessage("FlushToXmds", String.Format("OUT")), LogType.Audit.ToString());
catch (Exception e)
{
Trace.WriteLine(new LogMessage("FlushToXmds", string.Format("Unknown Exception: {0}", e.Message)), LogType.Error.ToString());
}
}
}

Expand Down
Loading