Compare commits

...

24 Commits

Author SHA1 Message Date
1eccb71437 Fix svg 2025-12-28 17:43:15 -06:00
269b654c2e Fix svg 2025-12-28 16:34:52 -06:00
8126b2a616 Upgrade beer.css 2025-12-28 16:29:40 -06:00
22086d488f Upgrade beer.css 2025-12-28 16:25:11 -06:00
7d6c783f26 Upgrade beer.css 2025-12-28 16:23:10 -06:00
8560529475 Fix loading indicator 2025-12-28 16:15:08 -06:00
dec21a7c5d Fix downloader bug, use plink and add icon to plugin template 2025-12-28 15:58:09 -06:00
0708b3b0cf Fix downloader bug, use plink and add icon to plugin template 2025-12-28 15:56:24 -06:00
c64f2cca88 Fix downloader bug, use plink and add icon to plugin template 2025-12-28 15:54:58 -06:00
e614f4841f Fix downloader bug, use plink and add icon to plugin template 2025-12-28 15:44:53 -06:00
9abff478b8 Fix downloader bug, use plink and add icon to plugin template 2025-12-28 15:44:36 -06:00
31b179c8a3 Fix downloader bug, use plink and add icon to plugin template 2025-12-28 15:39:08 -06:00
8e3aa313ff Fix downloader bug, use plink and add icon to plugin template 2025-12-28 15:35:51 -06:00
e1b7216c69 Fix downloader bug, use plink and add icon to plugin template 2025-12-28 15:33:28 -06:00
67de5e2d6d Fix downloader bug, use plink and add icon to plugin template 2025-12-28 15:28:18 -06:00
95a3585648 Fix downloader bug, use plink and add icon to plugin template 2025-12-28 15:25:34 -06:00
148106f191 Fix downloader bug, use plink and add icon to plugin template 2025-12-28 15:25:29 -06:00
5106c5dc6b Fix downloader bug, use plink and add icon to plugin template 2025-12-28 15:23:12 -06:00
d3d04bb971 Fix downloader bug, use plink and add icon to plugin template 2025-12-28 14:27:33 -06:00
478451034f Fix downloader bug, use plink and add icon to plugin template 2025-12-28 14:25:16 -06:00
1ab1c11582 Fix downloader bug, use plink and add icon to plugin template 2025-12-28 14:21:18 -06:00
43f6d4ac33 Fix downloader bug, use plink and add icon to plugin template 2025-12-28 14:20:10 -06:00
d64052920e Fix downloader bug, use plink and add icon to plugin template 2025-12-28 13:42:07 -06:00
2eff24d67b Fix downloader bug, use plink and add icon to plugin template 2025-12-28 13:28:50 -06:00
30 changed files with 2254 additions and 106 deletions

View File

@@ -1,2 +1,2 @@
bin bin
obj obj

View File

