libgenapps / LibgenDesktop

1.82k stars 218 forks source link

Synchronisation not working #13

Closed mathiasfoster closed 4 years ago

mathiasfoster commented 4 years ago

Here's the error I get when I try to synchronise:

Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.List`1[LibgenDesktop.Models.JsonApi.JsonApiNonFictionBook]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path '', line 1, position 2.
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
   at LibgenDesktop.Models.JsonApi.JsonApiClient.<DownloadNextBatchAsync>d__6.MoveNext()

and image

How do I get this working?

libgenapps commented 4 years ago

Hmm, I cannot reproduce this issue. Are you using 1.3.5? If so, could you enable the logging (Settings - Advanced - Write diagnostic information into a file), try to run the synchronization again, and then post the *.log file from the Logs subdirectory?

mathiasfoster commented 4 years ago

The Logs subdirectory doesn't seem to be showing up: image ...on the latest version: image ...with logging enabled: image

Or am I looking in the wrong place?

libgenapps commented 4 years ago

Most applications cannot write to the Program Files directory. The logs can be found in the user's application data directory by opening the Windows Explorer and navigating to: %APPDATA%\LibgenDesktop\Logs

mathiasfoster commented 4 years ago

Ah, found:

2019-12-12 12:37:41.0970 [1] LibgenDesktop.Common.Logger.LogEnvironmentInformation DEBUG Libgen Desktop 1.3.5
2019-12-12 12:37:41.2875 [1] LibgenDesktop.Common.Logger.LogEnvironmentInformation DEBUG Release: 1.3.5
2019-12-12 12:37:41.2875 [1] LibgenDesktop.Common.Logger.LogEnvironmentInformation DEBUG OS: Windows 10 Pro (release: 1903, build: 18362)
2019-12-12 12:37:41.2875 [1] LibgenDesktop.Common.Logger.LogEnvironmentInformation DEBUG .NET Framework: 4.8 or later
2019-12-12 12:37:41.2875 [1] LibgenDesktop.Common.Logger.LogEnvironmentInformation DEBUG Is in 64-bit process: True
2019-12-12 12:37:41.2875 [1] LibgenDesktop.Common.Logger.LogEnvironmentInformation DEBUG Is in portable mode: False
2019-12-12 12:37:41.6595 [1] LibgenDesktop.Models.Database.LocalDatabase.OpenDatabase DEBUG Opening database file: C:\Users\Mathias Foster\Documents\libgen.db
2019-12-12 12:37:41.8839 [1] LibgenDesktop.Models.Database.LocalDatabase.OpenDatabase DEBUG Database file has been opened successfully.
2019-12-12 12:37:41.8988 [1] LibgenDesktop.Models.MainModel.UpdateNonFictionBookCount DEBUG Updating non-fiction book count.
2019-12-12 12:37:41.8988 [1] LibgenDesktop.Models.MainModel.UpdateNonFictionBookCount DEBUG Non-fiction book count = 2435106.
2019-12-12 12:37:41.8988 [1] LibgenDesktop.Models.MainModel.UpdateFictionBookCount DEBUG Updating fiction book count.
2019-12-12 12:37:41.8988 [1] LibgenDesktop.Models.MainModel.UpdateFictionBookCount DEBUG Fiction book count = 2185255.
2019-12-12 12:37:41.8988 [1] LibgenDesktop.Models.MainModel.UpdateSciMagArticleCount DEBUG Updating article count.
2019-12-12 12:37:41.8988 [1] LibgenDesktop.Models.MainModel.UpdateSciMagArticleCount DEBUG Article count = 0.
2019-12-12 12:37:42.0863 [1] LibgenDesktop.Models.Download.Downloader.Configure DEBUG Downloader configuration complete.
2019-12-12 12:37:42.0863 [1] LibgenDesktop.Models.Download.CoverCache..ctor DEBUG Cover cache initialization complete. Capacity = 1000 items.
2019-12-12 12:37:46.4372 [6] LibgenDesktop.Models.MainModel.<SynchronizeNonFictionAsync DEBUG Synchronization has started.
2019-12-12 12:37:46.4372 [6] LibgenDesktop.Models.MainModel.CheckAndCreateNonFictionIndexes DEBUG Retrieving the list of non-fiction table indexes.
2019-12-12 12:37:46.4372 [6] LibgenDesktop.Models.MainModel.CheckAndCreateNonFictionIndexes DEBUG Checking the index on LastModifiedDateTime column.
2019-12-12 12:37:46.4372 [6] LibgenDesktop.Models.MainModel.CheckAndCreateNonFictionIndexes DEBUG Checking the index on LibgenId column.
2019-12-12 12:37:46.4372 [6] LibgenDesktop.Models.MainModel.<SynchronizeNonFictionAsync DEBUG Loading last non-fiction book.
2019-12-12 12:37:46.4372 [6] LibgenDesktop.Models.MainModel.<SynchronizeNonFictionAsync DEBUG Last non-fiction book: Libgen ID = 2435106, last modified date/time = 6/11/2019 3:07:04 AM.
2019-12-12 12:37:47.1243 [6] LibgenDesktop.Models.MainModel.<SynchronizeNonFictionAsync DEBUG Downloading next batch from the server.
2019-12-12 12:37:47.1243 [6] LibgenDesktop.Models.JsonApi.JsonApiClient.DownloadNextBatchAsync DEBUG Sending a request to http://gen.lib.rus.ec/json.php?fields=id,title,volumeinfo,series,periodical,author,year,edition,publisher,city,pages,pagesinfile,language,topic,library,issue,identifier,issn,asin,udc,lbc,ddc,lcc,doi,googlebookid,openlibraryid,commentary,dpi,color,cleaned,orientation,paginated,scanned,bookmarked,searchable,filesize,extension,md5,generic,visible,locator,local,timeadded,timelastmodified,coverurl,tags,identifierwodash&timenewer=2019-11-06 03:07:04&idnewer=2435106&mode=newer
2019-12-12 12:37:48.2138 [12] LibgenDesktop.Models.JsonApi.JsonApiClient+<DownloadNextBatchAsync>d__6.MoveNext DEBUG Response status code: 200 OK.
2019-12-12 12:37:48.2168 [12] LibgenDesktop.Models.JsonApi.JsonApiClient+<DownloadNextBatchAsync>d__6.MoveNext DEBUG Response headers:
Connection: close
IF7-Status: blocked
Cache-Control: no-store, no-cache
Content-Length: 2
Content-Type: application/json
2019-12-12 12:37:48.2168 [12] LibgenDesktop.Models.JsonApi.JsonApiClient+<DownloadNextBatchAsync>d__6.MoveNext DEBUG Response content:
{}
2019-12-12 12:37:48.2601 [1] LibgenDesktop.ViewModels.ContainerViewModel.ShowErrorWindow ERROR Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.List`1[LibgenDesktop.Models.JsonApi.JsonApiNonFictionBook]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path '', line 1, position 2.
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
   at LibgenDesktop.Models.JsonApi.JsonApiClient.<DownloadNextBatchAsync>d__6.MoveNext()

It's looking like this could be due to our corporate proxy blocking gen.lib.rus.ec.

Maybe take this issue as a feature request to allow mirrors for syncing? Eg I can access 'libgen.li` fine, if I could switch to this mirror then synchronisation would be easy.

libgenapps commented 4 years ago

Yes, this looks like a proxy filtering issue.

Maybe take this issue as a feature request to allow mirrors for syncing?

The app does support synchronization mirrors but unfortunately, there are only two mirrors with an API available at this time and only one of these two actually works.