filter empty url in m3u
This commit is contained in:
@@ -33,7 +33,7 @@ namespace TV_Player
|
||||
|
||||
public static async Task DownloadGuideFromWebAsync(string name, string url)
|
||||
{
|
||||
var fileName = name+"_guide.xml";
|
||||
var fileName = name + "_guide.xml";
|
||||
string programDataPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
|
||||
string filePath = Path.Combine(programDataPath, "TVPlayer", fileName);
|
||||
|
||||
@@ -48,7 +48,8 @@ namespace TV_Player
|
||||
{
|
||||
return;
|
||||
}
|
||||
};
|
||||
}
|
||||
;
|
||||
var channelsContent = string.Empty;
|
||||
|
||||
if (url.Contains(".gz"))
|
||||
@@ -112,7 +113,7 @@ namespace TV_Player
|
||||
settings.Async = true;
|
||||
ProgramGuide channel = null;
|
||||
|
||||
var fileName = groupName+"_guide.xml";
|
||||
var fileName = groupName + "_guide.xml";
|
||||
string programDataPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
|
||||
string filePath = Path.Combine(programDataPath, "TVPlayer", fileName);
|
||||
|
||||
@@ -227,6 +228,7 @@ namespace TV_Player
|
||||
{
|
||||
if (TryParseM3ULine(line, out var m3uInfo))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(m3uInfo?.Url))
|
||||
playlistItems.Add(m3uInfo);
|
||||
}
|
||||
}
|
||||
@@ -260,7 +262,7 @@ namespace TV_Player
|
||||
Number = match.Groups["Number"].Value,
|
||||
TvgID = match.Groups["TvgID"].Value,
|
||||
TvgName = match.Groups["TvgName"].Value,
|
||||
GroupTitle = string.IsNullOrEmpty(match.Groups["GroupTitle"].Value)? "undefined":match.Groups["GroupTitle"].Value,
|
||||
GroupTitle = string.IsNullOrEmpty(match.Groups["GroupTitle"].Value) ? "undefined" : match.Groups["GroupTitle"].Value,
|
||||
Logo = match.Groups["Logo"].Value,
|
||||
Name = match.Groups["Name"].Value,
|
||||
Url = match.Groups["URL"].Value
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
SnapsToDevicePixels="True"
|
||||
VirtualizingStackPanel.IsVirtualizing="True"
|
||||
VirtualizingStackPanel.VirtualizationMode="Recycling"
|
||||
VirtualizingStackPanel.CacheLength="5"
|
||||
VirtualizingStackPanel.CacheLength="20"
|
||||
PreviewMouseDown="ListView_PreviewMouseDown"
|
||||
PreviewMouseUp="ListView_PreviewMouseUp"
|
||||
PreviewMouseMove="ListView_MouseMove"
|
||||
|
||||
@@ -20,13 +20,13 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2" />
|
||||
<PackageReference Include="LibVLCSharp" Version="3.9.1">
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||
<PackageReference Include="LibVLCSharp" Version="3.9.4">
|
||||
<TreatAsUsed>true</TreatAsUsed>
|
||||
</PackageReference>
|
||||
<PackageReference Include="LibVLCSharp.WPF" Version="3.9.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="System.Reactive" Version="6.0.1" />
|
||||
<PackageReference Include="LibVLCSharp.WPF" Version="3.9.4" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||
<PackageReference Include="System.Reactive" Version="6.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -162,6 +162,7 @@ namespace TV_Player
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_currentProgram == null) return;
|
||||
_currentProgramInfo = _currentGuide.Programs.FirstOrDefault(d => d.StartTime <= DateTime.Now && d.EndTime >= DateTime.Now);
|
||||
Programs = _currentGuide.Programs.Skip(_currentGuide.Programs.FindIndex(x=>x.Title==_currentProgramInfo.Title)).Take(7).ToList();
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace TV_Player
|
||||
ItemSelectedCommand = new RelayCommand(OnItemSelected);
|
||||
Programs = TVPlayerViewModel.Instance.PlayListsData.Select(x=>new GroupInfo() { Name =x.Key,Count=0}).ToList();
|
||||
|
||||
TVPlayerViewModel.Instance.TopPanelVisible(true, "Группы");
|
||||
TVPlayerViewModel.Instance.TopPanelVisible(true, "Groups");
|
||||
}
|
||||
|
||||
private void OnItemSelected()
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace TV_Player
|
||||
ItemSelectedCommand = new RelayCommand(OnItemSelected);
|
||||
_groupInformationSubscriber = TVPlayerViewModel.Instance.CurrentProgrmsData.GroupsInformation.Subscribe(x => Programs = SettingsModel.HiddenGroups == null ? x : x.Where(g => !SettingsModel.HiddenGroups.Contains(g.Name.ToLower())).ToList());
|
||||
|
||||
TVPlayerViewModel.Instance.TopPanelVisible(true, "Группы");
|
||||
TVPlayerViewModel.Instance.TopPanelVisible(true, "Groups");
|
||||
|
||||
TVPlayerViewModel.Instance.SetBackButtonAction(new Action(() =>
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Reactive.Linq;
|
||||
using System.Reactive;
|
||||
using System.Windows.Input;
|
||||
using TV_Player.ViewModels;
|
||||
using System.Windows;
|
||||
@@ -43,7 +42,7 @@ namespace TV_Player
|
||||
TVPlayerViewModel.Instance.CurrentProgrmsData.AllPrograms.ObserveOn(Scheduler.Default)
|
||||
.Subscribe(newPrograms =>
|
||||
{
|
||||
var filteredPrograms = newPrograms.Where(p => p.GroupTitle == groupInfo.Name).ToList();
|
||||
var filteredPrograms = newPrograms.Where(p => p.GroupTitle == groupInfo.Name && !string.IsNullOrEmpty(p.Url)).ToList();
|
||||
|
||||
Programs.Clear();
|
||||
const int batchSize = 100; // Define the batch size
|
||||
|
||||
Reference in New Issue
Block a user