From 1b1226025a4ae5c227ae67f3d25c83b28ef2d3b8 Mon Sep 17 00:00:00 2001 From: Andy <88590076+AAndyProgram@users.noreply.github.com> Date: Thu, 10 Aug 2023 22:42:29 +0300 Subject: [PATCH] 2023.08.10.0 Add JFF Update groups Add advanced filter Add advanced download Disable 'ShowInTaskbar' on several forms API.Base.M3U8: add external cache support API.Base.UserDataBase: update token names Feed.FeedMedia: add clone icon UserCreatorForm: fix bug collection labels not showing MainFrame: update 'DownloadSiteFull' function UserSearchForm: move focus to textbox on form is open --- SCrawler/API/Base/M3U8Base.vb | 10 +- SCrawler/API/Base/UserDataBase.vb | 19 +- SCrawler/API/JustForFans/Declarations.vb | 33 ++ SCrawler/API/JustForFans/M3U8.vb | 227 ++++++++++++ SCrawler/API/JustForFans/SiteSettings.vb | 89 +++++ SCrawler/API/JustForFans/UserData.vb | 344 ++++++++++++++++++ .../Content/Icons/SiteIcons/JFFIcon_64.ico | Bin 0 -> 16958 bytes .../Pictures/SitePictures/JFFPic_76.png | Bin 0 -> 1287 bytes .../Download/Automation/AutoDownloader.vb | 4 +- .../AutoDownloaderEditorForm.Designer.vb | 154 ++++---- .../Automation/AutoDownloaderEditorForm.resx | 30 +- .../SchedulerEditorForm.Designer.vb | 1 + SCrawler/Download/Feed/FeedMedia.vb | 4 +- SCrawler/Download/Groups/DownloadGroup.vb | 51 ++- .../Groups/DownloadGroupCollection.vb | 2 +- SCrawler/Download/Groups/GroupDefaults.vb | 4 + SCrawler/Download/Groups/GroupEditorForm.vb | 21 +- SCrawler/Download/UserDownloadQueueForm.vb | 2 +- .../GlobalLocationsChooserForm.Designer.vb | 1 + SCrawler/Editors/LabelsForm.Designer.vb | 1 + .../Editors/SiteSelectionForm.Designer.vb | 5 +- SCrawler/Editors/UserCreatorForm.vb | 8 +- SCrawler/ListImagesLoader.vb | 31 +- SCrawler/MainFrame.Designer.vb | 25 +- SCrawler/MainFrame.vb | 39 +- SCrawler/MainMod.vb | 1 + SCrawler/My Project/AssemblyInfo.vb | 4 +- .../PluginsEnvironment/Hosts/PluginHost.vb | 3 +- SCrawler/SCrawler.vbproj | 10 + SCrawler/SettingsCLS.vb | 4 + SCrawler/SiteResources.Designer.vb | 20 + SCrawler/SiteResources.resx | 6 + SCrawler/UserSearchForm.vb | 3 + 33 files changed, 1017 insertions(+), 139 deletions(-) create mode 100644 SCrawler/API/JustForFans/Declarations.vb create mode 100644 SCrawler/API/JustForFans/M3U8.vb create mode 100644 SCrawler/API/JustForFans/SiteSettings.vb create mode 100644 SCrawler/API/JustForFans/UserData.vb create mode 100644 SCrawler/Content/Icons/SiteIcons/JFFIcon_64.ico create mode 100644 SCrawler/Content/Pictures/SitePictures/JFFPic_76.png diff --git a/SCrawler/API/Base/M3U8Base.vb b/SCrawler/API/Base/M3U8Base.vb index 00cf96f..ec393a0 100644 --- a/SCrawler/API/Base/M3U8Base.vb +++ b/SCrawler/API/Base/M3U8Base.vb @@ -34,7 +34,7 @@ Namespace API.Base End Function Friend Shared Function Download(ByVal URLs As List(Of String), ByVal DestinationFile As SFile, Optional ByVal Responser As Responser = Nothing, Optional ByVal Token As CancellationToken = Nothing, Optional ByVal Progress As MyProgress = Nothing, - Optional ByVal UsePreProgress As Boolean = True) As SFile + Optional ByVal UsePreProgress As Boolean = True, Optional ByVal ExistingCache As CacheKeeper = Nothing) As SFile Dim Cache As CacheKeeper = Nothing Using tmpPr As New PreProgress(Progress) Try @@ -42,8 +42,12 @@ Namespace API.Base Dim ConcatFile As SFile = DestinationFile If ConcatFile.Name.IsEmptyString Then ConcatFile.Name = "PlayListFile" ConcatFile.Extension = "mp4" - Cache = New CacheKeeper($"{DestinationFile.PathWithSeparator}_{TempCacheFolderName}\") - Cache.CacheDeleteError = CacheDeletionError(Cache) + If ExistingCache Is Nothing Then + Cache = New CacheKeeper($"{DestinationFile.PathWithSeparator}_{TempCacheFolderName}\") + Cache.CacheDeleteError = CacheDeletionError(Cache) + Else + Cache = ExistingCache + End If Dim cache2 As CacheKeeper = Cache.NewInstance If cache2.RootDirectory.Exists(SFO.Path) Then Dim progressExists As Boolean = Not Progress Is Nothing diff --git a/SCrawler/API/Base/UserDataBase.vb b/SCrawler/API/Base/UserDataBase.vb index 1e856da..f922590 100644 --- a/SCrawler/API/Base/UserDataBase.vb +++ b/SCrawler/API/Base/UserDataBase.vb @@ -751,7 +751,6 @@ BlockNullPicture: End Function Friend Overridable Sub ExchangeOptionsSet(ByVal Obj As Object) Implements IPluginContentProvider.ExchangeOptionsSet End Sub - Private _ExternalCompatibilityToken As CancellationToken #End Region #Region "IIndexable Support" Friend Property Index As Integer = 0 Implements IIndexable.Index @@ -1082,7 +1081,8 @@ BlockNullPicture: Return __DOWNLOAD_IN_PROGRESS End Get End Property - Friend PersonalToken As CancellationToken + Private TokenQueue As CancellationToken + Friend TokenPersonal As CancellationToken Protected Responser As Responser Protected UseResponserClient As Boolean = False Protected UseClientTokens As Boolean = False @@ -1096,7 +1096,7 @@ BlockNullPicture: Private _PictureExists As Boolean Private _EnvirInvokeUserUpdated As Boolean = False Protected Sub EnvirDownloadSet() - PersonalToken = Nothing + TokenPersonal = Nothing ProgressPre.Reset() UpdateDataFiles() _DownloadInProgress = True @@ -1128,7 +1128,7 @@ BlockNullPicture: __DOWNLOAD_IN_PROGRESS = True OnUserDownloadStateChanged(True) Dim Canceled As Boolean = False - _ExternalCompatibilityToken = Token + TokenQueue = Token Try EnvirDownloadSet() If Not Responser Is Nothing Then Responser.Dispose() @@ -1191,6 +1191,7 @@ BlockNullPicture: End Function)) Else DownloadContent(Token) + DownloadedPictures(False) += 1 ThrowIfDisposed() End If @@ -1221,7 +1222,7 @@ BlockNullPicture: End If ThrowIfDisposed() If Not _PictureExists Or _EnvirInvokeUserUpdated Then OnUserUpdated() - Catch oex As OperationCanceledException When Token.IsCancellationRequested Or PersonalToken.IsCancellationRequested + Catch oex As OperationCanceledException When Token.IsCancellationRequested Or TokenPersonal.IsCancellationRequested MyMainLOG = $"{ToStringForLog()}: downloading canceled" Canceled = True Catch exit_ex As ExitException @@ -1288,6 +1289,7 @@ BlockNullPicture: Try Data.DownloadState = UserMediaStates.Tried Progress = Data.Progress + If Not Progress Is Nothing Then Progress.ResetProgressOnMaximumChanges = False If Not Responser Is Nothing Then Responser.Dispose() Responser = New Responser If Not HOST Is Nothing AndAlso HOST.Available(ISiteSettings.Download.SingleObject, True) AndAlso @@ -1722,7 +1724,7 @@ BlockNullPicture: Optional ByVal ThrowEx As Boolean = True) As Integer If TypeOf ex Is ExitException Then Throw ex - ElseIf Not ((TypeOf ex Is OperationCanceledException And (Token.IsCancellationRequested Or PersonalToken.IsCancellationRequested)) Or + ElseIf Not ((TypeOf ex Is OperationCanceledException And (Token.IsCancellationRequested Or TokenPersonal.IsCancellationRequested Or TokenQueue.IsCancellationRequested)) Or (TypeOf ex Is ObjectDisposedException And Disposed)) Then If RDE Then Dim v% = DownloadingException(ex, Message, True, EObj) @@ -2031,13 +2033,14 @@ BlockNullPicture: End Sub ''' Private Overloads Sub ThrowAny() Implements IThrower.ThrowAny - ThrowAny(_ExternalCompatibilityToken) + ThrowAny(TokenQueue) End Sub ''' ''' Friend Overridable Overloads Sub ThrowAny(ByVal Token As CancellationToken) Token.ThrowIfCancellationRequested() - PersonalToken.ThrowIfCancellationRequested() + TokenQueue.ThrowIfCancellationRequested() + TokenPersonal.ThrowIfCancellationRequested() ThrowIfDisposed() End Sub #End Region diff --git a/SCrawler/API/JustForFans/Declarations.vb b/SCrawler/API/JustForFans/Declarations.vb new file mode 100644 index 0000000..c186879 --- /dev/null +++ b/SCrawler/API/JustForFans/Declarations.vb @@ -0,0 +1,33 @@ +' Copyright (C) 2023 Andy https://github.com/AAndyProgram +' This program is free software: you can redistribute it and/or modify +' it under the terms of the GNU General Public License as published by +' the Free Software Foundation, either version 3 of the License, or +' (at your option) any later version. +' +' This program is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY +Imports System.Text.RegularExpressions +Imports PersonalUtilities.Functions.RegularExpressions +Namespace API.JustForFans + Friend Module Declarations + Friend Const NamePhotoLarge As String = "expandable" + Friend Const NamePhotoSmall As String = "galThumb" + Private Const PostDateUrlPattern As String = "\]*?location.href='([^']+)[^\>]*?\>([^\<]+?)\<" + Friend ReadOnly RegexUser As RParams = RParams.DMS("GetStats2\(UserID\)\{\s*var Hash = '([^']+)'[;\s/]*(var Hash = '([^']+)'|)", 1) + Friend ReadOnly RegexVideoBlock As RParams = + RParams.DM("((\
]*?id=""([^""]+)[^\>]*?\>)\s*\
]*?\>[^\<\>]*?\\s*\
)", + 0, RegexReturn.List, RegexOptions.Singleline, RegexOptions.IgnoreCase, EDP.ReturnValue) + Friend ReadOnly Regex_Video As RParams = RParams.DMS("