mirror of
https://onedev.site.tesses.net/tytd2025
synced 2026-04-18 10:46:32 +00:00
Compare commits
24 Commits
abe5ce7fba
...
1eccb71437
| Author | SHA1 | Date | |
|---|---|---|---|
| 1eccb71437 | |||
| 269b654c2e | |||
| 8126b2a616 | |||
| 22086d488f | |||
| 7d6c783f26 | |||
| 8560529475 | |||
| dec21a7c5d | |||
| 0708b3b0cf | |||
| c64f2cca88 | |||
| e614f4841f | |||
| 9abff478b8 | |||
| 31b179c8a3 | |||
| 8e3aa313ff | |||
| e1b7216c69 | |||
| 67de5e2d6d | |||
| 95a3585648 | |||
| 148106f191 | |||
| 5106c5dc6b | |||
| d3d04bb971 | |||
| 478451034f | |||
| 1ab1c11582 | |||
| 43f6d4ac33 | |||
| d64052920e | |||
| 2eff24d67b |
@@ -1,2 +1,2 @@
|
||||
bin
|
||||
obj
|
||||
obj
|
||||
@@ -24,8 +24,10 @@
|
||||
},
|
||||
"template_project_dependencies": [
|
||||
],
|
||||
"type": "template"
|
||||
"type": "template",
|
||||
"template_icon": "icon.png"
|
||||
},
|
||||
"name": "Tesses.YouTubeDownloader.PluginTemplate",
|
||||
"version": "1.0.0.0-prod"
|
||||
"version": "1.0.0.0-prod",
|
||||
"icon": "icon.png"
|
||||
}
|
||||
BIN
Tesses.YouTubeDownloader.PluginTemplate/res/icon.png
Normal file
BIN
Tesses.YouTubeDownloader.PluginTemplate/res/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
@@ -2,7 +2,7 @@ class PluginServer
|
||||
{
|
||||
public Handle(ctx)
|
||||
{
|
||||
ctx.WithMimeType().SendText(<div><h1>Hello, world from @%PROJECT_NAME<h1><p>Path: {ctx.Path}, OriginalPath: {ctx.OriginalPath}</p></div>);
|
||||
ctx.WithMimeType().SendText(<div><h1>Hello, world from %PROJECT_NAME%<h1><p>Path: {ctx.Path}, OriginalPath: {ctx.OriginalPath}</p></div>);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,78 +1,86 @@
|
||||
:root,
|
||||
body.light {
|
||||
--primary:#c00100;
|
||||
--primary:#bc004b;
|
||||
--on-primary:#ffffff;
|
||||
--primary-container:#ffdad4;
|
||||
--on-primary-container:#410000;
|
||||
--secondary:#775651;
|
||||
--primary-container:#ffd9de;
|
||||
--on-primary-container:#400014;
|
||||
--secondary:#75565b;
|
||||
--on-secondary:#ffffff;
|
||||
--secondary-container:#ffdad4;
|
||||
--on-secondary-container:#2c1512;
|
||||
--tertiary:#705c2e;
|
||||
--secondary-container:#ffd9de;
|
||||
--on-secondary-container:#2c1519;
|
||||
--tertiary:#795831;
|
||||
--on-tertiary:#ffffff;
|
||||
--tertiary-container:#fbdfa6;
|
||||
--on-tertiary-container:#251a00;
|
||||
--tertiary-container:#ffddba;
|
||||
--on-tertiary-container:#2b1700;
|
||||
--error:#ba1a1a;
|
||||
--on-error:#ffffff;
|
||||
--error-container:#ffdad6;
|
||||
--on-error-container:#410002;
|
||||
--background:#fffbff;
|
||||
--on-background:#201a19;
|
||||
--surface:#fff8f6;
|
||||
--on-surface:#201a19;
|
||||
--surface-variant:#f5ddda;
|
||||
--on-surface-variant:#534341;
|
||||
--outline:#857370;
|
||||
--outline-variant:#d8c2be;
|
||||
--on-background:#201a1b;
|
||||
--surface:#fff8f7;
|
||||
--on-surface:#201a1b;
|
||||
--surface-variant:#f3dddf;
|
||||
--on-surface-variant:#524345;
|
||||
--outline:#847375;
|
||||
--outline-variant:#d6c2c3;
|
||||
--shadow:#000000;
|
||||
--scrim:#000000;
|
||||
--inverse-surface:#362f2e;
|
||||
--inverse-on-surface:#fbeeec;
|
||||
--inverse-primary:#ffb4a8;
|
||||
--surface-dim:#e4d7d5;
|
||||
--surface-bright:#fff8f6;
|
||||
--inverse-surface:#362f2f;
|
||||
--inverse-on-surface:#fbeeee;
|
||||
--inverse-primary:#ffb2be;
|
||||
--surface-dim:#e3d7d8;
|
||||
--surface-bright:#fff8f7;
|
||||
--surface-container-lowest:#ffffff;
|
||||
--surface-container-low:#fef1ee;
|
||||
--surface-container:#f8ebe9;
|
||||
--surface-container-high:#f3e5e3;
|
||||
--surface-container-highest:#ede0dd;
|
||||
--surface-container-low:#fdf1f1;
|
||||
--surface-container:#f8ebeb;
|
||||
--surface-container-high:#f2e5e6;
|
||||
--surface-container-highest:#ece0e0;
|
||||
}
|
||||
|
||||
body.dark {
|
||||
--primary:#ffb4a8;
|
||||
--on-primary:#690100;
|
||||
--primary-container:#930100;
|
||||
--on-primary-container:#ffdad4;
|
||||
--secondary:#e7bdb6;
|
||||
--on-secondary:#442925;
|
||||
--secondary-container:#5d3f3b;
|
||||
--on-secondary-container:#ffdad4;
|
||||
--tertiary:#dec48c;
|
||||
--on-tertiary:#3e2e04;
|
||||
--tertiary-container:#564419;
|
||||
--on-tertiary-container:#fbdfa6;
|
||||
--primary:#ffb2be;
|
||||
--on-primary:#660025;
|
||||
--primary-container:#900038;
|
||||
--on-primary-container:#ffd9de;
|
||||
--secondary:#e5bdc2;
|
||||
--on-secondary:#43292d;
|
||||
--secondary-container:#5c3f43;
|
||||
--on-secondary-container:#ffd9de;
|
||||
--tertiary:#ebbf90;
|
||||
--on-tertiary:#452b08;
|
||||
--tertiary-container:#5f411c;
|
||||
--on-tertiary-container:#ffddba;
|
||||
--error:#ffb4ab;
|
||||
--on-error:#690005;
|
||||
--error-container:#93000a;
|
||||
--on-error-container:#ffb4ab;
|
||||
--background:#201a19;
|
||||
--on-background:#ede0dd;
|
||||
--surface:#181211;
|
||||
--on-surface:#ede0dd;
|
||||
--surface-variant:#534341;
|
||||
--on-surface-variant:#d8c2be;
|
||||
--outline:#a08c89;
|
||||
--outline-variant:#534341;
|
||||
--background:#201a1b;
|
||||
--on-background:#ece0e0;
|
||||
--surface:#181213;
|
||||
--on-surface:#ece0e0;
|
||||
--surface-variant:#524345;
|
||||
--on-surface-variant:#d6c2c3;
|
||||
--outline:#9f8c8e;
|
||||
--outline-variant:#524345;
|
||||
--shadow:#000000;
|
||||
--scrim:#000000;
|
||||
--inverse-surface:#ede0dd;
|
||||
--inverse-on-surface:#362f2e;
|
||||
--inverse-primary:#c00100;
|
||||
--surface-dim:#181211;
|
||||
--surface-bright:#3f3736;
|
||||
--surface-container-lowest:#120d0c;
|
||||
--surface-container-low:#201a19;
|
||||
--surface-container:#251e1d;
|
||||
--surface-container-high:#2f2827;
|
||||
--surface-container-highest:#3b3332;
|
||||
--inverse-surface:#ece0e0;
|
||||
--inverse-on-surface:#362f2f;
|
||||
--inverse-primary:#bc004b;
|
||||
--surface-dim:#181213;
|
||||
--surface-bright:#3f3738;
|
||||
--surface-container-lowest:#120d0d;
|
||||
--surface-container-low:#201a1b;
|
||||
--surface-container:#241e1f;
|
||||
--surface-container-high:#2f2829;
|
||||
--surface-container-highest:#3a3334;
|
||||
}
|
||||
|
||||
.loading-indicator
|
||||
{
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
2018
Tesses.YouTubeDownloader.Server/res/video-js.css
Normal file
2018
Tesses.YouTubeDownloader.Server/res/video-js.css
Normal file
File diff suppressed because one or more lines are too long
53
Tesses.YouTubeDownloader.Server/res/video.min.js
vendored
Normal file
53
Tesses.YouTubeDownloader.Server/res/video.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
Tesses.YouTubeDownloader.Server/res/wavy.svg
Normal file
5
Tesses.YouTubeDownloader.Server/res/wavy.svg
Normal file
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="610 1101 1220 75">
|
||||
<path fill="#D0BCFF" d="M1870.425 1173.746c-29.448 0-58.665-7.477-84.493-21.622-.03-.016-.061-.032-.09-.049-43.555-23.82-95.546-23.809-139.091.039a4.079 4.079 0 0 1-.113.062c-25.803 14.109-54.984 21.567-84.394 21.568-29.449 0-58.667-7.478-84.495-21.623-43.554-23.852-95.539-23.865-139.089-.052-.03.018-.062.034-.092.051-25.83 14.146-55.048 21.623-84.497 21.623-29.423 0-58.613-7.463-84.425-21.584l-.077-.042c-43.572-23.863-95.596-23.862-139.164-.001l-.085.046c-25.809 14.117-55.001 21.581-84.418 21.581h-.001c-29.45-.001-58.669-7.479-84.498-21.625-43.534-23.845-95.513-23.863-139.063-.058l-.108.06c-25.829 14.146-55.047 21.623-84.496 21.623-29.398 0-58.566-7.451-84.362-21.551-.048-.024-.095-.05-.142-.075-43.568-23.863-95.593-23.863-139.163 0l-.081.043c-25.811 14.12-55.001 21.583-84.421 21.583-29.45 0-58.668-7.478-84.497-21.624-7.521-4.118-10.278-13.554-6.159-21.074s13.554-10.277 21.074-6.158c43.57 23.862 95.593 23.864 139.163 0l.098-.053c25.807-14.114 54.991-21.573 84.406-21.573 29.398 0 58.567 7.451 84.364 21.55l.14.076c43.534 23.843 95.508 23.864 139.056.059l.113-.063c25.828-14.145 55.049-21.622 84.496-21.622h.002c29.449 0 58.668 7.478 84.497 21.625 43.57 23.863 95.595 23.862 139.165.001.021-.013.043-.024.065-.036 25.813-14.124 55.011-21.591 84.438-21.591 29.42 0 58.61 7.463 84.421 21.582l.082.045c43.539 23.847 95.521 23.862 139.074.049l.096-.053c25.829-14.146 55.047-21.623 84.496-21.623s58.667 7.477 84.496 21.623c43.58 23.867 95.604 23.866 139.172.005l.118-.064c25.803-14.108 54.98-21.564 84.389-21.564 29.448-.001 58.666 7.476 84.494 21.62l.114.063c43.549 23.807 95.528 23.791 139.063-.051 7.52-4.121 16.955-1.361 21.073 6.159 4.119 7.521 1.361 16.955-6.159 21.073-25.828 14.146-55.045 21.622-84.492 21.622z">
|
||||
<animateTransform attributeName="transform" calcMode="linear" dur="1s" from="0 0" repeatCount="indefinite" to="312.5 0" type="translate"/>
|
||||
</path>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.9 KiB |
@@ -24,7 +24,6 @@ func Components.AddVideo(id)
|
||||
|
||||
<button name="action" value="add"><i>add</i></button>
|
||||
<button name="action" value="download"><i>download</i></button>
|
||||
<button name="action" value="play"><i>play_arrow</i></button>
|
||||
</div>
|
||||
</form>;
|
||||
}
|
||||
@@ -27,7 +27,6 @@ func Components.Add()
|
||||
<button name="action" value="add"><i>add</i></button>
|
||||
<button name="action" value="info"><i>info</i></button>
|
||||
<button name="action" value="download"><i>download</i></button>
|
||||
<button name="action" value="play"><i>play_arrow</i></button>
|
||||
</div>
|
||||
</form>;
|
||||
}
|
||||
@@ -11,7 +11,7 @@ func Components.DiscoverEntry(item)
|
||||
<div class="max">
|
||||
<div class="col">
|
||||
<div class="min">
|
||||
<a target="_blank" href={$"./video?v={Net.Http.UrlEncode(item.id)}"}>{item.title}</a>
|
||||
<a target="_blank" href={$"./watch?v={Net.Http.UrlEncode(item.id)}"}>{item.title}</a>
|
||||
</div>
|
||||
<div class="min">
|
||||
<span>{item.views} • {item.uploaded}</span>
|
||||
|
||||
@@ -8,7 +8,7 @@ func Components.DownloadedVideo(item)
|
||||
<div class="max">
|
||||
<div class="col">
|
||||
<div class="min">
|
||||
<a hx-get={$"./video?v={Net.Http.UrlEncode(item.videoId)}"} hx-target="body" hx-push-url="true" href={$"./video?v={Net.Http.UrlEncode(item.videoId)}"}>{item.title}</a>
|
||||
<a hx-get={$"./watch?v={Net.Http.UrlEncode(item.videoId)}"} hx-target="body" hx-push-url="true" href={$"./watch?v={Net.Http.UrlEncode(item.videoId)}"}>{item.title}</a>
|
||||
</div>
|
||||
<div class="min">
|
||||
<span>{item.viewCountStr} (when downloaded)</span>
|
||||
@@ -34,7 +34,7 @@ func Components.DownloadedPlaylist(item)
|
||||
<div class="max">
|
||||
<div class="col">
|
||||
<div class="min">
|
||||
<a hx-get={$"./playlist?id={Net.Http.UrlEncode(item.playlistId)}"} href={$"./playlist?id={Net.Http.UrlEncode(item.playlistId)}"} hx-target="body" hx-push-url="true">{item.title}</a>
|
||||
<a hx-get={$"./playlist?list={Net.Http.UrlEncode(item.playlistId)}"} href={$"./playlist?list={Net.Http.UrlEncode(item.playlistId)}"} hx-target="body" hx-push-url="true">{item.title}</a>
|
||||
</div>
|
||||
<div class="min">
|
||||
<a hx-get={$"./channel?id={Net.Http.UrlEncode(item.channelId)}"} href={$"./channel?id={Net.Http.UrlEncode(item.channelId)}"} hx-target="body" hx-push-url="true">{item.channelTitle}</a>
|
||||
|
||||
@@ -2,16 +2,6 @@ func Components.PersonalListDescription(tytd,name,editing)
|
||||
{
|
||||
var description = tytd.GetPersonalListDescription(name);
|
||||
var first=true;
|
||||
var description_with_br = "";
|
||||
each(var txt : description.Split("\n"))
|
||||
{
|
||||
if(!first)
|
||||
{
|
||||
description_with_br += <br>;
|
||||
}
|
||||
description_with_br += Net.Http.HtmlEncode(txt);
|
||||
first=false;
|
||||
}
|
||||
<return>
|
||||
<if(editing)>
|
||||
<true>
|
||||
@@ -32,7 +22,7 @@ func Components.PersonalListDescription(tytd,name,editing)
|
||||
<false>
|
||||
<div class="row" id="description">
|
||||
<div class="max">
|
||||
<p><raw(description_with_br)></p>
|
||||
<plink(description)>
|
||||
</div>
|
||||
<div class="min">
|
||||
<button hx-get={$"./edit-personal-description?name={Net.Http.UrlEncode(name)}"} hx-target="#description" hx-swap="outerHTML"><i>edit</i></button>
|
||||
|
||||
@@ -9,7 +9,7 @@ func Components.InstalledPlugin(item)
|
||||
<div class="max">
|
||||
<div class="col">
|
||||
<div class="min">
|
||||
<if(item.pluginObject.Server != undefined && item.pluginObject.Server != null)>
|
||||
<if(TypeIsDefined(item.pluginObject.Server))>
|
||||
<true>
|
||||
<a class="underline" href={$"./plugin/{Net.Http.UrlPathEncode(item.pluginName)}/"}>{TypeOf(item.info.short_name_pretty) == "String" ? item.info.short_name_pretty : (TypeOf(item.info.short_name) == "String" ? item.info.short_name : item.name)}</a>
|
||||
</true>
|
||||
|
||||
@@ -4,9 +4,9 @@ func Components.Progress(tytd)
|
||||
var vid = tytd.CurrentVideo;
|
||||
|
||||
var html = <div hx-trigger="every 1500ms" hx-indicator="none" hx-get="./progress" hx-swap="outerHTML">
|
||||
<h2>{vid.Title}</h2>
|
||||
<h4>{vid.Channel}</h4>
|
||||
<progress value={tytd.CurrentVideoProgress * 100.0} max="100" min="0"></progress>
|
||||
<h2><a hx-target="body" hx-push-url="true" hx-get={$"./watch?v={Net.Http.UrlEncode(vid.VideoId)}"} href={$"./watch?v={Net.Http.UrlEncode(vid.VideoId)}"}>{vid.Title}</a></h2>
|
||||
<h4><a hx-target="body" hx-push-url="true" hx-get={$"./channel?id={Net.Http.UrlEncode(vid.ChannelId)}"} href={$"./channel?id={Net.Http.UrlEncode(vid.ChannelId)}"}>{vid.Channel}</a></h4>
|
||||
<progress class="wavy light-green-text" value={tytd.CurrentVideoProgress * 100.0} max="100" min="0"></progress>
|
||||
</div>;
|
||||
progress++;
|
||||
return html;
|
||||
|
||||
@@ -62,12 +62,13 @@ func Components.Shell(title, html, page, $mypage)
|
||||
</nav>
|
||||
|
||||
<main class="responsive">
|
||||
<div class="htmx-indicator shape loading-indicator extra" id="loading-indicator">
|
||||
<img class="responsive" src="./tytd.svg">
|
||||
</div>
|
||||
<raw(html)>
|
||||
|
||||
|
||||
</main>
|
||||
|
||||
<div class="htmx-indicator shape loading-indicator extra" id="loading-indicator">
|
||||
<img class="responsive" src="./tytd.svg">
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>;
|
||||
|
||||
@@ -9,7 +9,10 @@ var TYTDResources = [
|
||||
{path="/favicon.ico",value=embed("favicon.ico")},
|
||||
{path="/tytd.svg",value=embed("tytd.svg")},
|
||||
{path="/loading-indicator.svg",value=embed("loading-indicator.svg")},
|
||||
{path="/theme.css",value=embed("theme.css")}
|
||||
{path="/theme.css",value=embed("theme.css")},
|
||||
{path="/video.min.js",value=embed("video.min.js")},
|
||||
{path="/video-js.css",value=embed("video-js.css")},
|
||||
{path="/wavy.svg",value=embed("wavy.svg")}
|
||||
];
|
||||
var times=1;
|
||||
|
||||
@@ -41,6 +44,20 @@ class TYTDApp {
|
||||
ctx.WithMimeType("text/html").SendText(Pages.ApiV1());
|
||||
return true;
|
||||
}
|
||||
else if(ctx.Path == "/embed")
|
||||
{
|
||||
var v = ctx.QueryParams.TryGetFirst("v");
|
||||
if(TypeIsString(v))
|
||||
{
|
||||
const video = this.TYTD.GetVideo(v);
|
||||
if(TypeIsDefined(video))
|
||||
{
|
||||
ctx.WithMimeType("text/html").SendText(Pages.VideoEmbed(v, video.title));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else if(ctx.Path == "/api/v1/download")
|
||||
{
|
||||
var v = ctx.QueryParams.TryGetFirst("v");
|
||||
@@ -51,14 +68,16 @@ class TYTDApp {
|
||||
|
||||
var path = this.TYTD.GetVideoPath(v,res);
|
||||
|
||||
if(path != null)
|
||||
if(path != null && this.TYTD.Storage.FileExists(path))
|
||||
{
|
||||
var info = this.TYTD.GetVideo(v);
|
||||
var filename = $"{info.title}-{info.videoId}-{res}{path.GetExtension()}";
|
||||
var strm = this.TYTD.Storage.OpenFile(path,"rb");
|
||||
ctx.WithMimeType(Net.Http.MimeType(path.ToString())).WithContentDisposition(filename,inline).SendStream(strm);
|
||||
strm.Close();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else if(ctx.Path == "/api/v1/progress.json")
|
||||
{
|
||||
@@ -308,7 +327,7 @@ class TYTDApp {
|
||||
ctx.WithMimeType("text/html").SendText(Pages.Settings(this.TYTD,ctx));
|
||||
return true;
|
||||
}
|
||||
else if(ctx.Path == "/video")
|
||||
else if(ctx.Path == "/watch" || ctx.Path == "/video")
|
||||
{
|
||||
ctx.WithMimeType("text/html").SendText(Pages.VideoInfo(this.TYTD,ctx));
|
||||
return true;
|
||||
|
||||
41
Tesses.YouTubeDownloader.Server/src/pages/embed.tcross
Normal file
41
Tesses.YouTubeDownloader.Server/src/pages/embed.tcross
Normal file
@@ -0,0 +1,41 @@
|
||||
func Pages.VideoEmbed(id, name)
|
||||
{
|
||||
const css = "<style>
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
</style>";
|
||||
const srcTag = $"<source src=\"./api/v1/download?v={Net.Http.UrlEncode(id)}&inline=true\" type=\"video/mp4\"/>";
|
||||
const html = <!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>TYTD - {name}</title>
|
||||
|
||||
<link rel="stylesheet" href="./video-js.css">
|
||||
<script src="./video.min.js" defer></script>
|
||||
/* thanks https://github.com/videojs/video.js/discussions/8156#discussioncomment-5098465 */
|
||||
<raw(css)>
|
||||
</head>
|
||||
<body>
|
||||
<video
|
||||
id="my-video"
|
||||
class="video-js"
|
||||
controls="on"
|
||||
preload="auto"
|
||||
poster={$"./api/v1/video-thumbnail?v={Net.Http.UrlEncode(id)}&res=default"}
|
||||
data-setup="{\"fill\": true}">
|
||||
<raw(srcTag)>
|
||||
<p class="vjs-no-js">
|
||||
To view this video please enable JavaScript, and consider upgrading to a
|
||||
web browser that
|
||||
<a href="https://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
|
||||
</p>
|
||||
</video>
|
||||
</body>
|
||||
</html>;
|
||||
return html;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
func Pages.PlaylistInfo(tytd,ctx)
|
||||
{
|
||||
var id = ctx.QueryParams.TryGetFirst("id");
|
||||
var id = ctx.QueryParams.TryGetFirst("list") ?? ctx.QueryParams.TryGetFirst("id");
|
||||
var page = ctx.QueryParams.TryGetFirstInt("page");
|
||||
if(TypeOf(page) != "Long") page = 1;
|
||||
page--;
|
||||
@@ -27,7 +27,7 @@ func Pages.PlaylistInfo(tytd,ctx)
|
||||
</each>
|
||||
<footer class="row center-align">
|
||||
|
||||
<button hx-get={$"./playlist?id={Net.Http.UrlEncode(id)}&page={page}"} hx-target="body" hx-push-url="true" >Prev</button>{page+1}<button hx-get={$"./playlist?id={Net.Http.UrlEncode(id)}&type=videos&page={page+2}"} hx-target="body" hx-push-url="true" >Next</button>
|
||||
<button hx-get={$"./playlist?list={Net.Http.UrlEncode(id)}&page={page}"} hx-target="body" hx-push-url="true" >Prev</button>{page+1}<button hx-get={$"./playlist?list={Net.Http.UrlEncode(id)}&type=videos&page={page+2}"} hx-target="body" hx-push-url="true" >Next</button>
|
||||
|
||||
</footer>
|
||||
</null>;
|
||||
|
||||
@@ -9,10 +9,11 @@ func Pages.VideoInfo(tytd,ctx)
|
||||
{
|
||||
html = <div class="col">
|
||||
<div class="min">
|
||||
<img src={$"./api/v1/video-thumbnail?v={Net.Http.UrlEncode(vi.videoId)}"}>
|
||||
<iframe src={$"./embed?v={Net.Http.UrlEncode(vi.videoId)}"} style="overflow: hidden;" width="640"
|
||||
height="360" scrolling="no"></iframe>
|
||||
</div>
|
||||
<div class="min">
|
||||
<raw(Components.AddVideo($"https://www.youtube.com/watch?v={vi.videoId}"))>
|
||||
<raw(Components.AddVideo($"https://www.youtube.com/watch?v={Net.Http.UrlEncode(vi.videoId)}"))>
|
||||
</div>
|
||||
<div class="min">
|
||||
<raw(Components.AddToPersonalList(tytd,vi.videoId))>
|
||||
@@ -20,7 +21,7 @@ func Pages.VideoInfo(tytd,ctx)
|
||||
<div class="min">
|
||||
<h4>{vi.title}</h4>
|
||||
<a class="underline" href={$"./channel?id={Net.Http.UrlEncode(vi.channelId)}"}>{vi.author}</a>
|
||||
<p>{vi.shortDescription}</p>
|
||||
<plink(vi.shortDescription)>
|
||||
</div>
|
||||
|
||||
</div>;
|
||||
|
||||
@@ -167,15 +167,15 @@ class TYTD.Downloader {
|
||||
|
||||
if(vid != null)
|
||||
{
|
||||
return $"./video?v={Net.Http.UrlEncode(vid)}";
|
||||
return $"./watch?v={Net.Http.UrlEncode(vid)}";
|
||||
}
|
||||
else if(pid != null)
|
||||
{
|
||||
return $"./playlist?id={Net.Http.UrlEncode(pid)}";
|
||||
return $"./playlist?list={Net.Http.UrlEncode(pid)}";
|
||||
}
|
||||
else if(cid != null)
|
||||
{
|
||||
return $"./playlist?id={Net.Http.UrlEncode(cid)}";
|
||||
return $"./channel?id={Net.Http.UrlEncode(cid)}";
|
||||
}
|
||||
return "./";
|
||||
}
|
||||
@@ -775,7 +775,7 @@ class TYTD.Downloader {
|
||||
_pkg.pluginName = TypeOf(info.short_name) == "String" ? info.short_name : name;
|
||||
var reso = _exec.Resources;
|
||||
var ico = _exec.Icon;
|
||||
_pkg.pluginIcon = ico >= 0 && i < reso.Count ? reso[ico] : embed("package_icon.png");
|
||||
_pkg.pluginIcon = TypeOf(ico) == "ByteArray" ? ico : embed("package_icon.png");
|
||||
subdir.CreateDirectory(/"Files");
|
||||
var d = {
|
||||
TYTD = {
|
||||
@@ -785,11 +785,11 @@ class TYTD.Downloader {
|
||||
GetChannelId = TYTD.GetChannelId,
|
||||
Config = {
|
||||
GetAt = (key)=>{
|
||||
return this._getPluginValue(info.short_name, key);
|
||||
return this._getPluginValue(_pkg.pluginName, key);
|
||||
},
|
||||
SetAt = (key,value)=>{
|
||||
var value=value.ToString();
|
||||
this._setPluginValue(info.short_name,key,value);
|
||||
this._setPluginValue(_pkg.pluginName,key,value);
|
||||
return value;
|
||||
},
|
||||
Directory = new SubdirFilesystem(subdir, /"Files"),
|
||||
@@ -812,11 +812,11 @@ class TYTD.Downloader {
|
||||
env.LoadFileWithDependencies(subdir, _exec);
|
||||
|
||||
_pkg.pluginObject = d.PluginInit();
|
||||
if(_pkg.pluginObject.Server != null && _pkg.pluginObject.Server != undefined)
|
||||
if(TypeIsDefined(_pkg.pluginObject.Server))
|
||||
{
|
||||
var path = /"plugin"/_pkg.pluginName;
|
||||
|
||||
this.Servers.Mount(path,_pkg.pluginObject.Server);
|
||||
this.Servers.Mount(path.ToString(),_pkg.pluginObject.Server);
|
||||
}
|
||||
|
||||
_pkg.pluginEnv = env;
|
||||
@@ -838,10 +838,10 @@ class TYTD.Downloader {
|
||||
var pkg2 = {name,version};
|
||||
func _close()
|
||||
{
|
||||
if(pkg2.pluginObject.Server != null && pkg2.pluginObject.Server != undefined)
|
||||
if(TypeIsDefined(pkg2.pluginObject.Server))
|
||||
{
|
||||
var path = /"plugin"/pkg2.pluginName;
|
||||
this.Servers.Unmount(path);
|
||||
this.Servers.Unmount(path.ToString());
|
||||
}
|
||||
|
||||
pkg2.pluginObject.Close();
|
||||
@@ -1042,7 +1042,7 @@ class TYTD.Downloader {
|
||||
}
|
||||
} catch(ex) {
|
||||
try{
|
||||
this.LOG($"Exception caught on download thread: {e}");
|
||||
this.LOG($"Exception caught on download thread: {ex}");
|
||||
}catch(ex2){}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ class TYTD.AOVideoDownload : IVideoDownload {
|
||||
var req = this.tytd.ManifestRequest(id).playerResponse;
|
||||
this.info.Title = req.videoDetails.title;
|
||||
tytd.LOG($"Downloading: {this.info.Title} with id: {id} Highest Audio");
|
||||
Console.WriteLine($"Downloading: {this.info.Title} with id: {id} Highest Audio");
|
||||
this.info.Channel = req.videoDetails.author;
|
||||
this.info.ChannelId = req.videoDetails.channelId;
|
||||
|
||||
@@ -66,6 +67,7 @@ class TYTD.AOVideoDownload : IVideoDownload {
|
||||
}
|
||||
public Start()
|
||||
{
|
||||
if(this.done) return;
|
||||
for(var i = 0; i < 5; i++)
|
||||
{
|
||||
var req = {
|
||||
|
||||
@@ -7,6 +7,7 @@ class TYTD.NoConvertVideoDownload : IVideoDownload {
|
||||
|
||||
private done=false;
|
||||
|
||||
|
||||
public NoConvertVideoDownload(id)
|
||||
{
|
||||
this.info = {
|
||||
@@ -36,6 +37,7 @@ class TYTD.NoConvertVideoDownload : IVideoDownload {
|
||||
|
||||
this.info.Title = req.videoDetails.title;
|
||||
tytd.LOG($"Downloading: {this.info.Title} with id: {id} Highest Video/Audio");
|
||||
Console.WriteLine($"Downloading: {this.info.Title} with id: {id} Highest Video/Audio");
|
||||
this.info.Channel = req.videoDetails.author;
|
||||
this.info.ChannelId = req.videoDetails.channelId;
|
||||
|
||||
@@ -220,5 +222,7 @@ class TYTD.NoConvertVideoDownload : IVideoDownload {
|
||||
}
|
||||
}
|
||||
this.progress(1.0);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@ class TYTD.SDVideoDownload : IVideoDownload {
|
||||
var req = this.tytd.ManifestRequest(id).playerResponse;
|
||||
this.info.Title = req.videoDetails.title;
|
||||
tytd.LOG($"Downloading: {this.info.Title} with id: {id} LowVideo");
|
||||
Console.WriteLine($"Downloading: {this.info.Title} with id: {id} LowVideo");
|
||||
this.info.Channel = req.videoDetails.author;
|
||||
this.info.ChannelId = req.videoDetails.channelId;
|
||||
|
||||
@@ -48,6 +49,7 @@ class TYTD.SDVideoDownload : IVideoDownload {
|
||||
}
|
||||
public Start()
|
||||
{
|
||||
if(this.done) return;
|
||||
for(var i = 0; i < 5; i++)
|
||||
{
|
||||
var req = {
|
||||
|
||||
@@ -3,6 +3,7 @@ class TYTD.TranscodeAudio : IVideoDownload {
|
||||
private ncv;
|
||||
private tytd;
|
||||
private ext;
|
||||
private done;
|
||||
|
||||
public TranscodeAudio(id,ext)
|
||||
{
|
||||
@@ -30,7 +31,7 @@ class TYTD.TranscodeAudio : IVideoDownload {
|
||||
public Start()
|
||||
{
|
||||
var id = this.id;
|
||||
this.ncv.Start();
|
||||
this.mcv.Start();
|
||||
|
||||
var p = new Process();
|
||||
p.FileName = Env.GetRealExecutablePath("ffmpeg").ToString();
|
||||
|
||||
@@ -30,7 +30,7 @@ class TYTD.TranscodeVideo : IVideoDownload {
|
||||
public Start()
|
||||
{
|
||||
var id = this.id;
|
||||
this.ncv.Start();
|
||||
this.mcv.Start();
|
||||
|
||||
var p = new Process();
|
||||
p.FileName = Env.GetRealExecutablePath("ffmpeg").ToString();
|
||||
|
||||
@@ -30,6 +30,8 @@ class TYTD.VOVideoDownload : IVideoDownload {
|
||||
this.info.Channel = req.videoDetails.author;
|
||||
this.info.ChannelId = req.videoDetails.channelId;
|
||||
tytd.LOG($"Downloading: {this.info.Title} with id: {id} Highest Video");
|
||||
Console.WriteLine($"Downloading: {this.info.Title} with id: {id} Highest Video");
|
||||
|
||||
this.tytd.PutVideoInfo(req.videoDetails);
|
||||
|
||||
var width = 0;
|
||||
@@ -63,6 +65,7 @@ class TYTD.VOVideoDownload : IVideoDownload {
|
||||
}
|
||||
public Start()
|
||||
{
|
||||
if(this.done) return;
|
||||
var req = {
|
||||
FollowRedirects = true,
|
||||
RequestHeaders = [
|
||||
|
||||
Reference in New Issue
Block a user