2023.10.6.0

Collections: use the collection name as a friendly name; labels are removed when creating a new collection
API.UserDataBase: update comparator
API.ThisVid: add 'PagePosts' to continue parsing when new posts are added
This commit is contained in:
Andy
2023-10-06 01:45:36 +03:00
parent fa3f39b905
commit 61903afe3f
3 changed files with 25 additions and 13 deletions

View File

@@ -2116,7 +2116,11 @@ BlockNullPicture:
#End Region #End Region
#Region "IComparable Support" #Region "IComparable Support"
Friend Overridable Function CompareTo(ByVal Other As UserDataBase) As Integer Implements IComparable(Of UserDataBase).CompareTo Friend Overridable Function CompareTo(ByVal Other As UserDataBase) As Integer Implements IComparable(Of UserDataBase).CompareTo
Return Name.CompareTo(Other.Name) If IsCollection Then
Return Name.CompareTo(Other.Name)
Else
Return FriendlyName.IfNullOrEmpty(Name).StringTrim.CompareTo(Other.FriendlyName.IfNullOrEmpty(Other.Name).StringTrim)
End If
End Function End Function
Friend Overridable Function CompareTo(ByVal Obj As Object) As Integer Implements IComparable.CompareTo Friend Overridable Function CompareTo(ByVal Obj As Object) As Integer Implements IComparable.CompareTo
If Not Obj Is Nothing AndAlso TypeOf Obj Is UserDataBase Then If Not Obj Is Nothing AndAlso TypeOf Obj Is UserDataBase Then

View File

@@ -180,6 +180,7 @@ Namespace API.ThisVid
#Region "Initializer" #Region "Initializer"
Friend Sub New() Friend Sub New()
UseClientTokens = True UseClientTokens = True
PagePosts = New List(Of String)
End Sub End Sub
#End Region #End Region
#Region "Validation" #Region "Validation"
@@ -223,8 +224,10 @@ Namespace API.ThisVid
End Function End Function
#End Region #End Region
#Region "Download functions" #Region "Download functions"
Private ReadOnly PagePosts As List(Of String)
Private AddedCount As Integer = 0 Private AddedCount As Integer = 0
Protected Overrides Sub DownloadDataF(ByVal Token As CancellationToken) Protected Overrides Sub DownloadDataF(ByVal Token As CancellationToken)
PagePosts.Clear()
AddedCount = 0 AddedCount = 0
Responser.Cookies.ChangedAllowInternalDrop = False Responser.Cookies.ChangedAllowInternalDrop = False
Responser.Cookies.Changed = False Responser.Cookies.Changed = False
@@ -299,11 +302,16 @@ Namespace API.ThisVid
_TempMediaList.Add(New UserMedia(u) With {.Type = UserMedia.Types.VideoPre, .SpecialFolder = __SpecialFolder}) _TempMediaList.Add(New UserMedia(u) With {.Type = UserMedia.Types.VideoPre, .SpecialFolder = __SpecialFolder})
AddedCount += 1 AddedCount += 1
If limit > 0 And AddedCount >= limit Then Exit Sub If limit > 0 And AddedCount >= limit Then Exit Sub
ElseIf PagePosts.Count > 0 AndAlso PagePosts.Contains(u) Then
Continue For
Else Else
Exit Sub Exit Sub
End If End If
End If End If
Next Next
PagePosts.Clear()
PagePosts.AddRange(l)
l.Clear()
End If End If
End If End If
If Not cBefore = _TempMediaList.Count And (IsUser Or Page < 1000) Then DownloadData(Page + 1, Model, Token) If Not cBefore = _TempMediaList.Count And (IsUser Or Page < 1000) Then DownloadData(Page + 1, Model, Token)
@@ -537,6 +545,12 @@ Namespace API.ThisVid
Return 0 Return 0
End If End If
End Function End Function
#End Region
#Region "IDisposable Support"
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If Not disposedValue And disposing Then PagePosts.Clear()
MyBase.Dispose(disposing)
End Sub
#End Region #End Region
End Class End Class
End Namespace End Namespace

View File

@@ -71,17 +71,9 @@ Namespace API
End Property End Property
Friend Overrides Property FriendlyName As String Friend Overrides Property FriendlyName As String
Get Get
If Count > 0 Then Return CollectionName
Return Collections(0).FriendlyName
Else
Return String.Empty
End If
End Get End Get
Set(ByVal NewName As String) Set(ByVal NewName As String)
If Count > 0 Then Collections.ForEach(Sub(c)
c.FriendlyName = NewName
c.UpdateUserInformation()
End Sub)
End Set End Set
End Property End Property
Friend Overrides Property UserExists As Boolean Friend Overrides Property UserExists As Boolean
@@ -500,12 +492,14 @@ Namespace API
With _Item With _Item
If .MoveFiles(CollectionName, CollectionPath) Then If .MoveFiles(CollectionName, CollectionPath) Then
If Not .Self.IsVirtual And DataMerging Then DirectCast(.Self, UserDataBase).MergeData() If Not .Self.IsVirtual And DataMerging Then DirectCast(.Self, UserDataBase).MergeData()
ConsolidateLabels(.Self) ConsolidateLabels(.Self)
ConsolidateScripts(.Self) ConsolidateScripts(.Self)
ConsolidateColors(.Self) ConsolidateColors(.Self)
Collections.Add(.Self)
With Collections.Last
Collections.Add(.Self)
With Collections.Last
If _CollectionName.IsEmptyString Then _CollectionName = .CollectionName If _CollectionName.IsEmptyString Then _CollectionName = .CollectionName
.Temporary = Temporary .Temporary = Temporary
.Favorite = Favorite .Favorite = Favorite
@@ -548,7 +542,7 @@ Namespace API
End Try End Try
End Sub End Sub
Private Sub ConsolidateLabels(ByVal Destination As UserDataBase) Private Sub ConsolidateLabels(ByVal Destination As UserDataBase)
UpdateLabels(If(Destination, Me), ListAddList(Nothing, Labels.ListWithRemove(SpecialLabels)), 1, True) If Count > 0 Then UpdateLabels(Destination, ListAddList(Nothing, Labels.ListWithRemove(SpecialLabels)), 0, True)
End Sub End Sub
Private Sub ConsolidateScripts(ByVal Destination As UserDataBase) Private Sub ConsolidateScripts(ByVal Destination As UserDataBase)
If Count > 0 AndAlso ScriptUse Then If Count > 0 AndAlso ScriptUse Then