Compare commits
No commits in common. "b6ff40600562ef34d874b070a6b1f60d043d8515" and "13307e15a8c447493f4872814d550ce50cfbf957" have entirely different histories.
b6ff406005
...
13307e15a8
|
@ -1,16 +0,0 @@
|
|||
|
||||
stages:
|
||||
- build
|
||||
|
||||
build:
|
||||
image: mcr.microsoft.com/dotnet/sdk:8.0
|
||||
stage: build
|
||||
only:
|
||||
- master
|
||||
artifacts:
|
||||
paths:
|
||||
- publish
|
||||
script:
|
||||
- apt update -y
|
||||
- apt install -y make zip tar
|
||||
- make all
|
|
@ -1,7 +0,0 @@
|
|||
steps:
|
||||
- name: build
|
||||
image: mcr.microsoft.com/dotnet/sdk:8.0
|
||||
commands:
|
||||
- apt update -y
|
||||
- apt install -y make zip tar
|
||||
- make all
|
|
@ -1,10 +0,0 @@
|
|||
steps:
|
||||
- name: deploy
|
||||
image: woodpeckerci/plugin-release
|
||||
settings:
|
||||
files:
|
||||
- 'publish/*/*'
|
||||
api_key:
|
||||
from_secret: ACCESS_TOKEN
|
||||
depends_on:
|
||||
- build
|
|
@ -6,7 +6,7 @@
|
|||
<title>TYTD Lite</title>
|
||||
<link rel="stylesheet" href="./beer.min.css">
|
||||
<link rel="stylesheet" href="./theme.css">
|
||||
<link rel="manifest" href="./site.webmanifest">
|
||||
<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
{{if notavailable}}
|
||||
<article class="error">
|
||||
<p>This video is unavailable on YouTube.</p>
|
||||
</article>
|
||||
{{end}}
|
||||
{{if offline}}
|
||||
<article class="error">
|
||||
<p>We can't access YouTube right now.</p>
|
||||
<p>This video is unavailable on YouTube</p>
|
||||
</article>
|
||||
{{end}}
|
||||
{{if invalidurl}}
|
||||
|
|
|
@ -142,8 +142,8 @@ server.Server.StartServer(port);
|
|||
var video=VideoId.TryParse(v);
|
||||
if(video.HasValue)
|
||||
{
|
||||
var (_v,rfy,off)=await GetSavedVideoAsync(video.Value);
|
||||
await ctx.SendJsonAsync(new{Video=_v,RemovedFromYouTube=rfy,Offline=off});
|
||||
var (_v,rfy)=await GetSavedVideoAsync(video.Value);
|
||||
await ctx.SendJsonAsync(new{Video=_v,RemovedFromYouTube=rfy});
|
||||
}
|
||||
else
|
||||
await ctx.SendNotFoundAsync();
|
||||
|
@ -220,7 +220,7 @@ server.Server.StartServer(port);
|
|||
await PreformTask(video.Value,res,new Progress<double>(e=>{
|
||||
|
||||
}));
|
||||
var (svideo,_,_) = await GetSavedVideoAsync(video.Value);
|
||||
var (svideo,_) = await GetSavedVideoAsync(video.Value);
|
||||
|
||||
switch(res)
|
||||
{
|
||||
|
@ -263,11 +263,10 @@ server.Server.StartServer(port);
|
|||
}
|
||||
}
|
||||
|
||||
private async Task<(SavedVideo video,bool removedByYt,bool offline)> GetSavedVideoAsync(VideoId id)
|
||||
private async Task<(SavedVideo video,bool removedByYt)> GetSavedVideoAsync(VideoId id)
|
||||
{
|
||||
string _id = id.Value;
|
||||
bool removedByYt=false;
|
||||
bool offline=false;
|
||||
SavedVideo video=new SavedVideo();
|
||||
await LockAsync(async()=>{
|
||||
var _video=Videos.FindOne(e=>e.VideoId == _id);
|
||||
|
@ -300,11 +299,6 @@ server.Server.StartServer(port);
|
|||
_=ex;
|
||||
removedByYt=true;
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
_=ex;
|
||||
offline=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -336,7 +330,7 @@ server.Server.StartServer(port);
|
|||
}
|
||||
}
|
||||
});
|
||||
return (video,removedByYt,offline);
|
||||
return (video,removedByYt);
|
||||
}
|
||||
|
||||
private async Task DownloadThumbnailsAsync(VideoId id)
|
||||
|
@ -653,9 +647,7 @@ server.Server.StartServer(port);
|
|||
{
|
||||
case "PreMuxed":
|
||||
{
|
||||
var (video,removedByYT,off) = await GetSavedVideoAsync(id);
|
||||
if(off && !Directory.Exists(Path.Combine(ServerPath,"PreMuxed")) && !File.Exists(Path.Combine(ServerPath,"PreMuxed",$"{video.VideoId}.{(video.PreMuxed != null ? video.PreMuxed.Container : "mp4")}")))
|
||||
throw new VideoUnavailableException("We don't have access to YouTube");
|
||||
var (video,removedByYT) = await GetSavedVideoAsync(id);
|
||||
|
||||
if(removedByYT && !Directory.Exists(Path.Combine(ServerPath,"PreMuxed")) && !File.Exists(Path.Combine(ServerPath,"PreMuxed",$"{video.VideoId}.{(video.PreMuxed != null ? video.PreMuxed.Container : "mp4")}")))
|
||||
throw new VideoUnavailableException("We dont have the video either");
|
||||
|
@ -665,9 +657,8 @@ server.Server.StartServer(port);
|
|||
break;
|
||||
case "AudioOnly":
|
||||
{
|
||||
var (video,removedByYT,off) = await GetSavedVideoAsync(id);
|
||||
if(off && !Directory.Exists(Path.Combine(ServerPath,"AudioOnly")) && !File.Exists(Path.Combine(ServerPath,"AudioOnly",$"{video.VideoId}.{(video.AudioOnly != null ? video.AudioOnly.Container : "mp4")}")))
|
||||
throw new VideoUnavailableException("We don't have access to YouTube");
|
||||
var (video,removedByYT) = await GetSavedVideoAsync(id);
|
||||
|
||||
if(removedByYT && !Directory.Exists(Path.Combine(ServerPath,"AudioOnly")) && !File.Exists(Path.Combine(ServerPath,"AudioOnly",$"{video.VideoId}.{(video.AudioOnly != null ? video.AudioOnly.Container : "mp4")}")))
|
||||
throw new VideoUnavailableException("We dont have the video either");
|
||||
|
||||
|
@ -676,9 +667,8 @@ server.Server.StartServer(port);
|
|||
break;
|
||||
case "VideoOnly":
|
||||
{
|
||||
var (video,removedByYT,off) = await GetSavedVideoAsync(id);
|
||||
if(off && !Directory.Exists(Path.Combine(ServerPath,"VideoOnly")) && !File.Exists(Path.Combine(ServerPath,"VideoOnly",$"{video.VideoId}.{(video.VideoOnly != null ? video.VideoOnly.Container : "mp4")}")))
|
||||
throw new VideoUnavailableException("We don't have access to YouTube");
|
||||
var (video,removedByYT) = await GetSavedVideoAsync(id);
|
||||
|
||||
if(removedByYT && !Directory.Exists(Path.Combine(ServerPath,"VideoOnly")) && !File.Exists(Path.Combine(ServerPath,"VideoOnly",$"{video.VideoId}.{(video.VideoOnly != null ? video.VideoOnly.Container : "mp4")}")))
|
||||
throw new VideoUnavailableException("We dont have the video either");
|
||||
|
||||
|
@ -687,7 +677,7 @@ server.Server.StartServer(port);
|
|||
break;
|
||||
case "MP3":
|
||||
{
|
||||
var (video,removedByYT,off) = await GetSavedVideoAsync(id);
|
||||
var (video,removedByYT) = await GetSavedVideoAsync(id);
|
||||
|
||||
if(!HasConverter && !Directory.Exists(Path.Combine(ServerPath,"MP3")) && !File.Exists(Path.Combine(ServerPath,"MP3",$"{id}.mp3")))
|
||||
throw new OperationCanceledException("We don't have the converter.");
|
||||
|
@ -697,7 +687,7 @@ server.Server.StartServer(port);
|
|||
break;
|
||||
case "MP4":
|
||||
{
|
||||
var (video,removedByYT,off) = await GetSavedVideoAsync(id);
|
||||
var (video,removedByYT) = await GetSavedVideoAsync(id);
|
||||
|
||||
if(!HasConverter && !Directory.Exists(Path.Combine(ServerPath,"MP4")) && !File.Exists(Path.Combine(ServerPath,"MP4",$"{id}.mp4")))
|
||||
throw new OperationCanceledException("We don't have the converter.");
|
||||
|
@ -707,7 +697,7 @@ server.Server.StartServer(port);
|
|||
break;
|
||||
case "MKV":
|
||||
{
|
||||
var (video,removedByYT,off) = await GetSavedVideoAsync(id);
|
||||
var (video,removedByYT) = await GetSavedVideoAsync(id);
|
||||
|
||||
if(!HasConverter && !Directory.Exists(Path.Combine(ServerPath,"MKV")) && !File.Exists(Path.Combine(ServerPath,"MKV",$"{id}.mkv")))
|
||||
throw new OperationCanceledException("We don't have the converter.");
|
||||
|
@ -746,13 +736,12 @@ server.Server.StartServer(port);
|
|||
|
||||
if(id.HasValue)
|
||||
{
|
||||
(SavedVideo video,bool notavailable,bool offline)=await GetSavedVideoAsync(id.Value);
|
||||
bool premuxed = (notavailable || offline) ? await StreamExistsAsync(video,"PreMuxed") : true;
|
||||
bool audioonly = (notavailable || offline) ? await StreamExistsAsync(video,"AudioOnly") : true;
|
||||
bool videoonly = (notavailable || offline) ? await StreamExistsAsync(video,"VideoOnly") : true;
|
||||
(SavedVideo video,bool notavailable)=await GetSavedVideoAsync(id.Value);
|
||||
bool premuxed = notavailable ? await StreamExistsAsync(video,"PreMuxed") : true;
|
||||
bool audioonly = notavailable ? await StreamExistsAsync(video,"AudioOnly") : true;
|
||||
bool videoonly = notavailable ? await StreamExistsAsync(video,"VideoOnly") : true;
|
||||
bool converter=HasConverter; //change me
|
||||
result = new {
|
||||
offline,
|
||||
notavailable,
|
||||
premuxed,
|
||||
audioonly,
|
||||
|
|
Loading…
Reference in New Issue