Compare commits

...

8 Commits

Author SHA1 Message Date
c3ef57b8b6 Make subscriptions quicker 2025-12-28 23:32:05 -06:00
deea6b32a4 Make subscriptions quicker 2025-12-28 23:22:42 -06:00
3cc23ff97d Fix thumbnail error 2025-12-28 23:02:31 -06:00
2626242fa1 Fix thumbnail error 2025-12-28 21:22:29 -06:00
c8a59cd2e9 Fix thumbnail error 2025-12-28 20:59:29 -06:00
9c3d8ed2aa Fix thumbnail error 2025-12-28 20:56:21 -06:00
c3144e7483 Fix thumbnail error 2025-12-28 17:58:49 -06:00
1502e599bd Fix svg 2025-12-28 17:50:10 -06:00
2 changed files with 44 additions and 26 deletions

View File

@@ -80,7 +80,7 @@ body.dark {
.loading-indicator .loading-indicator
{ {
position: absolute; position: absolute;
top: 50%; top: 50vh;
left: 50%; left: 50vw;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
} }

View File

@@ -908,6 +908,7 @@ class TYTD.Downloader {
this.Mutex.Lock(); this.Mutex.Lock();
var db = this.OpenDB(); var db = this.OpenDB();
var res = Sqlite.Exec(db, "SELECT * FROM subscriptions;"); var res = Sqlite.Exec(db, "SELECT * FROM subscriptions;");
Sqlite.Close(db);
//Sqlite.Exec(db,"CREATE TABLE IF NOT EXISTS subscriptions (id INTEGER PRIMARY KEY AUTOINCREMENT, channelId TEXT UNIQUE ON CONFLICT REPLACE, bell TEXT);"); //Sqlite.Exec(db,"CREATE TABLE IF NOT EXISTS subscriptions (id INTEGER PRIMARY KEY AUTOINCREMENT, channelId TEXT UNIQUE ON CONFLICT REPLACE, bell TEXT);");
this.Mutex.Unlock(); this.Mutex.Unlock();
@@ -944,7 +945,6 @@ class TYTD.Downloader {
break; break;
case SubscriptionBell.BellHigh: case SubscriptionBell.BellHigh:
notify = true; notify = true;
break;
case SubscriptionBell.DownloadHigh: case SubscriptionBell.DownloadHigh:
downloadRes = Resolution.MKV; downloadRes = Resolution.MKV;
break; break;
@@ -952,7 +952,6 @@ class TYTD.Downloader {
if(!notify && downloadRes == Resolution.NoDownload) continue; if(!notify && downloadRes == Resolution.NoDownload) continue;
var cid = sub.channelId; var cid = sub.channelId;
var newVideos = [];
each(var batch : this.QueryPlaylistItems($"UU{cid.Substring(2)}",false)) each(var batch : this.QueryPlaylistItems($"UU{cid.Substring(2)}",false))
{ {
@@ -960,36 +959,34 @@ class TYTD.Downloader {
{ {
if(this.GetVideo(videoId) == null) if(this.GetVideo(videoId) == null)
{
newVideos.Add(videoId); newVideos.Add(videoId);
if(notify)
{
this.PutVideoInfoIfNotExists(videoId);
var res = this.GetVideo(videoId);
if(res != null)
this.Bell.Invoke(this,{
Video = res
});
}
if(downloadRes != Resolution.NoDownload)
{
this.DownloadVideo(videoId,downloadRes);
}
}
} }
} }
if(notify)
{
each(var id : newVideos)
{
this.PutVideoInfoIfNotExists(id);
var res = this.GetVideo(id);
if(res != null)
this.Bell.Invoke(this,{
Video = res
});
}
}
if(downloadRes != Resolution.NoDownload)
{
each(var id : newVideos)
{
this.DownloadVideo(id,downloadRes);
}
}
} }
} }
}catch(ex) { }catch(ex) {
try{ try{
this.LOG($"Exception caught on playlist thread: {e}"); this.LOG($"Exception caught on playlist thread: {ex}");
}catch(ex2){} }catch(ex2){}
} }
} }
@@ -1093,8 +1090,26 @@ class TYTD.Downloader {
return path; return path;
} }
else { else {
try {
var url = $"https://s.ytimg.com/vi/{id}/{res}.jpg"; var url = $"https://s.ytimg.com/vi/{id}/{res}.jpg";
Net.Http.DownloadToFile(url,this.Storage, path); const resp = Net.Http.MakeRequest(url,{FollowRedirects=true});
if(resp.StatusCode >= 200 && resp.StatusCode <= 299)
{
const strm=this.Storage.OpenFile(path,"wb");
resp.CopyToStream(strm);
strm.Close();
}
else {
const bytes = FS.ReadAllBytes(this.Storage,"/Streams/nullthumb.jpg");
FS.WriteAllBytes(this.Storage, path, bytes);
}
resp.Close(); //for other implementations
}catch(ex) {
return /"Streams"/"nullthumb.jpg";
}
return path; return path;
} }
@@ -1551,7 +1566,10 @@ class TYTD.Downloader {
this.RateLimit(); this.RateLimit();
var response = Net.Http.MakeRequest(url,requestData); var response = Net.Http.MakeRequest(url,requestData);
if(response.StatusCode != 200) throw "Not success"; if(response.StatusCode != 200) throw "Not success";
var data = Json.Decode(response.ReadAsString()); const text = response.ReadAsString();
var data = Json.Decode(text);
var cr = data.contents.twoColumnWatchNextResults.playlist.playlist; var cr = data.contents.twoColumnWatchNextResults.playlist.playlist;
if(cr == null || cr == undefined) if(cr == null || cr == undefined)
{ {