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
#Region "IComparable Support"
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
Friend Overridable Function CompareTo(ByVal Obj As Object) As Integer Implements IComparable.CompareTo
If Not Obj Is Nothing AndAlso TypeOf Obj Is UserDataBase Then

View File

@@ -180,6 +180,7 @@ Namespace API.ThisVid
#Region "Initializer"
Friend Sub New()
UseClientTokens = True
PagePosts = New List(Of String)
End Sub
#End Region
#Region "Validation"
@@ -223,8 +224,10 @@ Namespace API.ThisVid
End Function
#End Region
#Region "Download functions"
Private ReadOnly PagePosts As List(Of String)
Private AddedCount As Integer = 0
Protected Overrides Sub DownloadDataF(ByVal Token As CancellationToken)
PagePosts.Clear()
AddedCount = 0
Responser.Cookies.ChangedAllowInternalDrop = False
Responser.Cookies.Changed = False
@@ -299,11 +302,16 @@ Namespace API.ThisVid
_TempMediaList.Add(New UserMedia(u) With {.Type = UserMedia.Types.VideoPre, .SpecialFolder = __SpecialFolder})
AddedCount += 1
If limit > 0 And AddedCount >= limit Then Exit Sub
ElseIf PagePosts.Count > 0 AndAlso PagePosts.Contains(u) Then
Continue For
Else
Exit Sub
End If
End If
Next
PagePosts.Clear()
PagePosts.AddRange(l)
l.Clear()
End If
End If
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
End If
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 Class
End Namespace

View File

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