diff --git a/Changelog.md b/Changelog.md index 1465688..34b9b96 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,9 @@ +# 3.0.0.4 + +- Fixed + - External plugins do not save information about downloaded files + - The user cannot be added to the collection if a special path has been specified. + # 3.0.0.3 - Added diff --git a/SCrawler.Plugin.LPSG/My Project/AssemblyInfo.vb b/SCrawler.Plugin.LPSG/My Project/AssemblyInfo.vb index e3203da..f31b7be 100644 --- a/SCrawler.Plugin.LPSG/My Project/AssemblyInfo.vb +++ b/SCrawler.Plugin.LPSG/My Project/AssemblyInfo.vb @@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices ' by using the '*' as shown below: ' - - + + diff --git a/SCrawler.Plugin.LPSG/UserData.vb b/SCrawler.Plugin.LPSG/UserData.vb index 53889ce..48cfa7b 100644 --- a/SCrawler.Plugin.LPSG/UserData.vb +++ b/SCrawler.Plugin.LPSG/UserData.vb @@ -7,6 +7,8 @@ ' This program is distributed in the hope that it will be useful, ' but WITHOUT ANY WARRANTY Imports PersonalUtilities.Functions.RegularExpressions +Imports UStates = SCrawler.Plugin.PluginUserMedia.States +Imports UTypes = SCrawler.Plugin.PluginUserMedia.Types Public Class UserData : Implements IPluginContentProvider #Region "XML names" Private Const Name_LatestPage As String = "LatestPage" @@ -65,7 +67,7 @@ Public Class UserData : Implements IPluginContentProvider With Responser : .Copy(Settings.Responser) : .Error = EDP.ThrowException : End With Dim l As List(Of String) = Nothing - Dim NextPage$ = String.Empty + Dim NextPage$ Dim r$ Dim _LPage As Func(Of String) = Function() If(LatestPage.IsEmptyString, String.Empty, $"page-{LatestPage}") @@ -90,11 +92,11 @@ Public Class UserData : Implements IPluginContentProvider f = CStr(RegexReplace(u, FileRegEx)) f.Path = DataPath.CSFilePSN f.Separator = "\" - TempMediaList.Add(New PluginUserMedia With {.ContentType = PluginUserMedia.Types.Picture, .URL = u, .File = f}) + TempMediaList.Add(New PluginUserMedia With {.ContentType = UTypes.Picture, .URL = u, .File = f}) End If Next If TempMediaList.ListExists And ExistingContentList.ListExists Then _ - TempMediaList.RemoveAll(Function(m) ExistingContentList.Exists(Function(mm) mm.URL = m.URL)) + TempMediaList.RemoveAll(Function(m) ExistingContentList.Exists(Function(mm) mm.URL = m.URL)) End If Catch oex As OperationCanceledException Catch dex As ObjectDisposedException @@ -112,15 +114,16 @@ Public Class UserData : Implements IPluginContentProvider For i% = 0 To TempMediaList.Count - 1 Thrower.ThrowAny() m = TempMediaList(i) - m.DownloadState = PluginUserMedia.States.Tried + m.DownloadState = UStates.Tried Try If Not m.URL.IsEmptyString And Not m.File.IsEmptyString Then Responser.DownloadFile(m.URL, m.File, eweb) - m.DownloadState = PluginUserMedia.States.Downloaded + m.DownloadState = UStates.Downloaded Else - m.DownloadState = PluginUserMedia.States.Skipped + m.DownloadState = UStates.Skipped End If Catch ex As Exception + m.DownloadState = UStates.Skipped End Try RaiseEvent ProgressChanged(1) TempMediaList(i) = m diff --git a/SCrawler.Plugin.XVIDEOS/M3U8.vb b/SCrawler.Plugin.XVIDEOS/M3U8.vb index 25a8ea6..1514709 100644 --- a/SCrawler.Plugin.XVIDEOS/M3U8.vb +++ b/SCrawler.Plugin.XVIDEOS/M3U8.vb @@ -41,7 +41,8 @@ Friend NotInheritable Class M3U8 Return Nothing Catch ex As Exception Logger.Add(ex, "[M3U8.Save]") - Return Nothing + ex.HelpLink = 1 + Throw ex Finally CachePath.Delete(SFO.Path, SFODelete.None, EDP.None) End Try @@ -61,8 +62,8 @@ Friend NotInheritable Class M3U8 End If Return Nothing Catch ex As Exception - Logger.Add(ex, "[M3U8.Download]") - Return Nothing + If Not ex.HelpLink = 1 Then Logger.Add(ex, "[M3U8.Download]") + Throw ex End Try End Function End Class \ No newline at end of file diff --git a/SCrawler.Plugin.XVIDEOS/My Project/AssemblyInfo.vb b/SCrawler.Plugin.XVIDEOS/My Project/AssemblyInfo.vb index b7a05a4..74f2697 100644 --- a/SCrawler.Plugin.XVIDEOS/My Project/AssemblyInfo.vb +++ b/SCrawler.Plugin.XVIDEOS/My Project/AssemblyInfo.vb @@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices ' by using the '*' as shown below: ' - - + + diff --git a/SCrawler.Plugin.XVIDEOS/UserData.vb b/SCrawler.Plugin.XVIDEOS/UserData.vb index 5f05001..82523c2 100644 --- a/SCrawler.Plugin.XVIDEOS/UserData.vb +++ b/SCrawler.Plugin.XVIDEOS/UserData.vb @@ -10,6 +10,8 @@ Imports PersonalUtilities.Functions.RegularExpressions Imports PersonalUtilities.Functions.XML Imports PersonalUtilities.Tools.WEB Imports PersonalUtilities.Tools.WebDocuments.JSON +Imports UStates = SCrawler.Plugin.PluginUserMedia.States +Imports UTypes = SCrawler.Plugin.PluginUserMedia.Types Public Class UserData : Implements IPluginContentProvider #Region "Interface declarations" Public Event ProgressChanged(Count As Integer) Implements IPluginContentProvider.ProgressChanged @@ -71,7 +73,7 @@ Public Class UserData : Implements IPluginContentProvider Thrower.ThrowAny() r = Responser.GetResponse($"https://www.xvideos.com/{user}/videos/new/{If(NextPage = 0, String.Empty, NextPage)}",, e) If Not r.IsEmptyString Then - If Not EnvirSet Then UserExists = True : UserSuspended = False + If Not EnvirSet Then UserExists = True : UserSuspended = False : EnvirSet = True j = JsonDocument.Parse(r).XmlIfNothing With j If .Contains("videos") Then @@ -165,7 +167,7 @@ Public Class UserData : Implements IPluginContentProvider End If If Not m.IsEmptyString Then Return New PluginUserMedia With { - .ContentType = PluginUserMedia.Types.m3u8, + .ContentType = UTypes.m3u8, .PostID = pID, .URL = m, .File = $"{t}.mp4", @@ -195,9 +197,14 @@ Public Class UserData : Implements IPluginContentProvider m = TempMediaList(i) f = m.File f.Path = DefPath - f = M3U8.Download(m.URL, m.SpecialFolder, Settings.FfmpegFile, f, LogProvider) - m.File = f - If Not f.IsEmptyString Then m.DownloadState = PluginUserMedia.States.Downloaded + m.DownloadState = UStates.Tried + Try + f = M3U8.Download(m.URL, m.SpecialFolder, Settings.FfmpegFile, f, LogProvider) + m.File = f + m.DownloadState = UStates.Downloaded + Catch ex As Exception + m.DownloadState = UStates.Skipped + End Try TempMediaList(i) = m RaiseEvent ProgressChanged(1) Next diff --git a/SCrawler/API/Base/UserDataBase.vb b/SCrawler/API/Base/UserDataBase.vb index 8c02fb6..22f7581 100644 --- a/SCrawler/API/Base/UserDataBase.vb +++ b/SCrawler/API/Base/UserDataBase.vb @@ -941,16 +941,13 @@ BlockNullPicture: #End Region #Region "Delete, Move, Merge" Friend Overridable Function Delete() As Integer Implements IUserData.Delete - Return DeleteF(Me) - End Function - Friend Function DeleteF(ByVal Instance As IUserData) As Integer Dim f As SFile = SFile.GetPath(MyFile.CutPath.Path) If f.Exists(SFO.Path, False) AndAlso (User.Merged OrElse f.Delete(SFO.Path, Settings.DeleteMode)) Then ImageHandler(Me, False) Settings.UsersList.Remove(User) Settings.UpdateUsersList() - Settings.Users.Remove(Instance) - Downloader.UserRemove(Instance) + Settings.Users.Remove(Me) + Downloader.UserRemove(Me) Dispose(True) Return 1 Else @@ -958,24 +955,22 @@ BlockNullPicture: End If End Function Friend Overridable Function MoveFiles(ByVal __CollectionName As String) As Boolean Implements IUserData.MoveFiles - Return MoveFilesF(Me, __CollectionName) - End Function - Friend Function MoveFilesF(ByRef Instance As IUserData, ByVal __CollectionName As String) As Boolean Dim UserBefore As UserInfo = User Dim Removed As Boolean = True Dim _TurnBack As Boolean = False Try Dim f As SFile If IncludedInCollection Then - Settings.Users.Add(Instance) + Settings.Users.Add(Me) Removed = False User.CollectionName = String.Empty User.IncludedInCollection = False Else - Settings.Users.Remove(Instance) + Settings.Users.Remove(Me) Removed = True User.CollectionName = __CollectionName User.IncludedInCollection = True + User.SpecialPath = Nothing End If _TurnBack = True User.UpdateUserFile() @@ -987,7 +982,7 @@ BlockNullPicture: "Destination directory is not empty!"}, MsgBoxStyle.Exclamation,,, {"Delete", "Cancel"}) = 1 Then MsgBoxE("Operation canceled", MsgBoxStyle.Exclamation) User = UserBefore - If Removed Then Settings.Users.Add(Instance) Else Settings.Users.Remove(Instance) + If Removed Then Settings.Users.Add(Me) Else Settings.Users.Remove(Me) _TurnBack = False Return False End If @@ -1003,7 +998,7 @@ BlockNullPicture: ErrorsDescriber.Execute(EDP.LogMessageValue, ex, "Files moving error") User = UserBefore If _TurnBack Then - If Removed Then Settings.Users.Add(Instance) Else Settings.Users.Remove(Instance) + If Removed Then Settings.Users.Add(Me) Else Settings.Users.Remove(Me) End If Return False End Try diff --git a/SCrawler/My Project/AssemblyInfo.vb b/SCrawler/My Project/AssemblyInfo.vb index 59a03bf..7aa7fe0 100644 --- a/SCrawler/My Project/AssemblyInfo.vb +++ b/SCrawler/My Project/AssemblyInfo.vb @@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices ' by using the '*' as shown below: ' - - + + diff --git a/SCrawler/PluginsEnvironment/Hosts/UserDataHost.vb b/SCrawler/PluginsEnvironment/Hosts/UserDataHost.vb index 7e14812..22a3803 100644 --- a/SCrawler/PluginsEnvironment/Hosts/UserDataHost.vb +++ b/SCrawler/PluginsEnvironment/Hosts/UserDataHost.vb @@ -6,10 +6,12 @@ ' ' This program is distributed in the hope that it will be useful, ' but WITHOUT ANY WARRANTY -Imports SCrawler.API.Base Imports PersonalUtilities.Functions.XML +Imports SCrawler.API.Base Imports System.Threading Imports System.Reflection +Imports UStates = SCrawler.Plugin.PluginUserMedia.States +Imports UTypes = SCrawler.Plugin.PluginUserMedia.Types Namespace Plugin.Hosts Friend Class UserDataHost : Inherits UserDataBase Private ReadOnly UseInternalDownloader As Boolean @@ -67,7 +69,7 @@ Namespace Plugin.Hosts If Not .Name = Name Then Name = .Name ID = .ID - UserDescription = .UserDescription + UserDescriptionUpdate(.UserDescription) UserExists = .UserExists UserSuspended = .UserSuspended End With @@ -84,7 +86,13 @@ Namespace Plugin.Hosts .TempMediaList.ListAddList(_ContentNew.Select(Function(c) c.PluginUserMedia())) .Download() _ContentNew.Clear() - If .TempMediaList.ListExists Then _ContentNew.ListAddList(.TempMediaList.Select(Function(c) New UserMedia(c))) + If .TempMediaList.ListExists Then + _ContentNew.ListAddList(.TempMediaList.Select(Function(c) New UserMedia(c))) + DownloadedPictures(False) = .TempMediaList.LongCount(Function(m) m.DownloadState = UStates.Downloaded And + (m.ContentType = UTypes.Picture Or m.ContentType = UTypes.GIF)) + DownloadedVideos(False) = .TempMediaList.LongCount(Function(m) m.DownloadState = UStates.Downloaded And + (m.ContentType = UTypes.Video Or m.ContentType = UTypes.m3u8)) + End If End With End If End Sub