Updating typescript models and adding transcoder dll inside the output in release mode.

This commit is contained in:
Zoe Roux 2019-09-27 18:08:40 +02:00
parent 49c3cc7a5f
commit 71403a9888
30 changed files with 126 additions and 38 deletions

View File

@ -74,10 +74,11 @@
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
<IncludePath>$(ProjectDir)\ffmpeg\include;$(IncludePath)</IncludePath> <IncludePath>$(ProjectDir)\ffmpeg\include;$(IncludePath)</IncludePath>
<LibraryPath>$(ProjectDir)\ffmpeg\lib;$(LibraryPath)</LibraryPath> <LibraryPath>$(ProjectDir)\ffmpeg\lib;$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)Kyoo\Transcoder</OutDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)$(Configuration)\</OutDir> <OutDir>$(SolutionDir)Kyoo\Transcoder</OutDir>
<IncludePath>$(ProjectDir)\ffmpeg\include;$(IncludePath)</IncludePath> <IncludePath>$(ProjectDir)\ffmpeg\include;$(IncludePath)</IncludePath>
<LibraryPath>$(ProjectDir)\ffmpeg\lib;$(LibraryPath)</LibraryPath> <LibraryPath>$(ProjectDir)\ffmpeg\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
@ -85,10 +86,11 @@
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<IncludePath>$(ProjectDir)\ffmpeg\include;$(IncludePath)</IncludePath> <IncludePath>$(ProjectDir)\ffmpeg\include;$(IncludePath)</IncludePath>
<LibraryPath>$(ProjectDir)\ffmpeg\lib;$(LibraryPath)</LibraryPath> <LibraryPath>$(ProjectDir)\ffmpeg\lib;$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)Kyoo\Transcoder</OutDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)$(Configuration)\</OutDir> <OutDir>$(SolutionDir)Kyoo\Transcoder</OutDir>
<IncludePath>$(ProjectDir)\ffmpeg\include;$(IncludePath)</IncludePath> <IncludePath>$(ProjectDir)\ffmpeg\include;$(IncludePath)</IncludePath>
<LibraryPath>$(ProjectDir)\ffmpeg\lib;$(LibraryPath)</LibraryPath> <LibraryPath>$(ProjectDir)\ffmpeg\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>

View File

@ -4,6 +4,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
VisualStudioVersion = 16.0.29123.88 VisualStudioVersion = 16.0.29123.88
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kyoo", "Kyoo\Kyoo.csproj", "{0F8275B6-C7DD-42DF-A168-755C81B1C329}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kyoo", "Kyoo\Kyoo.csproj", "{0F8275B6-C7DD-42DF-A168-755C81B1C329}"
ProjectSection(ProjectDependencies) = postProject
{E5EFA4B2-F09D-4C4F-83DD-A436CD60BB77} = {E5EFA4B2-F09D-4C4F-83DD-A436CD60BB77}
EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Kyoo.Transcoder", "Kyoo.Transcoder\Kyoo.Transcoder.vcxproj", "{E5EFA4B2-F09D-4C4F-83DD-A436CD60BB77}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Kyoo.Transcoder", "Kyoo.Transcoder\Kyoo.Transcoder.vcxproj", "{E5EFA4B2-F09D-4C4F-83DD-A436CD60BB77}"
EndProject EndProject

View File

@ -1,7 +1,7 @@
<div class="root"> <div class="root">
<div class="episodes" id="episodes"> <div class="episodes" id="episodes">
<a class="episode" *ngFor="let episode of this.episodes" id="el-{{episode.episodeNumber}}" routerLink="/watch/{{this.showSlug}}-s{{episode.seasonNumber}}e{{episode.episodeNumber}}" href="/watch/{{this.showSlug}}-s{{episode.seasonNumber}}e{{episode.episodeNumber}}"> <a class="episode" *ngFor="let episode of this.episodes" id="el-{{episode.episodeNumber}}" routerLink="/watch/{{this.showSlug}}-s{{episode.seasonNumber}}e{{episode.episodeNumber}}" href="/watch/{{this.showSlug}}-s{{episode.seasonNumber}}e{{episode.episodeNumber}}">
<div class="img" [style.background-image]="sanitize(episode.thumb, true)"> <div class="img" [style.background-image]="sanitize(episode.thumb)">
<button mat-icon-button class="playBtn"><i class="material-icons playIcon">play_circle_outline</i></button> <button mat-icon-button class="playBtn"><i class="material-icons playIcon">play_circle_outline</i></button>
</div> </div>
<h6 *ngIf="episode.seasonNumber != 0; else elseBlock;" class="title">S{{episode.seasonNumber}}:E{{episode.episodeNumber}} - {{episode.title}}</h6> <h6 *ngIf="episode.seasonNumber != 0; else elseBlock;" class="title">S{{episode.seasonNumber}}:E{{episode.episodeNumber}} - {{episode.title}}</h6>

