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)
|
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 programDataPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
|
||||||
string filePath = Path.Combine(programDataPath, "TVPlayer", fileName);
|
string filePath = Path.Combine(programDataPath, "TVPlayer", fileName);
|
||||||
|
|
||||||
@@ -48,7 +48,8 @@ namespace TV_Player
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
;
|
||||||
var channelsContent = string.Empty;
|
var channelsContent = string.Empty;
|
||||||
|
|
||||||
if (url.Contains(".gz"))
|
if (url.Contains(".gz"))
|
||||||
@@ -111,8 +112,8 @@ namespace TV_Player
|
|||||||
settings.DtdProcessing = DtdProcessing.Parse;
|
settings.DtdProcessing = DtdProcessing.Parse;
|
||||||
settings.Async = true;
|
settings.Async = true;
|
||||||
ProgramGuide channel = null;
|
ProgramGuide channel = null;
|
||||||
|
|
||||||
var fileName = groupName+"_guide.xml";
|
var fileName = groupName + "_guide.xml";
|
||||||
string programDataPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
|
string programDataPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
|
||||||
string filePath = Path.Combine(programDataPath, "TVPlayer", fileName);
|
string filePath = Path.Combine(programDataPath, "TVPlayer", fileName);
|
||||||
|
|
||||||
@@ -227,7 +228,8 @@ namespace TV_Player
|
|||||||
{
|
{
|
||||||
if (TryParseM3ULine(line, out var m3uInfo))
|
if (TryParseM3ULine(line, out var m3uInfo))
|
||||||
{
|
{
|
||||||
playlistItems.Add(m3uInfo);
|
if (!string.IsNullOrEmpty(m3uInfo?.Url))
|
||||||
|
playlistItems.Add(m3uInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (line.StartsWith("#EXTM3U"))
|
if (line.StartsWith("#EXTM3U"))
|
||||||
@@ -260,7 +262,7 @@ namespace TV_Player
|
|||||||
Number = match.Groups["Number"].Value,
|
Number = match.Groups["Number"].Value,
|
||||||
TvgID = match.Groups["TvgID"].Value,
|
TvgID = match.Groups["TvgID"].Value,
|
||||||
TvgName = match.Groups["TvgName"].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,
|
Logo = match.Groups["Logo"].Value,
|
||||||
Name = match.Groups["Name"].Value,
|
Name = match.Groups["Name"].Value,
|
||||||
Url = match.Groups["URL"].Value
|
Url = match.Groups["URL"].Value
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
SnapsToDevicePixels="True"
|
SnapsToDevicePixels="True"
|
||||||
VirtualizingStackPanel.IsVirtualizing="True"
|
VirtualizingStackPanel.IsVirtualizing="True"
|
||||||
VirtualizingStackPanel.VirtualizationMode="Recycling"
|
VirtualizingStackPanel.VirtualizationMode="Recycling"
|
||||||
VirtualizingStackPanel.CacheLength="5"
|
VirtualizingStackPanel.CacheLength="20"
|
||||||
PreviewMouseDown="ListView_PreviewMouseDown"
|
PreviewMouseDown="ListView_PreviewMouseDown"
|
||||||
PreviewMouseUp="ListView_PreviewMouseUp"
|
PreviewMouseUp="ListView_PreviewMouseUp"
|
||||||
PreviewMouseMove="ListView_MouseMove"
|
PreviewMouseMove="ListView_MouseMove"
|
||||||
@@ -25,18 +25,18 @@
|
|||||||
<ListView.ItemTemplate>
|
<ListView.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<Viewbox HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
<Viewbox HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||||
<Border x:Name="border" Height="145" Width="106" HorizontalAlignment="Center" CornerRadius="5" BorderBrush="Yellow" BorderThickness="2">
|
<Border x:Name="border" Height="145" Width="106" HorizontalAlignment="Center" CornerRadius="5" BorderBrush="Yellow" BorderThickness="2">
|
||||||
<Grid Margin="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="#B0000000">
|
<Grid Margin="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="#B0000000">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
<RowDefinition Height=".4*"/>
|
<RowDefinition Height=".4*"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Image Source="{Binding Logo}" MaxWidth="100" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,10"/>
|
<Image Source="{Binding Logo}" MaxWidth="100" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,10"/>
|
||||||
|
|
||||||
<TextBlock Grid.Row="1" Text="{Binding Name}" FontSize="15" TextAlignment="Center" Foreground="White" HorizontalAlignment="Center" TextWrapping="Wrap" Margin="1,0,1,2"/>
|
<TextBlock Grid.Row="1" Text="{Binding Name}" FontSize="15" TextAlignment="Center" Foreground="White" HorizontalAlignment="Center" TextWrapping="Wrap" Margin="1,0,1,2"/>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
</Viewbox>
|
</Viewbox>
|
||||||
<DataTemplate.Triggers>
|
<DataTemplate.Triggers>
|
||||||
<DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource AncestorType={x:Type ListViewItem}}}" Value="True">
|
<DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource AncestorType={x:Type ListViewItem}}}" Value="True">
|
||||||
|
|||||||
@@ -20,13 +20,13 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2" />
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||||
<PackageReference Include="LibVLCSharp" Version="3.9.1">
|
<PackageReference Include="LibVLCSharp" Version="3.9.4">
|
||||||
<TreatAsUsed>true</TreatAsUsed>
|
<TreatAsUsed>true</TreatAsUsed>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="LibVLCSharp.WPF" Version="3.9.1" />
|
<PackageReference Include="LibVLCSharp.WPF" Version="3.9.4" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||||
<PackageReference Include="System.Reactive" Version="6.0.1" />
|
<PackageReference Include="System.Reactive" Version="6.0.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -162,6 +162,7 @@ namespace TV_Player
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (_currentProgram == null) return;
|
||||||
_currentProgramInfo = _currentGuide.Programs.FirstOrDefault(d => d.StartTime <= DateTime.Now && d.EndTime >= DateTime.Now);
|
_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();
|
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);
|
ItemSelectedCommand = new RelayCommand(OnItemSelected);
|
||||||
Programs = TVPlayerViewModel.Instance.PlayListsData.Select(x=>new GroupInfo() { Name =x.Key,Count=0}).ToList();
|
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()
|
private void OnItemSelected()
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace TV_Player
|
|||||||
ItemSelectedCommand = new RelayCommand(OnItemSelected);
|
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());
|
_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(() =>
|
TVPlayerViewModel.Instance.SetBackButtonAction(new Action(() =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Reactive.Linq;
|
using System.Reactive.Linq;
|
||||||
using System.Reactive;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using TV_Player.ViewModels;
|
using TV_Player.ViewModels;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
@@ -43,7 +42,7 @@ namespace TV_Player
|
|||||||
TVPlayerViewModel.Instance.CurrentProgrmsData.AllPrograms.ObserveOn(Scheduler.Default)
|
TVPlayerViewModel.Instance.CurrentProgrmsData.AllPrograms.ObserveOn(Scheduler.Default)
|
||||||
.Subscribe(newPrograms =>
|
.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();
|
Programs.Clear();
|
||||||
const int batchSize = 100; // Define the batch size
|
const int batchSize = 100; // Define the batch size
|
||||||
|
|||||||
Reference in New Issue
Block a user