Skip to content

Commit

Permalink
Version 1.0 - HuskyTail
Browse files Browse the repository at this point in the history
  • Loading branch information
FoxCouncil committed Feb 16, 2019
1 parent a0b081b commit 32923db
Show file tree
Hide file tree
Showing 19 changed files with 457 additions and 190 deletions.
16 changes: 8 additions & 8 deletions FoxIPTV.sln
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ Global
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{709ECA77-1F4B-4EA2-A90B-29272AF1E341}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{709ECA77-1F4B-4EA2-A90B-29272AF1E341}.Debug|Any CPU.Build.0 = Debug|Any CPU
{709ECA77-1F4B-4EA2-A90B-29272AF1E341}.Debug|x64.ActiveCfg = Debug|x64
{709ECA77-1F4B-4EA2-A90B-29272AF1E341}.Debug|x64.Build.0 = Debug|x64
{709ECA77-1F4B-4EA2-A90B-29272AF1E341}.Debug|x86.ActiveCfg = Debug|x86
{709ECA77-1F4B-4EA2-A90B-29272AF1E341}.Debug|x86.Build.0 = Debug|x86
{709ECA77-1F4B-4EA2-A90B-29272AF1E341}.Debug|x64.ActiveCfg = Debug|Any CPU
{709ECA77-1F4B-4EA2-A90B-29272AF1E341}.Debug|x64.Build.0 = Debug|Any CPU
{709ECA77-1F4B-4EA2-A90B-29272AF1E341}.Debug|x86.ActiveCfg = Debug|Any CPU
{709ECA77-1F4B-4EA2-A90B-29272AF1E341}.Debug|x86.Build.0 = Debug|Any CPU
{709ECA77-1F4B-4EA2-A90B-29272AF1E341}.Release|Any CPU.ActiveCfg = Release|Any CPU
{709ECA77-1F4B-4EA2-A90B-29272AF1E341}.Release|Any CPU.Build.0 = Release|Any CPU
{709ECA77-1F4B-4EA2-A90B-29272AF1E341}.Release|x64.ActiveCfg = Release|x64
{709ECA77-1F4B-4EA2-A90B-29272AF1E341}.Release|x64.Build.0 = Release|x64
{709ECA77-1F4B-4EA2-A90B-29272AF1E341}.Release|x86.ActiveCfg = Release|x86
{709ECA77-1F4B-4EA2-A90B-29272AF1E341}.Release|x86.Build.0 = Release|x86
{709ECA77-1F4B-4EA2-A90B-29272AF1E341}.Release|x64.ActiveCfg = Release|Any CPU
{709ECA77-1F4B-4EA2-A90B-29272AF1E341}.Release|x64.Build.0 = Release|Any CPU
{709ECA77-1F4B-4EA2-A90B-29272AF1E341}.Release|x86.ActiveCfg = Release|Any CPU
{709ECA77-1F4B-4EA2-A90B-29272AF1E341}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
5 changes: 5 additions & 0 deletions FoxIPTV/Classes/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ public static class Extensions
{
public static List<Difference> Difference<T>(this T valueA, T valueB)
{
if (valueA == null || valueB == null)
{
throw new ArgumentException();
}

var differences = new List<Difference>();

var properties = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance);
Expand Down
2 changes: 1 addition & 1 deletion FoxIPTV/Classes/FixedQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class FixedQueue<T> : ConcurrentQueue<T>

lock (_fixedQueueLock)
{
while (Count > FixedSize && TryDequeue(out var tempObj)) { }
while (Count > FixedSize && TryDequeue(out _)) { }
}
}
}
Expand Down
29 changes: 14 additions & 15 deletions FoxIPTV/Classes/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

namespace FoxIPTV.Classes
{
using Newtonsoft.Json;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Threading;
using Newtonsoft.Json;

public class Settings
{
Expand All @@ -20,8 +19,6 @@ public class Settings

public Size TvFormSize { get; set; } = new Size(0, 0);

public string TvFormState { get; set; }

public Point TvFormOldLocation { get; set; } = new Point(0,0);

public Size TvFormOldSize { get; set; } = new Size(0, 0);
Expand Down Expand Up @@ -51,21 +48,23 @@ public class Settings

public void Save()
{
var differences = _loadedSettingsData.Difference(this);

if (differences.Count == 0)
if (_loadedSettingsData != null)
{
return;
}

_fileLock.EnterWriteLock();
var differences = _loadedSettingsData.Difference(this);

if (differences.Count == 0)
{
return;
}
#if DEBUG
foreach (var diff in differences)
{
TvCore.LogDebug($"[Settings] {diff}");
}
foreach (var diff in differences)
{
TvCore.LogDebug($"[Settings] {diff}");
}
#endif
}

_fileLock.EnterWriteLock();

try
{
Expand Down
16 changes: 8 additions & 8 deletions FoxIPTV/Classes/TvCore.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
// Copyright (c) 2019 Fox Council - MIT License - https://github.com/FoxCouncil/FoxIPTV

using System.Drawing;

namespace FoxIPTV.Classes
{
using Newtonsoft.Json;
using Services;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
Expand All @@ -17,7 +16,6 @@ namespace FoxIPTV.Classes
using System.Threading.Tasks;
using System.Timers;
using System.Windows.Forms;
using Properties;
using Timer = System.Timers.Timer;

public static class TvCore
Expand Down Expand Up @@ -104,7 +102,7 @@ static TvCore()

LogStart();

LogInfo("[TVCore] Startup: Begining Fox IPTV Setup...");
LogMessage($"[TVCore] Startup: Fox IPTV {Assembly.GetEntryAssembly().GetName().Version}...");

LogInfo("[TVCore] Startup: Binding ThreadException & UnhandledException...");

Expand Down Expand Up @@ -208,7 +206,7 @@ void LogException(Exception ex)

BlacklistLoad();

LogDebug($"[TVCore] Startup: Finished Fox IPTV TVCore Startup");
LogMessage("[TVCore] Startup: Finished Fox IPTV TVCore Startup");
}

public static void LogError(string message) => Log(TvCoreLogLevel.Error, message);
Expand All @@ -228,10 +226,10 @@ public static async Task Start()

ChangeState(TvCoreState.Starting);

var processedData = await CurrentService.Process();
var (channels, guide) = await CurrentService.Process();

Channels = processedData.Item1;
Guide = processedData.Item2;
Channels = channels;
Guide = guide;

ChannelIndexList = Channels.Select(x => x.Index).ToList();

Expand Down Expand Up @@ -305,6 +303,7 @@ public static void AddFavoriteChannel(string channelId)
FavoritesSave();
}

/*
public static void AddFavoriteChannels(IEnumerable<string> channelIds)
{
LogDebug("[TVCore] AddFavoriteChannels()");
Expand All @@ -314,6 +313,7 @@ public static void AddFavoriteChannels(IEnumerable<string> channelIds)
FavoritesSave();
}
*/

public static void RemoveFavoriteChannel(string channelId)
{
Expand Down
51 changes: 33 additions & 18 deletions FoxIPTV/Classes/TvIconData.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
// Copyright (c) 2019 Fox Council - MIT License - https://github.com/FoxCouncil/FoxIPTV

using System;
using System.Globalization;
using System.Linq;
using Vlc.DotNet.Core.Interops;
using Vlc.DotNet.Core.Interops.Signatures;

namespace FoxIPTV.Classes
{
using System;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using Vlc.DotNet.Core.Interops;
using Vlc.DotNet.Core.Interops.Signatures;

public class TvIconData : IEquatable<TvIconData>
{
private const string VIDEO_CODEC = "VC_{0}";
Expand All @@ -17,23 +18,37 @@ public class TvIconData : IEquatable<TvIconData>
private const string AUDIO_CHANNELS = "CH_{0}";
private const string AUDIO_RATE = "AR_{0}KHZ";

public bool ClosedCaptioning;
public string VideoCodec;
public string VideoSize;
public string FrameRate;
public string AudioCodec;
public string AudioChannel;
public string AudioRate;
public bool ClosedCaptioning { get; set; }

public string VideoCodec { get; set; }

public string VideoSize { get; set; }

public string FrameRate { get; set; }

public string AudioCodec { get; set; }

public string AudioChannel { get; set; }

public string AudioRate { get; set; }

/// <inheritdoc />
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != GetType()) return false;
return Equals((TvIconData)obj);
if (obj is null)
{
return false;
}

if (ReferenceEquals(this, obj))
{
return true;
}

return obj.GetType() == GetType() && Equals((TvIconData) obj);
}

[SuppressMessage("ReSharper", "NonReadonlyMemberInGetHashCode")]
public override int GetHashCode()
{
unchecked
Expand Down Expand Up @@ -91,7 +106,7 @@ public static TvIconData CreateData(bool closedCaptioning, MediaTrack[] mediaTra

if (videoTrack.FrameRateNum > 0)
{
var frameRateStr = Math.Ceiling((double)videoTrack.FrameRateNum / (double)videoTrack.FrameRateDen).ToString();
var frameRateStr = Math.Ceiling(videoTrack.FrameRateNum / (double)videoTrack.FrameRateDen).ToString(CultureInfo.InvariantCulture);

if (videoTrack.FrameRateNum > 90 && videoTrack.FrameRateDen == 1)
{
Expand Down
15 changes: 9 additions & 6 deletions FoxIPTV/Controls/GuideLayoutPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ namespace FoxIPTV.Controls
using System.Drawing;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Classes;
using Properties;
Expand Down Expand Up @@ -371,19 +370,23 @@ private void Draw(bool drawAnyway = false)
{
borderedLabel.MouseEnter += (s, a) =>
{
var window = s as IWin32Window;
_toolTip.Show(string.Empty, window, 0);
if (s is IWin32Window window)
{
_toolTip.Show(string.Empty, window, 0);
}
};

borderedLabel.MouseMove += (s, a) =>
{
var window = s as IWin32Window;
const int offset = 5;
var newPoint = new Point(a.Location.X + offset, a.Location.Y + offset);
_toolTip.ToolTipTitle = $"{channelCurrentProgramme.Start.ToLocalTime():h:mm tt} to {channelCurrentProgramme.Stop.ToLocalTime():h:mm tt} - {channelCurrentProgramme.BlockLength * 10} minutes";
_toolTip.Show($"{channelCurrentProgramme.Title}\n{channelCurrentProgramme.Description}", window, newPoint);
if (s is IWin32Window window)
{
_toolTip.Show($"{channelCurrentProgramme.Title}\n{channelCurrentProgramme.Description}", window, newPoint);
}
};

borderedLabel.MouseLeave += (s, a) => { _toolTip.Hide(this); };
Expand Down
13 changes: 3 additions & 10 deletions FoxIPTV/Forms/AboutForm.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
// Copyright (c) 2019 Fox Council - MIT License - https://github.com/FoxCouncil/FoxIPTV

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace FoxIPTV.Forms
{
using System;
using System.Windows.Forms;

public partial class AboutForm : Form
{
public AboutForm()
Expand Down
14 changes: 7 additions & 7 deletions FoxIPTV/Forms/ChannelsForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 32923db

Please sign in to comment.