View File

@ -1,11 +1,12 @@
export interface Episode export interface Episode
{ {
seasonNumber: number;
episodeNumber: number; episodeNumber: number;
title: string; title: string;
thumb: string; thumb: string;
link: string; link: string;
overview: string; overview: string;
releaseDate; releaseDate;
runtimeInMinutes: number; runtime: number;
externalIDs: string; externalIDs: string;
} }

View File

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=genre.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"genre.js","sourceRoot":"","sources":["genre.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,5 @@
export interface Genre
{
slug: string;
name: string;
}

View File

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=people.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"people.js","sourceRoot":"","sources":["people.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,9 @@
export interface People
{
slug: string;
name: string;
role: string;
type: string;
externalIDs: string;
}

View File

@ -1,26 +1,25 @@
import { Season } from "./season"; import { Season } from "./season";
import { Genre } from "./genre";
import { People } from "./people";
import { Studio } from "./studio";
export interface Show export interface Show
{ {
id: number;
slug: string; slug: string;
title: string; title: string;
//IEnumerable < > Aliases; Aliases: string[];
path: string;
overview: string; overview: string;
trailer: string; genres: Genre[];
//IEnumerable < > Genres; status: string;
//Status ? Status; studio: Studio;
directors: People[];
people: People[];
seasons: Season[];
trailerUrl: string;
startYear: number; startYear: number;
endYear : number; endYear : number;
imgPrimary: string;
imgThumb: string;
imgLogo: string;
imgBackdrop: string;
externalIDs: string; externalIDs: string;
seasons: Season[];
} }

View File

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=studio.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"studio.js","sourceRoot":"","sources":["studio.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,5 @@
export interface Studio
{
slug: string;
name: string;
}

View File

@ -15,7 +15,7 @@ export interface WatchItem
previousEpisode: string; previousEpisode: string;
nextEpisode: Episode; nextEpisode: Episode;
audio: Track[]; audios: Track[];
subtitles: Track[]; subtitles: Track[];
} }

View File

@ -613,6 +613,27 @@ namespace Kyoo.InternalAPI
return (long)cmd.ExecuteScalar(); return (long)cmd.ExecuteScalar();
} }
} }
public long GetOrCreatePeople(People people)
{
People existingPeople = GetPeopleBySlug(people.slug);
if (existingPeople != null)
return existingPeople.id;
string query = "INSERT INTO people (slug, name, imgPrimary, externalIDs) VALUES($slug, $name, $imgPrimary, $externalIDs);";
using (SQLiteCommand cmd = new SQLiteCommand(query, sqlConnection))
{
cmd.Parameters.AddWithValue("$slug", people.slug);
cmd.Parameters.AddWithValue("$name", people.Name);
cmd.Parameters.AddWithValue("$imgPrimary", people.imgPrimary);
cmd.Parameters.AddWithValue("$externalIDs", people.externalIDs);
cmd.ExecuteNonQuery();
cmd.CommandText = "SELECT LAST_INSERT_ROWID()";
return (long)cmd.ExecuteScalar();
}
}
#endregion #endregion
#region Write Into The Database #region Write Into The Database
@ -724,28 +745,13 @@ namespace Kyoo.InternalAPI
public void RegisterShowPeople(long showID, List<People> people) public void RegisterShowPeople(long showID, List<People> people)
{ {
string query = "INSERT INTO people (slug, name, imgPrimary, externalIDs) VALUES($slug, $name, $imgPrimary, $externalIDs);";
string linkQuery = "INSERT INTO peopleLinks (peopleID, showID, role, type) VALUES($peopleID, $showID, $role, $type);"; string linkQuery = "INSERT INTO peopleLinks (peopleID, showID, role, type) VALUES($peopleID, $showID, $role, $type);";
for (int i = 0; i < people.Count; i++) for (int i = 0; i < people.Count; i++)
{ {
long peopleID;
using (SQLiteCommand cmd = new SQLiteCommand(query, sqlConnection))
{
cmd.Parameters.AddWithValue("$slug", people[i].slug);
cmd.Parameters.AddWithValue("$name", people[i].Name);
cmd.Parameters.AddWithValue("$imgPrimary", people[i].imgPrimary);
cmd.Parameters.AddWithValue("$externalIDs", people[i].externalIDs);
cmd.ExecuteNonQuery();
cmd.CommandText = "SELECT LAST_INSERT_ROWID()";
peopleID = (long)cmd.ExecuteScalar();
}
using (SQLiteCommand cmd = new SQLiteCommand(linkQuery, sqlConnection)) using (SQLiteCommand cmd = new SQLiteCommand(linkQuery, sqlConnection))
{ {
cmd.Parameters.AddWithValue("$peopleID", peopleID); cmd.Parameters.AddWithValue("$peopleID", GetOrCreatePeople(people[i]));
cmd.Parameters.AddWithValue("$showID", showID); cmd.Parameters.AddWithValue("$showID", showID);
cmd.Parameters.AddWithValue("$role", people[i].Role); cmd.Parameters.AddWithValue("$role", people[i].Role);
cmd.Parameters.AddWithValue("$type", people[i].Type); cmd.Parameters.AddWithValue("$type", people[i].Type);

View File

@ -8,7 +8,7 @@ namespace Kyoo.InternalAPI.TranscoderLink
{ {
public class TranscoderAPI public class TranscoderAPI
{ {
private const string TranscoderPath = @"C:\Projects\Kyoo\Debug\Kyoo.Transcoder.dll"; private const string TranscoderPath = @"Transcoder\Kyoo.Transcoder.dll";
[DllImport(TranscoderPath, CallingConvention = CallingConvention.Cdecl)] [DllImport(TranscoderPath, CallingConvention = CallingConvention.Cdecl)]
public extern static int Init(); public extern static int Init();
@ -42,15 +42,13 @@ namespace Kyoo.InternalAPI.TranscoderLink
j++; j++;
} }
streamsPtr += size; streamsPtr += size;
Debug.WriteLine("&Stream got: " + stream.Language);
} }
} }
else else
tracks = null; tracks = null;
FreeMemory(ptr); FreeMemory(ptr);
Debug.WriteLine("&File done: " + path); Debug.WriteLine("&" + tracks?.Length + " tracks got at: " + path);
} }
[DllImport(TranscoderPath, CallingConvention = CallingConvention.Cdecl)] [DllImport(TranscoderPath, CallingConvention = CallingConvention.Cdecl)]

View File

@ -33,7 +33,10 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Remove="ClientApp\src\models\genre.ts" />
<None Remove="ClientApp\src\models\people.ts" />
<None Remove="ClientApp\src\models\show.ts" /> <None Remove="ClientApp\src\models\show.ts" />
<None Remove="ClientApp\src\models\studio.ts" />
<None Remove="ClientApp\src\models\watch-item.ts" /> <None Remove="ClientApp\src\models\watch-item.ts" />
</ItemGroup> </ItemGroup>
@ -72,10 +75,55 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<TypeScriptCompile Include="ClientApp\src\models\genre.ts" />
<TypeScriptCompile Include="ClientApp\src\models\people.ts" />
<TypeScriptCompile Include="ClientApp\src\models\show.ts" /> <TypeScriptCompile Include="ClientApp\src\models\show.ts" />
<TypeScriptCompile Include="ClientApp\src\models\studio.ts" />
<TypeScriptCompile Include="ClientApp\src\models\watch-item.ts" /> <TypeScriptCompile Include="ClientApp\src\models\watch-item.ts" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Update="Transcoder\avcodec-58.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Transcoder\avdevice-58.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Transcoder\avfilter-7.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Transcoder\avformat-58.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Transcoder\avutil-56.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Transcoder\Kyoo.Transcoder.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Transcoder\Kyoo.Transcoder.exp">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Transcoder\Kyoo.Transcoder.ilk">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Transcoder\Kyoo.Transcoder.lib">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Transcoder\Kyoo.Transcoder.pdb">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Transcoder\postproc-55.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Transcoder\swresample-3.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Transcoder\swscale-5.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') "> <Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') ">
<!-- Ensure Node.js is installed --> <!-- Ensure Node.js is installed -->
<Exec Command="node --version" ContinueOnError="true"> <Exec Command="node --version" ContinueOnError="true">

View File

@ -31,8 +31,8 @@ namespace Kyoo.Models
//Used in the rest API excusively. //Used in the rest API excusively.
public Studio studio; public Studio studio;
public IEnumerable<People> directors; public IEnumerable<People> directors;
public IEnumerable<Season> seasons;
public IEnumerable<People> people; public IEnumerable<People> people;
public IEnumerable<Season> seasons;
public string GetAliases() public string GetAliases()

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.