Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master -> test-code #52

Merged
merged 8 commits into from
Nov 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 19 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
# TVS-Player
## Most things are NOT fully stable. This is first alpha build.
### For latest code check out "test-code" branch
## Current version: 0.3 Alpha
### For latest (unstable) code check out "test-code" branch
### Info:
TVS-Player is Windows only desktop app written in C# that maintains your library of TV Shows.
### Features:
- Keeping your library nice and clean
- Renaming all files to unified format (ShowName - S00E00 - EpisodeName)
TVS-Player is Windows only desktop app written in C# & WPF that maintains your library of TV Shows.

### Key features:
- Keeping your library organised and updated
- Renaming all files to a unified format (ShowName - SxxExx - EpisodeName)
- Downloading most episodes using torrent
- Autodownload for week old episodes using torrent
- Getting info about TV shows and Episodes (Actors, release dates etc.)
- Build in player
- Built-in player with DXVA 2.0 support (K-Lite Codecs required for any kind of playback)
- Torrent streaming (K-Lite Codecs required for any kind of playback)

### Future features:
- Episode streaming (using build in player and sequential download)
- Subtitle download and playback
- High quality, high speed background encoding to either lower quality or x265 for data saving
- FTP or some other service for sharing episodes between devices
- Desktop client (just FTP client)
- Mobile client
- More stuff...

### Recommended hardware:
- Any recent (2009 and newer) at least dual core CPU
- 3 GB of RAM
- Intel HD 4400 and faster for ok-ish performance. Dedicated GPU highly recommended.
- A lot of HDD space for tv shows & around 5MB per TV show for cached images and data


### Dislcaimer:
I'm not responsible for your actions - since it's not stable yet expect errors.
Downloading and sharing TV shows might not be legal in wherever you live - check your law - again I'm not responsible for your actions.
I'm not responsible for your actions - since it's only third alpha build expect errors
Downloading and sharing TV shows might not be legal in wherever you live - check your law - I'm not responsible for your actions.

34 changes: 34 additions & 0 deletions TVSPlayer/Classes/Helper.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -47,6 +49,38 @@ public static string GenerateName(Episode episode) {
}
}

public static bool CheckRunning() {
var procName = Process.GetCurrentProcess();
List<Process> processes = Process.GetProcessesByName(procName.ProcessName).ToList();
processes.Remove(procName);
if (processes.Count > 1) {
foreach (var proc in processes) {
WindowHelper.BringProcessToFront(proc);
}
return false;
} else {
return true;
}
}
public static class WindowHelper {
public static void BringProcessToFront(Process process) {
IntPtr handle = process.MainWindowHandle;
if (IsIconic(handle)) {
ShowWindow(handle, SW_RESTORE);
}

SetForegroundWindow(handle);
}

const int SW_RESTORE = 9;

[DllImport("User32.dll")]
private static extern bool SetForegroundWindow(IntPtr handle);
[DllImport("User32.dll")]
private static extern bool ShowWindow(IntPtr handle, int nCmdShow);
[DllImport("User32.dll")]
private static extern bool IsIconic(IntPtr handle);
}

}

Expand Down
8 changes: 5 additions & 3 deletions TVSPlayer/Classes/UpdateDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ class UpdateDatabase {
/// <summary>
/// Starts checking if all files are where they are supposed to be and if database is updated
/// </summary>
public async static void StartUpdateBackground() {
await CheckFiles();
await Update();
public async static void StartUpdateBackground(bool startNow = true) {
if (!startNow) {
await CheckFiles();
await Update();
}
Timer checktimer = new Timer(600000);
checktimer.Elapsed += async (s, ev) => await CheckFiles();
checktimer.Start();
Expand Down
8 changes: 4 additions & 4 deletions TVSPlayer/Controls/MessageBox/MessageBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
<Grid x:Name="Center" Grid.Row="1">
<TextBlock HorizontalAlignment="Left" x:Name="Content" TextWrapping="NoWrap" FontSize="15" VerticalAlignment="Center" Margin="10" Foreground="{DynamicResource TextColor}" Text="" />
</Grid>
<Grid x:Name="Bottom" Grid.Row="2" Margin="0,0,5,5" >
<Grid x:Name="NoButtons" Opacity="1">
<TextBlock Text="Continue" Foreground="{DynamicResource TextColor}" MouseLeftButtonUp="Close_MouseLeftButtonUp" MouseEnter="Close_MouseEnter" MouseLeave="Close_MouseLeave" FontSize="14" HorizontalAlignment="Right" Margin="35,0" VerticalAlignment="Center" />
<Grid Margin="0,5,5,0" x:Name="Next" MouseEnter="Close_MouseEnter" MouseLeave="Close_MouseLeave" MouseLeftButtonUp="Close_MouseLeftButtonUp" HorizontalAlignment="Right">
<Grid x:Name="Bottom" Grid.Row="2" Margin="0,0,5,5" MouseEnter="Close_MouseEnter" MouseLeave="Close_MouseLeave">
<Grid x:Name="NoButtons" Opacity="1" Background="#01000000">
<TextBlock Text="Continue" Foreground="{DynamicResource TextColor}" MouseLeftButtonUp="Close_MouseLeftButtonUp" FontSize="14" HorizontalAlignment="Right" Margin="35,0" VerticalAlignment="Center" />
<Grid Margin="0,5,5,0" x:Name="Next" MouseLeftButtonUp="Close_MouseLeftButtonUp" HorizontalAlignment="Right">
<Image Source="{DynamicResource ForwardIcon}" />
</Grid>
</Grid>
Expand Down
13 changes: 9 additions & 4 deletions TVSPlayer/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ namespace TVSPlayer {
public partial class MainWindow : Window {

public MainWindow() {
if (!Helper.CheckRunning()) {
Environment.Exit(0);
}
InitializeComponent();
SetDimensions();
}
Expand Down Expand Up @@ -517,17 +520,19 @@ private async void TestFunctions() {
td.Stream();
}


private void BaseGrid_Loaded(object sender, RoutedEventArgs e) {
if (true) {
if (true) {
if (!CheckConnection()) {
AddPage(new StartupInternetError());
} else {
if (!Directory.Exists(Helper.data)) {
} else {
Settings.Load();
if (String.IsNullOrEmpty(Settings.Library)) {
AddPage(new Intro());
Settings.LastCheck = DateTime.Now;
UpdateDatabase.StartUpdateBackground(false);
} else {
SetPage(new Library());
Settings.Load();
UpdateDatabase.StartUpdateBackground();
TorrentDownloader.ContinueUnfinished();
}
Expand Down
3 changes: 3 additions & 0 deletions TVSPlayer/Pages/Library/SeriesDetails.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public SeriesDetails(Series series, Page WhereToBack)
Page page;

private void Grid_Loaded(object sender, RoutedEventArgs e) {
PageCustomization pg = new PageCustomization();
pg.MainTitle = series.seriesName + " - Details";
MainWindow.SetPageCustomization(pg);
List<Actor> actors = Database.GetActors(series.id);
Task.Run(() => {
foreach (Actor actor in actors) {
Expand Down