fixed some bugs
This commit is contained in:
parent
f94783817e
commit
b718dfd42d
18
Program.cs
18
Program.cs
|
@ -73,7 +73,7 @@ namespace TYTD
|
|||
Route.Add("/api/Redownload", (HttpAction)Redownload);
|
||||
Route.Add("/api/Redownload/{R}", (HttpAction)RedownloadRes);
|
||||
Route.Add("/api/Watch/{VideoId}", (HttpAction)Watch);
|
||||
Route.Add("/api/Info/Video/{Id}",(HttpAction)VideoInfo);
|
||||
Route.Add("/api/VideoInfo/{Id}",(HttpAction)VideoInfo);
|
||||
/* Playlist */
|
||||
Route.Add("/api/AddPlaylistOnly/{Id}", (HttpAction)AddPlaylistOnly);
|
||||
Route.Add("/api/AddPlaylist/{Id}", (HttpAction)AddPlaylist);
|
||||
|
@ -81,7 +81,7 @@ namespace TYTD
|
|||
Route.Add("/api/PersonalPlaylist/{PlaylistName}",(HttpAction)PersonalPlaylist);
|
||||
Route.Add("/api/CreatePlaylist/{Ids}/playlist.{extension}", (HttpAction)CreatePlaylist);
|
||||
Route.Add("/api/CreatePlaylistRes/{Ids}/playlist.{extension}", (HttpAction)CreatePlaylistRes);
|
||||
Route.Add("/api/Info/Playlist/{Id}", (HttpAction)PlaylistInfo);
|
||||
Route.Add("/api/PlaylistInfo/{Id}", (HttpAction)PlaylistInfo);
|
||||
Route.Add("/api/ListPlaylists.html", (HttpAction)ListPlaylists);
|
||||
/* Search */
|
||||
Route.Add("/api/SearchOnly/{text}", (HttpAction)SearchOnly);
|
||||
|
@ -102,7 +102,7 @@ namespace TYTD
|
|||
|
||||
/* Queue and Progress */
|
||||
Route.Add("/api/QueueList", (HttpAction)QueueList);
|
||||
Route.Add("/api/QueueList.html", (HttpAction)QueueListHtml);
|
||||
Route.Add("/api/QueueListPage/", (HttpAction)QueueListHtml);
|
||||
Route.Add("/api/QueueMove/{From}/{To}", (HttpAction)QueueMove);
|
||||
Route.Add("/api/QueueMove2/{To}/{Id}", (HttpAction)QueueMove2);
|
||||
Route.Add("/api/Progress", (HttpAction)VideoProgress);
|
||||
|
@ -224,7 +224,7 @@ namespace TYTD
|
|||
videos.AddEscapedHtml("Description", item.Description);
|
||||
videos.AddEscapedHtml("UploadDate", DateTime.Parse(item.UploadDate).ToShortDateString());
|
||||
|
||||
string res=ApiLoader.RenderFileOrDefault("WebSite/err/video_list/VideoInfo.html", "<!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>Information about {Title}</title></head><body><h1>Video Info for {Title}</h1><h3>Video Id: {Id}</h3><h3>Video Channel: {AuthorTitle}</h3><h3>Video Channel Id: {AuthorChannelId}</h3><h3>Likes: {Likes}, Dislikes: {Dislikes}, Views: {Views}</h3><h3>Upload Date: {UploadDate}</h3><h3>Duration: {DurationStringLong}</h3><h3>Description:</h3><p>{Description}</p></body></html>", videos);
|
||||
string res=ApiLoader.RenderFileOrDefault("WebSite/err/video_list/VideoInfo.html", "<!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>Information about {Title}</title></head><body><h1>Video Info for {Title}</h1>Playback: <a href=\"../../Storage/File/NotConverted/{Id}\">SD</a> <a href=\"../../Storage/File/Converted/{Id}\">HD</a> <a href=\"../../Storage/File/Audio/{Id}\">Audio</a><br>Download: <a href=\"../../Storage/VideoRes/1/{Id}\">SD</a> <a href=\"../../Storage/VideoRes/0/{Id}\">HD</a> <a href=\"../../Storage/VideoRes/2/{Id}\">Audio</a> <br><h3>Video Id: {Id}</h3><h3>Video Channel: {AuthorTitle}</h3><h3>Video Channel Id: {AuthorChannelId}</h3><h3>Likes: {Likes}, Dislikes: {Dislikes}, Views: {Views}</h3><h3>Upload Date: {UploadDate}</h3><h3>Duration: {DurationStringLong}</h3><h3>Description:</h3><p>{Description}</p></body></html>", videos);
|
||||
response.AsText(res);
|
||||
}
|
||||
else
|
||||
|
@ -429,7 +429,7 @@ namespace TYTD
|
|||
}
|
||||
public static void ListPlaylists(HttpListenerRequest request,HttpListenerResponse resp,Dictionary<string,string> args)
|
||||
{
|
||||
string htmlBeforeProcessed = ApiLoader.ReadAllTextOrDefault("WebSite/err/playlist_list/element.html", "<tr><td><img src=\"../File/Thumbnails/120x90/{Id}.jpg\" alt=\"\" width=\"120\" height=\"90\"></td><td><a href=\"../Info/Video/{Id}\">{Title}</a><a href=\"../Info/Channel/{AuthorChannelId}\"><h5>{AuthorTitle}</h5></a></td></tr>");
|
||||
string htmlBeforeProcessed = ApiLoader.ReadAllTextOrDefault("WebSite/err/playlist_list/element.html", "<tr><td><img src=\"../api/File/Thumbnails/120x90/{Id}.jpg\" alt=\"\" width=\"120\" height=\"90\"></td><td><a href=\"../api/PlaylistInfo/{Id}\">{Title}</a><h5>{AuthorTitle}</h5></td></tr>");
|
||||
StringBuilder builder = new StringBuilder();
|
||||
foreach (var f in Directory.EnumerateFiles("Playlist","*.json"))
|
||||
{
|
||||
|
@ -467,7 +467,7 @@ namespace TYTD
|
|||
{
|
||||
|
||||
var plitem = JsonConvert.DeserializeObject<SavedPlaylist>(File.ReadAllText(Path.Combine("Playlist", $"{id.Value.Value}.json")));
|
||||
string htmlBeforeProcessed = ApiLoader.ReadAllTextOrDefault("WebSite/err/video_list/element.html", "<tr><td><img src=\"../File/Thumbnails/120x90/{Id}.jpg\" alt=\"\" width=\"120\" height=\"90\"></td><td><a href=\"../Info/Video/{Id}\">{Title}</a><a href=\"../Info/Channel/{AuthorChannelId}\"><h5>{AuthorTitle}</h5></a></td></tr>");
|
||||
string htmlBeforeProcessed = ApiLoader.ReadAllTextOrDefault("WebSite/err/video_list/element.html", "<tr><td><img src=\"../File/Thumbnails/120x90/{Id}.jpg\" alt=\"\" width=\"120\" height=\"90\"></td><td><a href=\"../VideoInfo/{Id}\">{Title}</a><h5>{AuthorTitle}</h5></td></tr>");
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
foreach (var v in plitem.Videos)
|
||||
|
@ -537,7 +537,7 @@ namespace TYTD
|
|||
|
||||
}
|
||||
StringBuilder innerHtml = new StringBuilder();
|
||||
string htmlBeforeProcessed = ApiLoader.ReadAllTextOrDefault("WebSite/err/video_list/element.html", "<tr><td><img src=\"../File/Thumbnails/120x90/{Id}.jpg\" alt=\"\" width=\"120\" height=\"90\"></td><td><a href=\"../Info/Video/{Id}\">{Title}</a><a href=\"../Info/Channel/{AuthorChannelId}\"><h5>{AuthorTitle}</h5></a></td></tr>");
|
||||
string htmlBeforeProcessed = ApiLoader.ReadAllTextOrDefault("WebSite/err/video_list/element.html", "<tr><td><img src=\"../File/Thumbnails/120x90/{Id}.jpg\" alt=\"\" width=\"120\" height=\"90\"></td><td><a href=\"../VideoInfo/{Id}\">{Title}</a><h5>{AuthorTitle}</h5></td></tr>");
|
||||
long i=0;
|
||||
foreach (var item in Downloader.SearchFor(search))
|
||||
{
|
||||
|
@ -620,7 +620,7 @@ namespace TYTD
|
|||
public static void QueueListHtml(HttpListenerRequest req,HttpListenerResponse resp,Dictionary<string,string> args)
|
||||
{
|
||||
StringBuilder innerHtml = new StringBuilder();
|
||||
string htmlBeforeProcessed = ApiLoader.ReadAllTextOrDefault("WebSite/err/video_list/element.html", "<tr><td><img src=\"../File/Thumbnails/120x90/{Id}.jpg\" alt=\"\" width=\"120\" height=\"90\"></td><td><a href=\"../Info/Video/{Id}\">{Title}</a><a href=\"../Info/Channel/{AuthorChannelId}\"><h5>{AuthorTitle}</h5></a></td></tr>");
|
||||
string htmlBeforeProcessed = ApiLoader.ReadAllTextOrDefault("WebSite/err/video_list/element.html", "<tr><td><img src=\"../File/Thumbnails/120x90/{Id}.jpg\" alt=\"\" width=\"120\" height=\"90\"></td><td><a href=\"../VideoInfo/{Id}\">{Title}</a><h5>{AuthorTitle}</h5></td></tr>");
|
||||
long i = 0;
|
||||
foreach (var item0 in Downloader.GetQueueItems())
|
||||
{
|
||||
|
@ -906,7 +906,7 @@ namespace TYTD
|
|||
#region Other
|
||||
public static void Index(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
|
||||
{
|
||||
string r = ApiLoader.ReadAllTextOrDefault(Path.Combine(webSitePath, "index.html"), "<!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>TYTD</title></head><body><h1>TYTD</h1><form action=\"./api/endpoint\" method=\"POST\"><input type=\"text\" name=\"url\"><select name=\"resolution\"><option value=\"1\" selected>SD</option><option value=\"0\">HD</option><option value=\"2\">Audio</option></select><input type=\"submit\" value=\"Add To Downloader\"></form>Existing Videos: <form action=\"./api/SearchVideos/\" method=\"POST\"><input type=\"search\" name=\"query\"><input type=\"submit\" value=\"Search\"></form><br><a href=\"./api/Progress.html\">Get Progress</a><br><a href=\"./api/ListQueue.html\">List Queue</a><a href=\"./api/ListPlaylists.html\">List Playlists</a><br></body></html>");
|
||||
string r = ApiLoader.ReadAllTextOrDefault(Path.Combine(webSitePath, "index.html"), "<!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>TYTD</title></head><body><h1>TYTD</h1><form action=\"./api/endpoint\" method=\"POST\"><input type=\"text\" name=\"url\"><select name=\"resolution\"><option value=\"1\" selected>SD</option><option value=\"0\">HD</option><option value=\"2\">Audio</option></select><input type=\"submit\" value=\"Add To Downloader\"></form>Existing Videos: <form action=\"./api/SearchVideos/\" method=\"POST\"><input type=\"search\" name=\"query\"><input type=\"submit\" value=\"Search\"></form><br><a href=\"./api/Progress.html\">Get Progress</a><br><a href=\"./api/QueueListPage/\">List Queue</a><br><a href=\"./api/ListPlaylists.html\">List Playlists</a><br></body></html>");
|
||||
|
||||
rp.AsText( r);
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue