Added docker
This commit is contained in:
parent
6bc733b866
commit
dad51e60c1
|
@ -0,0 +1,16 @@
|
||||||
|
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
RUN git clone https://github.com/tesses50/tytd-2022 .
|
||||||
|
WORKDIR /app/Tesses.YouTubeDownloader.Net6
|
||||||
|
# Restore as distinct layers
|
||||||
|
RUN dotnet restore
|
||||||
|
# Build and publish a release
|
||||||
|
RUN dotnet publish -c Release -o /app/out
|
||||||
|
|
||||||
|
# Build runtime image
|
||||||
|
FROM mcr.microsoft.com/dotnet/runtime:6.0
|
||||||
|
WORKDIR /app
|
||||||
|
EXPOSE 3250
|
||||||
|
COPY --from=build-env /app/out .
|
||||||
|
ENTRYPOINT ["dotnet", "Tesses.YouTubeDownloader.Net6.dll","--docker"]
|
|
@ -7,10 +7,15 @@ namespace Tesses.YouTubeDownloader.Net6
|
||||||
{
|
{
|
||||||
public static async Task Main(string[] args)
|
public static async Task Main(string[] args)
|
||||||
{
|
{
|
||||||
|
if(args.Contains("--docker"))
|
||||||
|
{
|
||||||
|
|
||||||
|
Environment.CurrentDirectory="/data";
|
||||||
|
}
|
||||||
TYTDCurrentDirectory currentDirectory=new TYTDCurrentDirectory(new HttpClient());
|
TYTDCurrentDirectory currentDirectory=new TYTDCurrentDirectory(new HttpClient());
|
||||||
TYTDServer server=new TYTDServer(currentDirectory);
|
TYTDServer server=new TYTDServer(currentDirectory);
|
||||||
server.RootServer.Server=new StaticServer("WebSite");
|
server.RootServer.Server=new StaticServer("WebSite");
|
||||||
|
currentDirectory.CanDownload=false;
|
||||||
HttpServerListener listener=new HttpServerListener(new System.Net.IPEndPoint(System.Net.IPAddress.Any,3252),server.InnerServer);
|
HttpServerListener listener=new HttpServerListener(new System.Net.IPEndPoint(System.Net.IPAddress.Any,3252),server.InnerServer);
|
||||||
currentDirectory.StartLoop();
|
currentDirectory.StartLoop();
|
||||||
TYTDStorage.FFmpeg ="/usr/bin/ffmpeg";
|
TYTDStorage.FFmpeg ="/usr/bin/ffmpeg";
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>Document</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Hello, World!</h1>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -23,7 +23,7 @@ class TYTD
|
||||||
downloadItem(url,res)
|
downloadItem(url,res)
|
||||||
{
|
{
|
||||||
var callurl=new URL(`api/AddItemRes/${res}/${url}`,this.server).href;
|
var callurl=new URL(`api/AddItemRes/${res}/${url}`,this.server).href;
|
||||||
$.get(callurl,function(e){});
|
$.ajax(callurl,function(e){});
|
||||||
}
|
}
|
||||||
downloadItem(url)
|
downloadItem(url)
|
||||||
{
|
{
|
||||||
|
@ -33,14 +33,14 @@ class TYTD
|
||||||
progress(p)
|
progress(p)
|
||||||
{
|
{
|
||||||
var callurl=new URL("api/v2/Progress",this.server).href;
|
var callurl=new URL("api/v2/Progress",this.server).href;
|
||||||
$.get(callurl,function(e){
|
$.ajax(callurl,function(e){
|
||||||
p(JSON.parse(e));
|
p(JSON.parse(e));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
queuelist(ql)
|
queuelist(ql)
|
||||||
{
|
{
|
||||||
var callurl=new URL("api/v2/QueueList",this.server).href;
|
var callurl=new URL("api/v2/QueueList",this.server).href;
|
||||||
$.get(callurl,function(e){
|
$.ajax(callurl,function(e){
|
||||||
ql(JSON.parse(e));
|
ql(JSON.parse(e));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -81,21 +81,21 @@ class TYTD
|
||||||
getvideoinfofile(filename,info)
|
getvideoinfofile(filename,info)
|
||||||
{
|
{
|
||||||
var callurl=new URL(`api/Storage/File/Info/${filename}`,this.server).href;
|
var callurl=new URL(`api/Storage/File/Info/${filename}`,this.server).href;
|
||||||
$.get(callurl,function(e){
|
$.ajax(callurl,function(e){
|
||||||
info(JSON.parse(e));
|
info(JSON.parse(e));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
getchannelinfofile(filename,info)
|
getchannelinfofile(filename,info)
|
||||||
{
|
{
|
||||||
var callurl=new URL(`api/Storage/File/Channel/${filename}`,this.server).href;
|
var callurl=new URL(`api/Storage/File/Channel/${filename}`,this.server).href;
|
||||||
$.get(callurl,function(e){
|
$.ajax(callurl,function(e){
|
||||||
info(JSON.parse(e));
|
info(JSON.parse(e));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
getvideoinfofiles(vid)
|
getvideoinfofiles(vid)
|
||||||
{
|
{
|
||||||
var callurl=new URL("api/Storage/GetFiles/Info",this.server).href;
|
var callurl=new URL("api/Storage/GetFiles/Info",this.server).href;
|
||||||
$.get(callurl,function(e){
|
$.ajax(callurl,function(e){
|
||||||
vid(JSON.parse(e));
|
vid(JSON.parse(e));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -106,28 +106,28 @@ class TYTD
|
||||||
getplaylistinfofile(info)
|
getplaylistinfofile(info)
|
||||||
{
|
{
|
||||||
var callurl=new URL(`api/Storage/File/Playlist/${filename}`,this.server).href;
|
var callurl=new URL(`api/Storage/File/Playlist/${filename}`,this.server).href;
|
||||||
$.get(callurl,function(e){
|
$.ajax(callurl,function(e){
|
||||||
info(JSON.parse(e));
|
info(JSON.parse(e));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
getplaylistinfofiles(pl)
|
getplaylistinfofiles(pl)
|
||||||
{
|
{
|
||||||
var callurl = new URL("api/Storage/GetFiles/Playlist",this.server).href;
|
var callurl = new URL("api/Storage/GetFiles/Playlist",this.server).href;
|
||||||
$.get(callurl,function(e){
|
$.ajax(callurl,function(e){
|
||||||
pl(JSON.parse(e));
|
pl(JSON.parse(e));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
getchannelinfofiles(chan)
|
getchannelinfofiles(chan)
|
||||||
{
|
{
|
||||||
var callurl = new URL("api/Storage/GetFiles/Channel",this.server).href;
|
var callurl = new URL("api/Storage/GetFiles/Channel",this.server).href;
|
||||||
$.get(callurl,function(e){
|
$.ajax(callurl,function(e){
|
||||||
chan(JSON.parse(e));
|
chan(JSON.parse(e));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
getsubscriptions(subs)
|
getsubscriptions(subs)
|
||||||
{
|
{
|
||||||
var callurl = new URL("api/v2/subscriptions",this.server).href;
|
var callurl = new URL("api/v2/subscriptions",this.server).href;
|
||||||
$.get(callurl,function(e){
|
$.ajax(callurl,function(e){
|
||||||
subs(JSON.parse(e));
|
subs(JSON.parse(e));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -135,28 +135,28 @@ class TYTD
|
||||||
{
|
{
|
||||||
var ginfo = getinfo == true ? "true" : "false";
|
var ginfo = getinfo == true ? "true" : "false";
|
||||||
var callurl = new URL(`api/v2/subscribe?id=${encodeURIComponent(cid)}&conf=${conf}&getinfo=${getinfo}`,this.server).href;
|
var callurl = new URL(`api/v2/subscribe?id=${encodeURIComponent(cid)}&conf=${conf}&getinfo=${getinfo}`,this.server).href;
|
||||||
$.get(callurl,function(e){
|
$.ajax(callurl,function(e){
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
subscribe(name,conf)
|
subscribe(name,conf)
|
||||||
{
|
{
|
||||||
var callurl = new URL(`api/v2/subscribe?id=${encodeURIComponent(name)}&conf=${conf}`,this.server).href;
|
var callurl = new URL(`api/v2/subscribe?id=${encodeURIComponent(name)}&conf=${conf}`,this.server).href;
|
||||||
$.get(callurl,function(e){
|
$.ajax(callurl,function(e){
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
unsubscribe(cid)
|
unsubscribe(cid)
|
||||||
{
|
{
|
||||||
var callurl = new URL(`api/v2/unsubscribe?id=${encodeURIComponent(cid)}`,this.server).href;
|
var callurl = new URL(`api/v2/unsubscribe?id=${encodeURIComponent(cid)}`,this.server).href;
|
||||||
$.get(callurl,function(e){
|
$.ajax(callurl,function(e){
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
resubscribe(cid,conf)
|
resubscribe(cid,conf)
|
||||||
{
|
{
|
||||||
var callurl = new URL(`api/v2/resubscribe?id=${encodeURIComponent(cid)}&conf=${conf}`,this.server).href;
|
var callurl = new URL(`api/v2/resubscribe?id=${encodeURIComponent(cid)}&conf=${conf}`,this.server).href;
|
||||||
$.get(callurl,function(e){
|
$.ajax(callurl,function(e){
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -164,21 +164,21 @@ class TYTD
|
||||||
getfiles(path,ls)
|
getfiles(path,ls)
|
||||||
{
|
{
|
||||||
var callurl=new URL(`api/Storage/GetFiles/${path}`,this.server).href;
|
var callurl=new URL(`api/Storage/GetFiles/${path}`,this.server).href;
|
||||||
$.get(callurl,function(e){
|
$.ajax(callurl,function(e){
|
||||||
ls(JSON.parse(e));
|
ls(JSON.parse(e));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
getdirectories(path,ls)
|
getdirectories(path,ls)
|
||||||
{
|
{
|
||||||
var callurl=new URL(`api/Storage/GetDirectories/${path}`,this.server).href;
|
var callurl=new URL(`api/Storage/GetDirectories/${path}`,this.server).href;
|
||||||
$.get(callurl,function(e){
|
$.ajax(callurl,function(e){
|
||||||
ls(JSON.parse(e));
|
ls(JSON.parse(e));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
fileexists(path,exists,doesntexist)
|
fileexists(path,exists,doesntexist)
|
||||||
{
|
{
|
||||||
var callurl=new URL(`api/Storage/FileExists/${path}`,this.server).href;
|
var callurl=new URL(`api/Storage/FileExists/${path}`,this.server).href;
|
||||||
$.get(callurl,function(e){
|
$.ajax(callurl,function(e){
|
||||||
if(e==="true")
|
if(e==="true")
|
||||||
{
|
{
|
||||||
exists();
|
exists();
|
||||||
|
@ -190,7 +190,7 @@ class TYTD
|
||||||
directoryexists(path,exists,doesntexist)
|
directoryexists(path,exists,doesntexist)
|
||||||
{
|
{
|
||||||
var callurl=new URL(`api/Storage/DirectoryExists/${path}`,this.server).href;
|
var callurl=new URL(`api/Storage/DirectoryExists/${path}`,this.server).href;
|
||||||
$.get(callurl,function(e){
|
$.ajax(callurl,function(e){
|
||||||
if(e==="true")
|
if(e==="true")
|
||||||
{
|
{
|
||||||
exists();
|
exists();
|
||||||
|
|
Loading…
Reference in New Issue