From 3cdc3287973473ce9ff2f2bc4a234b397945a9e4 Mon Sep 17 00:00:00 2001
From: libgenapps <33476799+libgenapps@users.noreply.github.com>
Date: Wed, 6 Mar 2019 08:49:37 +0300
Subject: [PATCH] Mirror updates
---
LibgenDesktop.Setup/AppFiles.cs | 12 ++---
LibgenDesktop.Setup/Constants.cs | 4 +-
LibgenDesktop/App.xaml.cs | 1 +
LibgenDesktop/Common/Constants.cs | 6 +--
LibgenDesktop/LibgenDesktop.csproj | 36 +++-----------
LibgenDesktop/Models/Download/DownloadItem.cs | 34 ++++++++++++-
LibgenDesktop/Models/Download/Downloader.cs | 26 +++++++++-
.../Localizators/DatabaseWindowLocalizator.cs | 2 +
.../DownloadManagerLocalizator.cs | 1 +
.../Models/Localization/Translation.cs | 2 +
LibgenDesktop/Models/MainModel.cs | 13 ++++-
LibgenDesktop/Resources/Languages/English.lng | 2 +
LibgenDesktop/Resources/Languages/Russian.lng | 2 +
.../Resources/Mirrors/libgen_io_fiction.xslt | 8 ---
.../Mirrors/libgen_io_nonfiction.xslt | 8 ---
.../Resources/Mirrors/libgen_io_scimag.xslt | 8 ---
...tion_step2.xslt => libgen_pw_fiction.xslt} | 1 -
.../Mirrors/libgen_pw_fiction_step1.xslt | 9 ----
...n_step2.xslt => libgen_pw_nonfiction.xslt} | 1 -
.../Mirrors/libgen_pw_nonfiction_step1.xslt | 9 ----
...cimag_step2.xslt => libgen_pw_scimag.xslt} | 1 -
.../Mirrors/libgen_pw_scimag_step1.xslt | 9 ----
.../Resources/Mirrors/mirrors.config | 28 +++++------
.../Windows/DatabaseWindowViewModel.cs | 15 ++++++
.../Views/Styles/DatabaseWindowStyles.xaml | 4 ++
.../Views/Windows/DatabaseWindow.xaml | 49 ++++++++++++-------
26 files changed, 154 insertions(+), 137 deletions(-)
delete mode 100644 LibgenDesktop/Resources/Mirrors/libgen_io_fiction.xslt
delete mode 100644 LibgenDesktop/Resources/Mirrors/libgen_io_nonfiction.xslt
delete mode 100644 LibgenDesktop/Resources/Mirrors/libgen_io_scimag.xslt
rename LibgenDesktop/Resources/Mirrors/{libgen_pw_nonfiction_step2.xslt => libgen_pw_fiction.xslt} (87%)
delete mode 100644 LibgenDesktop/Resources/Mirrors/libgen_pw_fiction_step1.xslt
rename LibgenDesktop/Resources/Mirrors/{libgen_pw_fiction_step2.xslt => libgen_pw_nonfiction.xslt} (85%)
delete mode 100644 LibgenDesktop/Resources/Mirrors/libgen_pw_nonfiction_step1.xslt
rename LibgenDesktop/Resources/Mirrors/{libgen_pw_scimag_step2.xslt => libgen_pw_scimag.xslt} (86%)
delete mode 100644 LibgenDesktop/Resources/Mirrors/libgen_pw_scimag_step1.xslt
diff --git a/LibgenDesktop.Setup/AppFiles.cs b/LibgenDesktop.Setup/AppFiles.cs
index d3696f0..47d0578 100644
--- a/LibgenDesktop.Setup/AppFiles.cs
+++ b/LibgenDesktop.Setup/AppFiles.cs
@@ -31,15 +31,9 @@ static AppFiles()
AddFile(@"Languages\Spanish.lng");
AddFile(@"Languages\French.lng");
AddFile(@"Mirrors\mirrors.config");
- AddFile(@"Mirrors\libgen_io_nonfiction.xslt");
- AddFile(@"Mirrors\libgen_io_fiction.xslt");
- AddFile(@"Mirrors\libgen_io_scimag.xslt");
- AddFile(@"Mirrors\libgen_pw_nonfiction_step1.xslt");
- AddFile(@"Mirrors\libgen_pw_nonfiction_step2.xslt");
- AddFile(@"Mirrors\libgen_pw_fiction_step1.xslt");
- AddFile(@"Mirrors\libgen_pw_fiction_step2.xslt");
- AddFile(@"Mirrors\libgen_pw_scimag_step1.xslt");
- AddFile(@"Mirrors\libgen_pw_scimag_step2.xslt");
+ AddFile(@"Mirrors\libgen_pw_nonfiction.xslt");
+ AddFile(@"Mirrors\libgen_pw_fiction.xslt");
+ AddFile(@"Mirrors\libgen_pw_scimag.xslt");
AddFile(@"Mirrors\bookfi_net.xslt");
AddFile(@"Mirrors\b_ok_xyz_step1.xslt");
AddFile(@"Mirrors\b_ok_xyz_step2.xslt");
diff --git a/LibgenDesktop.Setup/Constants.cs b/LibgenDesktop.Setup/Constants.cs
index 4dc5fad..183bba9 100644
--- a/LibgenDesktop.Setup/Constants.cs
+++ b/LibgenDesktop.Setup/Constants.cs
@@ -2,8 +2,8 @@
{
internal static class Constants
{
- public const string CURRENT_VERSION = "1.2.4";
- public const string TITLE_VERSION = "1.2.4";
+ public const string CURRENT_VERSION = "1.2.5";
+ public const string TITLE_VERSION = "1.2.5";
public const string PRODUCT_TITLE_FORMAT = "Libgen Desktop " + TITLE_VERSION + " ({0}-bit)";
public const string SHORTCUT_TITLE_FORMAT = "Libgen Desktop ({0}-bit)";
public const string PRODUCT_COMPANY = "Libgen Apps";
diff --git a/LibgenDesktop/App.xaml.cs b/LibgenDesktop/App.xaml.cs
index c3ce12f..b6272de 100644
--- a/LibgenDesktop/App.xaml.cs
+++ b/LibgenDesktop/App.xaml.cs
@@ -102,6 +102,7 @@ private void Close()
if (mainModel != null)
{
mainModel.Downloader.Shutdown();
+ mainModel.Dispose();
}
Shutdown();
}
diff --git a/LibgenDesktop/Common/Constants.cs b/LibgenDesktop/Common/Constants.cs
index 7bd44de..2313ebd 100644
--- a/LibgenDesktop/Common/Constants.cs
+++ b/LibgenDesktop/Common/Constants.cs
@@ -5,9 +5,9 @@ namespace LibgenDesktop.Common
internal static class Constants
{
public const string DATABASE_METADATA_APP_NAME = "LibgenDesktop";
- public const string CURRENT_VERSION = "1.2.4";
- public const string CURRENT_GITHUB_RELEASE_NAME = "1.2.4";
- public static readonly DateTime CURRENT_GITHUB_RELEASE_DATE = new DateTime(2019, 1, 27);
+ public const string CURRENT_VERSION = "1.2.5";
+ public const string CURRENT_GITHUB_RELEASE_NAME = "1.2.5";
+ public static readonly DateTime CURRENT_GITHUB_RELEASE_DATE = new DateTime(2019, 3, 6);
public const string CURRENT_DATABASE_VERSION = "1.2.1";
public const string APP_SETTINGS_FILE_NAME = "libgen.config";
diff --git a/LibgenDesktop/LibgenDesktop.csproj b/LibgenDesktop/LibgenDesktop.csproj
index 354cf22..6a0cd85 100644
--- a/LibgenDesktop/LibgenDesktop.csproj
+++ b/LibgenDesktop/LibgenDesktop.csproj
@@ -665,41 +665,17 @@
PreserveNewest
Mirrors\mirrors.config
-
+
PreserveNewest
- Mirrors\libgen_io_nonfiction.xslt
+ Mirrors\libgen_pw_nonfiction.xslt
-
+
PreserveNewest
- Mirrors\libgen_io_fiction.xslt
+ Mirrors\libgen_pw_fiction.xslt
-
+
PreserveNewest
- Mirrors\libgen_io_scimag.xslt
-
-
- PreserveNewest
- Mirrors\libgen_pw_nonfiction_step1.xslt
-
-
- PreserveNewest
- Mirrors\libgen_pw_nonfiction_step2.xslt
-
-
- PreserveNewest
- Mirrors\libgen_pw_fiction_step1.xslt
-
-
- PreserveNewest
- Mirrors\libgen_pw_fiction_step2.xslt
-
-
- PreserveNewest
- Mirrors\libgen_pw_scimag_step1.xslt
-
-
- PreserveNewest
- Mirrors\libgen_pw_scimag_step2.xslt
+ Mirrors\libgen_pw_scimag.xslt
PreserveNewest
diff --git a/LibgenDesktop/Models/Download/DownloadItem.cs b/LibgenDesktop/Models/Download/DownloadItem.cs
index 349c4ef..3def696 100644
--- a/LibgenDesktop/Models/Download/DownloadItem.cs
+++ b/LibgenDesktop/Models/Download/DownloadItem.cs
@@ -5,9 +5,10 @@
namespace LibgenDesktop.Models.Download
{
- internal class DownloadItem
+ internal class DownloadItem : IDisposable
{
private CancellationTokenSource cancellationTokenSource;
+ private bool disposed;
public DownloadItem(Guid id, string downloadPageUrl, string downloadDirectory, string fileName, string downloadTransformations, string md5Hash,
bool restartSessionOnTimeout)
@@ -31,6 +32,7 @@ public DownloadItem(Guid id, string downloadPageUrl, string downloadDirectory, s
TotalFileSize = null;
CurrentAttempt = 1;
RestartSessionOnTimeout = restartSessionOnTimeout;
+ disposed = false;
}
private DownloadItem(DownloadItem source)
@@ -51,6 +53,7 @@ private DownloadItem(DownloadItem source)
TotalFileSize = source.TotalFileSize;
CurrentAttempt = source.CurrentAttempt;
RestartSessionOnTimeout = source.RestartSessionOnTimeout;
+ disposed = false;
}
public Guid Id { get; }
@@ -74,11 +77,25 @@ private DownloadItem(DownloadItem source)
public void CancelDownload()
{
- cancellationTokenSource.Cancel();
+ if (cancellationTokenSource != null)
+ {
+ cancellationTokenSource.Cancel();
+ cancellationTokenSource.Dispose();
+ cancellationTokenSource = null;
+ }
}
public void CreateNewCancellationToken()
{
+ if (disposed)
+ {
+ throw new ObjectDisposedException(nameof(DownloadItem));
+ }
+ if (cancellationTokenSource != null)
+ {
+ cancellationTokenSource.Dispose();
+ cancellationTokenSource = null;
+ }
cancellationTokenSource = new CancellationTokenSource();
CancellationToken = cancellationTokenSource.Token;
}
@@ -87,5 +104,18 @@ public DownloadItem Clone()
{
return new DownloadItem(this);
}
+
+ public void Dispose()
+ {
+ if (!disposed)
+ {
+ if (cancellationTokenSource != null)
+ {
+ cancellationTokenSource.Dispose();
+ cancellationTokenSource = null;
+ }
+ disposed = true;
+ }
+ }
}
}
diff --git a/LibgenDesktop/Models/Download/Downloader.cs b/LibgenDesktop/Models/Download/Downloader.cs
index 8dc1ab6..7b20b4d 100644
--- a/LibgenDesktop/Models/Download/Downloader.cs
+++ b/LibgenDesktop/Models/Download/Downloader.cs
@@ -22,7 +22,7 @@
namespace LibgenDesktop.Models.Download
{
- internal partial class Downloader
+ internal class Downloader : IDisposable
{
private readonly object downloadQueueLock;
private readonly string downloadQueueFilePath;
@@ -35,6 +35,7 @@ internal partial class Downloader
private DownloadSettings downloadSettings;
private bool isInOfflineMode;
private bool isShuttingDown;
+ private bool disposed;
public Downloader()
{
@@ -50,6 +51,7 @@ public Downloader()
isShuttingDown = false;
StartEventPublisherTask();
downloadTask = StartDownloadTask();
+ disposed = false;
}
public event EventHandler DownloaderEvent;
@@ -225,6 +227,16 @@ public void Shutdown()
Logger.Debug("Downloader was shut down successfully.");
}
+ public void Dispose()
+ {
+ if (!disposed)
+ {
+ eventQueue?.Dispose();
+ downloadTaskResetEvent?.Dispose();
+ disposed = true;
+ }
+ }
+
private void ResumeDownloadTask()
{
downloadTaskResetEvent.Set();
@@ -773,7 +785,17 @@ private async Task SendDownloadRequestAsync(DownloadItem do
{
Logger.Debug($"Requesting {url}, range: {startPosition.Value} - end.");
}
- HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, url);
+ HttpRequestMessage request;
+ try
+ {
+ request = new HttpRequestMessage(HttpMethod.Get, url);
+ }
+ catch (Exception exception)
+ {
+ Logger.Exception(exception);
+ ReportError(downloadItem, localization.GetLogLineRequestError(Uri.UnescapeDataString(url)));
+ return null;
+ }
request.Headers.UserAgent.ParseAdd(USER_AGENT);
if (downloadItem.Cookies.Any())
{
diff --git a/LibgenDesktop/Models/Localization/Localizators/DatabaseWindowLocalizator.cs b/LibgenDesktop/Models/Localization/Localizators/DatabaseWindowLocalizator.cs
index a45ec23..dbdc966 100644
--- a/LibgenDesktop/Models/Localization/Localizators/DatabaseWindowLocalizator.cs
+++ b/LibgenDesktop/Models/Localization/Localizators/DatabaseWindowLocalizator.cs
@@ -9,6 +9,7 @@ public DatabaseWindowLocalizator(List prioritizedTranslationList, L
: base(prioritizedTranslationList, formatter)
{
WindowTitle = Format(translation => translation?.WindowTitle);
+ CurrentDatabase = Format(translation => translation?.CurrentDatabase);
NonFiction = Format(translation => translation?.NonFiction);
Fiction = Format(translation => translation?.Fiction);
SciMagArticles = Format(translation => translation?.SciMagArticles);
@@ -26,6 +27,7 @@ public DatabaseWindowLocalizator(List prioritizedTranslationList, L
}
public string WindowTitle { get; }
+ public string CurrentDatabase { get; }
public string NonFiction { get; }
public string Fiction { get; }
public string SciMagArticles { get; }
diff --git a/LibgenDesktop/Models/Localization/Localizators/DownloadManagerLocalizator.cs b/LibgenDesktop/Models/Localization/Localizators/DownloadManagerLocalizator.cs
index 2927151..2b13cbe 100644
--- a/LibgenDesktop/Models/Localization/Localizators/DownloadManagerLocalizator.cs
+++ b/LibgenDesktop/Models/Localization/Localizators/DownloadManagerLocalizator.cs
@@ -106,6 +106,7 @@ public string GetLogLineCannotCreateOrOpenFile(string file) =>
Format(translation => translation?.LogMessages?.CannotCreateOrOpenFile, new { file });
public string GetLogLineCannotRenamePartFile(string source, string destination) =>
Format(translation => translation?.LogMessages?.CannotRenamePartFile, new { source, destination });
+ public string GetLogLineRequestError(string url) => Format(translation => translation?.LogMessages?.LogLineRequestError, new { url });
private string Format(Func field, object templateArguments = null)
{
diff --git a/LibgenDesktop/Models/Localization/Translation.cs b/LibgenDesktop/Models/Localization/Translation.cs
index 93aa12b..f3326f2 100644
--- a/LibgenDesktop/Models/Localization/Translation.cs
+++ b/LibgenDesktop/Models/Localization/Translation.cs
@@ -575,6 +575,7 @@ internal class LibraryTranslation
internal class DatabaseTranslation
{
public string WindowTitle { get; set; }
+ public string CurrentDatabase { get; set; }
public string NonFiction { get; set; }
public string Fiction { get; set; }
public string SciMagArticles { get; set; }
@@ -624,6 +625,7 @@ internal class DownloadManagerLogMessagesTranslation
public string ServerResponseTimeout { get; set; }
public string DownloadIncompleteError { get; set; }
public string FileWriteError { get; set; }
+ public string LogLineRequestError { get; set; }
public string UnexpectedError { get; set; }
}
diff --git a/LibgenDesktop/Models/MainModel.cs b/LibgenDesktop/Models/MainModel.cs
index 4b306d0..68a90d6 100644
--- a/LibgenDesktop/Models/MainModel.cs
+++ b/LibgenDesktop/Models/MainModel.cs
@@ -26,7 +26,7 @@
namespace LibgenDesktop.Models
{
- internal class MainModel
+ internal class MainModel : IDisposable
{
internal enum DatabaseStatus
{
@@ -59,6 +59,7 @@ internal enum DownloadFileResult
private Updater updater;
private LocalDatabase localDatabase;
+ private bool disposed;
public MainModel()
{
@@ -82,6 +83,7 @@ public MainModel()
ConfigureUpdater();
Downloader = new Downloader();
ConfigureDownloader();
+ disposed = false;
}
public AppSettings AppSettings { get; }
@@ -819,6 +821,15 @@ public void ConfigureDownloader()
Downloader.Configure(Localization.CurrentLanguage, AppSettings.Network, AppSettings.Download);
}
+ public void Dispose()
+ {
+ if (!disposed)
+ {
+ Downloader?.Dispose();
+ disposed = true;
+ }
+ }
+
private Task> SearchItemsAsync(Func> searchFunction, string searchQuery,
IProgress progressHandler, CancellationToken cancellationToken)
{
diff --git a/LibgenDesktop/Resources/Languages/English.lng b/LibgenDesktop/Resources/Languages/English.lng
index 4a9a46f..c193d14 100644
--- a/LibgenDesktop/Resources/Languages/English.lng
+++ b/LibgenDesktop/Resources/Languages/English.lng
@@ -528,6 +528,7 @@
"Database":
{
"WindowTitle": "Database information",
+ "CurrentDatabase": "Current database:",
"NonFiction": "Non-fiction books",
"Fiction": "Fiction books",
"SciMagArticles": "Scientific articles",
@@ -597,6 +598,7 @@
"ServerResponseTimeout": "Server response timeout.",
"DownloadIncompleteError": "Server indicates that file download is complete, but it is not.",
"FileWriteError": "File write error.",
+ "LogLineRequestError": "Couldn't send request to {url}",
"UnexpectedError": "An unexpected error occurred."
}
},
diff --git a/LibgenDesktop/Resources/Languages/Russian.lng b/LibgenDesktop/Resources/Languages/Russian.lng
index e863d22..71abc25 100644
--- a/LibgenDesktop/Resources/Languages/Russian.lng
+++ b/LibgenDesktop/Resources/Languages/Russian.lng
@@ -528,6 +528,7 @@
"Database":
{
"WindowTitle": "Статистика базы данных",
+ "CurrentDatabase": "База данных:",
"NonFiction": "Нехудожественная литература",
"Fiction": "Художественная литература",
"SciMagArticles": "Научные статьи",
@@ -597,6 +598,7 @@
"ServerResponseTimeout": "Превышено время ожидания ответа от сервера.",
"DownloadIncompleteError": "Загрузка завершена не полностью.",
"FileWriteError": "Ошибка записи файла на диск.",
+ "LogLineRequestError": "Не удалось отправить запрос по адресу {url}",
"UnexpectedError": "Возникла непредвиденная ошибка."
}
},
diff --git a/LibgenDesktop/Resources/Mirrors/libgen_io_fiction.xslt b/LibgenDesktop/Resources/Mirrors/libgen_io_fiction.xslt
deleted file mode 100644
index d12cbb1..0000000
--- a/LibgenDesktop/Resources/Mirrors/libgen_io_fiction.xslt
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/LibgenDesktop/Resources/Mirrors/libgen_io_nonfiction.xslt b/LibgenDesktop/Resources/Mirrors/libgen_io_nonfiction.xslt
deleted file mode 100644
index e050331..0000000
--- a/LibgenDesktop/Resources/Mirrors/libgen_io_nonfiction.xslt
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/LibgenDesktop/Resources/Mirrors/libgen_io_scimag.xslt b/LibgenDesktop/Resources/Mirrors/libgen_io_scimag.xslt
deleted file mode 100644
index e15b287..0000000
--- a/LibgenDesktop/Resources/Mirrors/libgen_io_scimag.xslt
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/LibgenDesktop/Resources/Mirrors/libgen_pw_nonfiction_step2.xslt b/LibgenDesktop/Resources/Mirrors/libgen_pw_fiction.xslt
similarity index 87%
rename from LibgenDesktop/Resources/Mirrors/libgen_pw_nonfiction_step2.xslt
rename to LibgenDesktop/Resources/Mirrors/libgen_pw_fiction.xslt
index 9a7750a..eb0dc33 100644
--- a/LibgenDesktop/Resources/Mirrors/libgen_pw_nonfiction_step2.xslt
+++ b/LibgenDesktop/Resources/Mirrors/libgen_pw_fiction.xslt
@@ -2,7 +2,6 @@
- https://libgen.pw
diff --git a/LibgenDesktop/Resources/Mirrors/libgen_pw_fiction_step1.xslt b/LibgenDesktop/Resources/Mirrors/libgen_pw_fiction_step1.xslt
deleted file mode 100644
index d6f97e8..0000000
--- a/LibgenDesktop/Resources/Mirrors/libgen_pw_fiction_step1.xslt
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
- https://fiction.libgen.pw
-
-
-
-
diff --git a/LibgenDesktop/Resources/Mirrors/libgen_pw_fiction_step2.xslt b/LibgenDesktop/Resources/Mirrors/libgen_pw_nonfiction.xslt
similarity index 85%
rename from LibgenDesktop/Resources/Mirrors/libgen_pw_fiction_step2.xslt
rename to LibgenDesktop/Resources/Mirrors/libgen_pw_nonfiction.xslt
index 7f85690..eb0dc33 100644
--- a/LibgenDesktop/Resources/Mirrors/libgen_pw_fiction_step2.xslt
+++ b/LibgenDesktop/Resources/Mirrors/libgen_pw_nonfiction.xslt
@@ -2,7 +2,6 @@
- https://fiction.libgen.pw
diff --git a/LibgenDesktop/Resources/Mirrors/libgen_pw_nonfiction_step1.xslt b/LibgenDesktop/Resources/Mirrors/libgen_pw_nonfiction_step1.xslt
deleted file mode 100644
index e06edfe..0000000
--- a/LibgenDesktop/Resources/Mirrors/libgen_pw_nonfiction_step1.xslt
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
- https://libgen.pw
-
-
-
-
diff --git a/LibgenDesktop/Resources/Mirrors/libgen_pw_scimag_step2.xslt b/LibgenDesktop/Resources/Mirrors/libgen_pw_scimag.xslt
similarity index 86%
rename from LibgenDesktop/Resources/Mirrors/libgen_pw_scimag_step2.xslt
rename to LibgenDesktop/Resources/Mirrors/libgen_pw_scimag.xslt
index bba8c4f..3821e80 100644
--- a/LibgenDesktop/Resources/Mirrors/libgen_pw_scimag_step2.xslt
+++ b/LibgenDesktop/Resources/Mirrors/libgen_pw_scimag.xslt
@@ -2,7 +2,6 @@
- https://sci.libgen.pw
diff --git a/LibgenDesktop/Resources/Mirrors/libgen_pw_scimag_step1.xslt b/LibgenDesktop/Resources/Mirrors/libgen_pw_scimag_step1.xslt
deleted file mode 100644
index 50a7c1d..0000000
--- a/LibgenDesktop/Resources/Mirrors/libgen_pw_scimag_step1.xslt
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
- https://sci.libgen.pw
-
-
-
-
diff --git a/LibgenDesktop/Resources/Mirrors/mirrors.config b/LibgenDesktop/Resources/Mirrors/mirrors.config
index 317abad..fa1c511 100644
--- a/LibgenDesktop/Resources/Mirrors/mirrors.config
+++ b/LibgenDesktop/Resources/Mirrors/mirrors.config
@@ -1,32 +1,30 @@
{
"libgen.io":
{
- "NonFictionDownloadUrl": "http://libgen.io/ads.php?md5={md5}",
- "NonFictionDownloadTransformations": "libgen_io_nonfiction",
- "NonFictionCoverUrl": "http://libgen.io/covers/{cover-url}",
+ "NonFictionDownloadUrl": "http://booksdl.org/get.php?md5={md5}",
+ "NonFictionCoverUrl": "http://booksdescr.org/covers/{cover-url}",
"NonFictionSynchronizationUrl": "http://libgen.io/json.php",
- "FictionDownloadUrl": "http://libgen.io/foreignfiction/ads.php?md5={md5}",
- "FictionDownloadTransformations": "libgen_io_fiction",
+ "FictionDownloadUrl": "http://booksdl.org/foreignfiction/get.php?md5={md5}",
"FictionCoverUrl": "http://libgen.io/fictioncovers/{thousand-bucket}/{md5}.jpg",
- "SciMagDownloadUrl": "http://libgen.io/scimag/ads.php?doi={doi}",
- "SciMagDownloadTransformations": "libgen_io_scimag",
+ "SciMagDownloadUrl": "http://booksdescr.org/scimag/get.php?doi={doi}",
"RestartSessionOnTimeout": true
},
"gen.lib.rus.ec":
{
"NonFictionDownloadUrl": "http://download.library1.org/main/{thousand-bucket}/{md5:l}/",
"NonFictionCoverUrl": "http://gen.lib.rus.ec/covers/{cover-url}",
- "NonFictionSynchronizationUrl": "http://gen.lib.rus.ec/json.php"
+ "NonFictionSynchronizationUrl": "http://gen.lib.rus.ec/json.php",
+ "FictionDownloadUrl": "http://download.library1.org/fiction/{thousand-bucket}/{md5}.{ext}/",
+ "FictionCoverUrl": "http://gen.lib.rus.ec/fictioncovers/{thousand-bucket}/{md5}.jpg"
},
"libgen.pw":
{
- "NonFictionDownloadUrl": "https://libgen.pw/item/detail/id/{id}?id={id}",
- "NonFictionDownloadTransformations": "libgen_pw_nonfiction_step1,libgen_pw_nonfiction_step2",
- "NonFictionCoverUrl": "https://libgen.pw/covers/{cover-url}",
- "FictionDownloadUrl": "https://fiction.libgen.pw/item/detail/{md5}",
- "FictionDownloadTransformations": "libgen_pw_fiction_step1,libgen_pw_fiction_step2",
- "SciMagDownloadUrl": "https://sci.libgen.pw/item/detail/{md5}",
- "SciMagDownloadTransformations": "libgen_pw_scimag_step1,libgen_pw_scimag_step2",
+ "NonFictionDownloadUrl": "https://booksdescr.com/item/detail/id/{id}",
+ "NonFictionDownloadTransformations": "libgen_pw_nonfiction",
+ "FictionDownloadUrl": "https://fiction.booksdescr.com/item/detail/{md5}",
+ "FictionDownloadTransformations": "libgen_pw_fiction",
+ "SciMagDownloadUrl": "https://sci.booksdescr.com/item/detail/{md5}",
+ "SciMagDownloadTransformations": "libgen_pw_scimag",
"RestartSessionOnTimeout": false
},
"bookfi.net":
diff --git a/LibgenDesktop/ViewModels/Windows/DatabaseWindowViewModel.cs b/LibgenDesktop/ViewModels/Windows/DatabaseWindowViewModel.cs
index 207f1e6..a0facdf 100644
--- a/LibgenDesktop/ViewModels/Windows/DatabaseWindowViewModel.cs
+++ b/LibgenDesktop/ViewModels/Windows/DatabaseWindowViewModel.cs
@@ -20,6 +20,7 @@ internal class DatabaseWindowViewModel : LibgenWindowViewModel
private string fictionLastUpdate;
private string sciMagTotalArticles;
private string sciMagLastUpdate;
+ private string databaseFilePath;
public DatabaseWindowViewModel(MainModel mainModel)
: base(mainModel)
@@ -59,6 +60,19 @@ public bool AreDatabaseStatsVisible
}
}
+ public string DatabaseFilePath
+ {
+ get
+ {
+ return databaseFilePath;
+ }
+ set
+ {
+ databaseFilePath = value;
+ NotifyPropertyChanged();
+ }
+ }
+
public string NonFictionTotalBooks
{
get
@@ -155,6 +169,7 @@ private async void GetStats()
CurrentWindowContext.CloseDialog(false);
return;
}
+ DatabaseFilePath = MainModel.GetDatabaseFullPath(MainModel.AppSettings.DatabaseFileName);
NonFictionTotalBooks = formatter.ToFormattedString(databaseStats.NonFictionBookCount);
NonFictionLastUpdate = databaseStats.NonFictionLastUpdate.HasValue ?
formatter.ToFormattedDateTimeString(databaseStats.NonFictionLastUpdate.Value) : Localization.Never;
diff --git a/LibgenDesktop/Views/Styles/DatabaseWindowStyles.xaml b/LibgenDesktop/Views/Styles/DatabaseWindowStyles.xaml
index c6c7323..71a29c1 100644
--- a/LibgenDesktop/Views/Styles/DatabaseWindowStyles.xaml
+++ b/LibgenDesktop/Views/Styles/DatabaseWindowStyles.xaml
@@ -14,6 +14,10 @@
+