From ea2fb4d8189adc82d7981b6d5cbe38da72222c5b Mon Sep 17 00:00:00 2001 From: Mario Steele Date: Thu, 24 Jul 2025 04:32:51 -0500 Subject: [PATCH] Updated Program.cs While still testing things out, remain in Console mode. Removed un-used using statements. Fixed SearchHistorySyner to properly use /searchHistory API end-point. Added print statement to see when FreeTube closes, and wait for 1.5 seconds before attempting to sync everything up. May need to increase this more, needs testing. (maybe a good 5 seconds would be enough) --- FreeTubeSyncer/Program.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/FreeTubeSyncer/Program.cs b/FreeTubeSyncer/Program.cs index 82b1176..24adb90 100644 --- a/FreeTubeSyncer/Program.cs +++ b/FreeTubeSyncer/Program.cs @@ -1,7 +1,5 @@ using Avalonia; using System; -using System.Collections; -using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Threading; @@ -40,7 +38,7 @@ class Program var historySyncer = new Syncer(dbWatcher, Path.Join(path, "history.db"), "history.db", "/history"); var playlistSyncer = new Syncer(dbWatcher, Path.Join(path, "playlists.db"), "playlists.db", "/playlist"); var profileSyncer = new Syncer(dbWatcher, Path.Join(path, "profiles.db"), "profiles.db", "/profile"); - var searchHistorySyncer = new Syncer(dbWatcher, Path.Join(path, "search-history.db"), "search-history.db", "/search"); + var searchHistorySyncer = new Syncer(dbWatcher, Path.Join(path, "search-history.db"), "search-history.db", "/searchHistory"); var settingsSyncer = new Syncer(dbWatcher, Path.Join(path, "settings.db"), "settings.db", "/settings"); Task.Run(() => CheckCanSync(historySyncer, playlistSyncer, profileSyncer, searchHistorySyncer, settingsSyncer)); @@ -56,6 +54,9 @@ class Program { Thread.Sleep(100); if (Process.GetProcessesByName("FreeTube").Length > 0) continue; + Console.WriteLine("FreeTube has closed, we're going to try and update."); + Thread.Sleep(1500); + if (historySyncer is { IsDirty: true }) historySyncer.Sync(); if (playlistSyncer is { IsDirty: true })