@@ -24,8 +24,10 @@
}, },
"template_project_dependencies": [ "template_project_dependencies": [
], ],
"type": "template" "type": "template",
"template_icon": "icon.png"
}, },
"name": "Tesses.YouTubeDownloader.PluginTemplate", "name": "Tesses.YouTubeDownloader.PluginTemplate",
"version": "1.0.0.0-prod" "version": "1.0.0.0-prod",
"icon": "icon.png"
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -2,7 +2,7 @@ class PluginServer
{ {
public Handle(ctx) 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; return true;
} }
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,78 +1,86 @@
:root, :root,
body.light { body.light {
--primary:#c00100; --primary:#bc004b;
--on-primary:#ffffff; --on-primary:#ffffff;
--primary-container:#ffdad4; --primary-container:#ffd9de;
--on-primary-container:#410000; --on-primary-container:#400014;
--secondary:#775651; --secondary:#75565b;
--on-secondary:#ffffff; --on-secondary:#ffffff;
--secondary-container:#ffdad4; --secondary-container:#ffd9de;
--on-secondary-container:#2c1512; --on-secondary-container:#2c1519;
--tertiary:#705c2e; --tertiary:#795831;
--on-tertiary:#ffffff; --on-tertiary:#ffffff;
--tertiary-container:#fbdfa6; --tertiary-container:#ffddba;
--on-tertiary-container:#251a00; --on-tertiary-container:#2b1700;
--error:#ba1a1a; --error:#ba1a1a;
--on-error:#ffffff; --on-error:#ffffff;
--error-container:#ffdad6; --error-container:#ffdad6;
--on-error-container:#410002; --on-error-container:#410002;
--background:#fffbff; --background:#fffbff;
--on-background:#201a19; --on-background:#201a1b;
--surface:#fff8f6; --surface:#fff8f7;
--on-surface:#201a19; --on-surface:#201a1b;
--surface-variant:#f5ddda; --surface-variant:#f3dddf;
--on-surface-variant:#534341; --on-surface-variant:#524345;
--outline:#857370; --outline:#847375;
--outline-variant:#d8c2be; --outline-variant:#d6c2c3;
--shadow:#000000; --shadow:#000000;
--scrim:#000000; --scrim:#000000;
--inverse-surface:#362f2e; --inverse-surface:#362f2f;
--inverse-on-surface:#fbeeec; --inverse-on-surface:#fbeeee;
--inverse-primary:#ffb4a8; --inverse-primary:#ffb2be;
--surface-dim:#e4d7d5; --surface-dim:#e3d7d8;
--surface-bright:#fff8f6; --surface-bright:#fff8f7;
--surface-container-lowest:#ffffff; --surface-container-lowest:#ffffff;
--surface-container-low:#fef1ee; --surface-container-low:#fdf1f1;
--surface-container:#f8ebe9; --surface-container:#f8ebeb;
--surface-container-high:#f3e5e3; --surface-container-high:#f2e5e6;
--surface-container-highest:#ede0dd; --surface-container-highest:#ece0e0;
} }
body.dark { body.dark {
--primary:#ffb4a8; --primary:#ffb2be;
--on-primary:#690100; --on-primary:#660025;
--primary-container:#930100; --primary-container:#900038;
--on-primary-container:#ffdad4; --on-primary-container:#ffd9de;
--secondary:#e7bdb6; --secondary:#e5bdc2;
--on-secondary:#442925; --on-secondary:#43292d;
--secondary-container:#5d3f3b; --secondary-container:#5c3f43;
--on-secondary-container:#ffdad4; --on-secondary-container:#ffd9de;
--tertiary:#dec48c; --tertiary:#ebbf90;
--on-tertiary:#3e2e04; --on-tertiary:#452b08;
--tertiary-container:#564419; --tertiary-container:#5f411c;
--on-tertiary-container:#fbdfa6; --on-tertiary-container:#ffddba;
--error:#ffb4ab; --error:#ffb4ab;
--on-error:#690005; --on-error:#690005;
--error-container:#93000a; --error-container:#93000a;
--on-error-container:#ffb4ab; --on-error-container:#ffb4ab;
--background:#201a19; --background:#201a1b;
--on-background:#ede0dd; --on-background:#ece0e0;
--surface:#181211; --surface:#181213;
--on-surface:#ede0dd; --on-surface:#ece0e0;
--surface-variant:#534341; --surface-variant:#524345;
--on-surface-variant:#d8c2be; --on-surface-variant:#d6c2c3;
--outline:#a08c89; --outline:#9f8c8e;
--outline-variant:#534341; --outline-variant:#524345;
--shadow:#000000; --shadow:#000000;
--scrim:#000000; --scrim:#000000;
--inverse-surface:#ede0dd; --inverse-surface:#ece0e0;
--inverse-on-surface:#362f2e; --inverse-on-surface:#362f2f;
--inverse-primary:#c00100; --inverse-primary:#bc004b;
--surface-dim:#181211; --surface-dim:#181213;
--surface-bright:#3f3736; --surface-bright:#3f3738;
--surface-container-lowest:#120d0c; --surface-container-lowest:#120d0d;
--surface-container-low:#201a19; --surface-container-low:#201a1b;
--surface-container:#251e1d; --surface-container:#241e1f;
--surface-container-high:#2f2827; --surface-container-high:#2f2829;
--surface-container-highest:#3b3332; --surface-container-highest:#3a3334;
}
.loading-indicator
{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View 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

View File

@@ -24,7 +24,6 @@ func Components.AddVideo(id)
<button name="action" value="add"><i>add</i></button> <button name="action" value="add"><i>add</i></button>
<button name="action" value="download"><i>download</i></button> <button name="action" value="download"><i>download</i></button>
<button name="action" value="play"><i>play_arrow</i></button>
</div> </div>
</form>; </form>;
} }

View File

@@ -27,7 +27,6 @@ func Components.Add()
<button name="action" value="add"><i>add</i></button> <button name="action" value="add"><i>add</i></button>
<button name="action" value="info"><i>info</i></button> <button name="action" value="info"><i>info</i></button>
<button name="action" value="download"><i>download</i></button> <button name="action" value="download"><i>download</i></button>
<button name="action" value="play"><i>play_arrow</i></button>
</div> </div>
</form>; </form>;
} }

View File

@@ -11,7 +11,7 @@ func Components.DiscoverEntry(item)
<div class="max"> <div class="max">
<div class="col"> <div class="col">
<div class="min"> <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>
<div class="min"> <div class="min">
<span>{item.views} • {item.uploaded}</span> <span>{item.views} • {item.uploaded}</span>

View File

@@ -8,7 +8,7 @@ func Components.DownloadedVideo(item)
<div class="max"> <div class="max">
<div class="col"> <div class="col">
<div class="min"> <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>
<div class="min"> <div class="min">
<span>{item.viewCountStr} (when downloaded)</span> <span>{item.viewCountStr} (when downloaded)</span>
@@ -34,7 +34,7 @@ func Components.DownloadedPlaylist(item)
<div class="max"> <div class="max">
<div class="col"> <div class="col">
<div class="min"> <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>
<div class="min"> <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> <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>

View File

@@ -2,16 +2,6 @@ func Components.PersonalListDescription(tytd,name,editing)
{ {
var description = tytd.GetPersonalListDescription(name); var description = tytd.GetPersonalListDescription(name);
var first=true; 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> <return>
<if(editing)> <if(editing)>
<true> <true>
@@ -32,7 +22,7 @@ func Components.PersonalListDescription(tytd,name,editing)
<false> <false>
<div class="row" id="description"> <div class="row" id="description">
<div class="max"> <div class="max">
<p><raw(description_with_br)></p> <plink(description)>
</div> </div>
<div class="min"> <div class="min">
<button hx-get={$"./edit-personal-description?name={Net.Http.UrlEncode(name)}"} hx-target="#description" hx-swap="outerHTML"><i>edit</i></button> <button hx-get={$"./edit-personal-description?name={Net.Http.UrlEncode(name)}"} hx-target="#description" hx-swap="outerHTML"><i>edit</i></button>

View File

@@ -9,7 +9,7 @@ func Components.InstalledPlugin(item)
<div class="max"> <div class="max">
<div class="col"> <div class="col">
<div class="min"> <div class="min">
<if(item.pluginObject.Server != undefined && item.pluginObject.Server != null)> <if(TypeIsDefined(item.pluginObject.Server))>
<true> <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> <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> </true>

View File

@@ -4,9 +4,9 @@ func Components.Progress(tytd)
var vid = tytd.CurrentVideo; var vid = tytd.CurrentVideo;
var html = <div hx-trigger="every 1500ms" hx-indicator="none" hx-get="./progress" hx-swap="outerHTML"> var html = <div hx-trigger="every 1500ms" hx-indicator="none" hx-get="./progress" hx-swap="outerHTML">
<h2>{vid.Title}</h2> <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>{vid.Channel}</h4> <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 value={tytd.CurrentVideoProgress * 100.0} max="100" min="0"></progress> <progress class="wavy light-green-text" value={tytd.CurrentVideoProgress * 100.0} max="100" min="0"></progress>
</div>; </div>;
progress++; progress++;
return html; return html;

View File

@@ -62,12 +62,13 @@ func Components.Shell(title, html, page, $mypage)
</nav> </nav>
<main class="responsive"> <main class="responsive">
<div class="htmx-indicator shape loading-indicator extra" id="loading-indicator">
<img class="responsive" src="./tytd.svg">
</div>
<raw(html)> <raw(html)>
</main> </main>
<div class="htmx-indicator shape loading-indicator extra" id="loading-indicator">
<img class="responsive" src="./tytd.svg">
</div>
</body> </body>
</html>; </html>;

View File

@@ -9,7 +9,10 @@ var TYTDResources = [
{path="/favicon.ico",value=embed("favicon.ico")}, {path="/favicon.ico",value=embed("favicon.ico")},
{path="/tytd.svg",value=embed("tytd.svg")}, {path="/tytd.svg",value=embed("tytd.svg")},
{path="/loading-indicator.svg",value=embed("loading-indicator.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; var times=1;
@@ -41,6 +44,20 @@ class TYTDApp {
ctx.WithMimeType("text/html").SendText(Pages.ApiV1()); ctx.WithMimeType("text/html").SendText(Pages.ApiV1());
return true; 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") else if(ctx.Path == "/api/v1/download")
{ {
var v = ctx.QueryParams.TryGetFirst("v"); var v = ctx.QueryParams.TryGetFirst("v");
@@ -51,14 +68,16 @@ class TYTDApp {
var path = this.TYTD.GetVideoPath(v,res); 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 info = this.TYTD.GetVideo(v);
var filename = $"{info.title}-{info.videoId}-{res}{path.GetExtension()}"; var filename = $"{info.title}-{info.videoId}-{res}{path.GetExtension()}";
var strm = this.TYTD.Storage.OpenFile(path,"rb"); var strm = this.TYTD.Storage.OpenFile(path,"rb");
ctx.WithMimeType(Net.Http.MimeType(path.ToString())).WithContentDisposition(filename,inline).SendStream(strm); ctx.WithMimeType(Net.Http.MimeType(path.ToString())).WithContentDisposition(filename,inline).SendStream(strm);
strm.Close(); strm.Close();
return true;
} }
return false;
} }
else if(ctx.Path == "/api/v1/progress.json") else if(ctx.Path == "/api/v1/progress.json")
{ {
@@ -308,7 +327,7 @@ class TYTDApp {
ctx.WithMimeType("text/html").SendText(Pages.Settings(this.TYTD,ctx)); ctx.WithMimeType("text/html").SendText(Pages.Settings(this.TYTD,ctx));
return true; 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)); ctx.WithMimeType("text/html").SendText(Pages.VideoInfo(this.TYTD,ctx));
return true; return true;

View 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)}&amp;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;
}

View File

@@ -1,6 +1,6 @@
func Pages.PlaylistInfo(tytd,ctx) 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"); var page = ctx.QueryParams.TryGetFirstInt("page");
if(TypeOf(page) != "Long") page = 1; if(TypeOf(page) != "Long") page = 1;
page--; page--;
@@ -27,7 +27,7 @@ func Pages.PlaylistInfo(tytd,ctx)
</each> </each>
<footer class="row center-align"> <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> </footer>
</null>; </null>;

View File

@@ -9,10 +9,11 @@ func Pages.VideoInfo(tytd,ctx)
{ {
html = <div class="col"> html = <div class="col">
<div class="min"> <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>
<div class="min"> <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>
<div class="min"> <div class="min">
<raw(Components.AddToPersonalList(tytd,vi.videoId))> <raw(Components.AddToPersonalList(tytd,vi.videoId))>
@@ -20,7 +21,7 @@ func Pages.VideoInfo(tytd,ctx)
<div class="min"> <div class="min">
<h4>{vi.title}</h4> <h4>{vi.title}</h4>
<a class="underline" href={$"./channel?id={Net.Http.UrlEncode(vi.channelId)}"}>{vi.author}</a> <a class="underline" href={$"./channel?id={Net.Http.UrlEncode(vi.channelId)}"}>{vi.author}</a>
<p>{vi.shortDescription}</p> <plink(vi.shortDescription)>
</div> </div>
</div>; </div>;

View File

@@ -167,15 +167,15 @@ class TYTD.Downloader {
if(vid != null) if(vid != null)
{ {
return $"./video?v={Net.Http.UrlEncode(vid)}"; return $"./watch?v={Net.Http.UrlEncode(vid)}";
} }
else if(pid != null) else if(pid != null)
{ {
return $"./playlist?id={Net.Http.UrlEncode(pid)}"; return $"./playlist?list={Net.Http.UrlEncode(pid)}";
} }
else if(cid != null) else if(cid != null)
{ {
return $"./playlist?id={Net.Http.UrlEncode(cid)}"; return $"./channel?id={Net.Http.UrlEncode(cid)}";
} }
return "./"; return "./";
} }
@@ -775,7 +775,7 @@ class TYTD.Downloader {
_pkg.pluginName = TypeOf(info.short_name) == "String" ? info.short_name : name; _pkg.pluginName = TypeOf(info.short_name) == "String" ? info.short_name : name;
var reso = _exec.Resources; var reso = _exec.Resources;
var ico = _exec.Icon; 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"); subdir.CreateDirectory(/"Files");
var d = { var d = {
TYTD = { TYTD = {
@@ -785,11 +785,11 @@ class TYTD.Downloader {
GetChannelId = TYTD.GetChannelId, GetChannelId = TYTD.GetChannelId,
Config = { Config = {
GetAt = (key)=>{ GetAt = (key)=>{
return this._getPluginValue(info.short_name, key); return this._getPluginValue(_pkg.pluginName, key);
}, },
SetAt = (key,value)=>{ SetAt = (key,value)=>{
var value=value.ToString(); var value=value.ToString();
this._setPluginValue(info.short_name,key,value); this._setPluginValue(_pkg.pluginName,key,value);
return value; return value;
}, },
Directory = new SubdirFilesystem(subdir, /"Files"), Directory = new SubdirFilesystem(subdir, /"Files"),
@@ -812,11 +812,11 @@ class TYTD.Downloader {
env.LoadFileWithDependencies(subdir, _exec); env.LoadFileWithDependencies(subdir, _exec);
_pkg.pluginObject = d.PluginInit(); _pkg.pluginObject = d.PluginInit();
if(_pkg.pluginObject.Server != null && _pkg.pluginObject.Server != undefined) if(TypeIsDefined(_pkg.pluginObject.Server))
{ {
var path = /"plugin"/_pkg.pluginName; var path = /"plugin"/_pkg.pluginName;
this.Servers.Mount(path,_pkg.pluginObject.Server); this.Servers.Mount(path.ToString(),_pkg.pluginObject.Server);
} }
_pkg.pluginEnv = env; _pkg.pluginEnv = env;
@@ -838,10 +838,10 @@ class TYTD.Downloader {
var pkg2 = {name,version}; var pkg2 = {name,version};
func _close() func _close()
{ {
if(pkg2.pluginObject.Server != null && pkg2.pluginObject.Server != undefined) if(TypeIsDefined(pkg2.pluginObject.Server))
{ {
var path = /"plugin"/pkg2.pluginName; var path = /"plugin"/pkg2.pluginName;
this.Servers.Unmount(path); this.Servers.Unmount(path.ToString());
} }
pkg2.pluginObject.Close(); pkg2.pluginObject.Close();
@@ -1042,7 +1042,7 @@ class TYTD.Downloader {
} }
} catch(ex) { } catch(ex) {
try{ try{
this.LOG($"Exception caught on download thread: {e}"); this.LOG($"Exception caught on download thread: {ex}");
}catch(ex2){} }catch(ex2){}
} }
} }

View File

@@ -28,6 +28,7 @@ class TYTD.AOVideoDownload : IVideoDownload {
var req = this.tytd.ManifestRequest(id).playerResponse; var req = this.tytd.ManifestRequest(id).playerResponse;
this.info.Title = req.videoDetails.title; this.info.Title = req.videoDetails.title;
tytd.LOG($"Downloading: {this.info.Title} with id: {id} Highest Audio"); 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.Channel = req.videoDetails.author;
this.info.ChannelId = req.videoDetails.channelId; this.info.ChannelId = req.videoDetails.channelId;
@@ -66,6 +67,7 @@ class TYTD.AOVideoDownload : IVideoDownload {
} }
public Start() public Start()
{ {
if(this.done) return;
for(var i = 0; i < 5; i++) for(var i = 0; i < 5; i++)
{ {
var req = { var req = {

View File

@@ -7,6 +7,7 @@ class TYTD.NoConvertVideoDownload : IVideoDownload {
private done=false; private done=false;
public NoConvertVideoDownload(id) public NoConvertVideoDownload(id)
{ {
this.info = { this.info = {
@@ -36,6 +37,7 @@ class TYTD.NoConvertVideoDownload : IVideoDownload {
this.info.Title = req.videoDetails.title; this.info.Title = req.videoDetails.title;
tytd.LOG($"Downloading: {this.info.Title} with id: {id} Highest Video/Audio"); 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.Channel = req.videoDetails.author;
this.info.ChannelId = req.videoDetails.channelId; this.info.ChannelId = req.videoDetails.channelId;
@@ -220,5 +222,7 @@ class TYTD.NoConvertVideoDownload : IVideoDownload {
} }
} }
this.progress(1.0); this.progress(1.0);
return;
} }
} }

View File

@@ -28,6 +28,7 @@ class TYTD.SDVideoDownload : IVideoDownload {
var req = this.tytd.ManifestRequest(id).playerResponse; var req = this.tytd.ManifestRequest(id).playerResponse;
this.info.Title = req.videoDetails.title; this.info.Title = req.videoDetails.title;
tytd.LOG($"Downloading: {this.info.Title} with id: {id} LowVideo"); 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.Channel = req.videoDetails.author;
this.info.ChannelId = req.videoDetails.channelId; this.info.ChannelId = req.videoDetails.channelId;
@@ -48,6 +49,7 @@ class TYTD.SDVideoDownload : IVideoDownload {
} }
public Start() public Start()
{ {
if(this.done) return;
for(var i = 0; i < 5; i++) for(var i = 0; i < 5; i++)
{ {
var req = { var req = {

View File

@@ -3,6 +3,7 @@ class TYTD.TranscodeAudio : IVideoDownload {
private ncv; private ncv;
private tytd; private tytd;
private ext; private ext;
private done;
public TranscodeAudio(id,ext) public TranscodeAudio(id,ext)
{ {
@@ -30,7 +31,7 @@ class TYTD.TranscodeAudio : IVideoDownload {
public Start() public Start()
{ {
var id = this.id; var id = this.id;
this.ncv.Start(); this.mcv.Start();
var p = new Process(); var p = new Process();
p.FileName = Env.GetRealExecutablePath("ffmpeg").ToString(); p.FileName = Env.GetRealExecutablePath("ffmpeg").ToString();

View File

@@ -30,7 +30,7 @@ class TYTD.TranscodeVideo : IVideoDownload {
public Start() public Start()
{ {
var id = this.id; var id = this.id;
this.ncv.Start(); this.mcv.Start();
var p = new Process(); var p = new Process();
p.FileName = Env.GetRealExecutablePath("ffmpeg").ToString(); p.FileName = Env.GetRealExecutablePath("ffmpeg").ToString();

View File

@@ -30,6 +30,8 @@ class TYTD.VOVideoDownload : IVideoDownload {
this.info.Channel = req.videoDetails.author; this.info.Channel = req.videoDetails.author;
this.info.ChannelId = req.videoDetails.channelId; this.info.ChannelId = req.videoDetails.channelId;
tytd.LOG($"Downloading: {this.info.Title} with id: {id} Highest Video"); 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); this.tytd.PutVideoInfo(req.videoDetails);
var width = 0; var width = 0;
@@ -63,6 +65,7 @@ class TYTD.VOVideoDownload : IVideoDownload {
} }
public Start() public Start()
{ {
if(this.done) return;
var req = { var req = {
FollowRedirects = true, FollowRedirects = true,
RequestHeaders = [ RequestHeaders = [