2024.8.1.0

Feed: add the ability to set PostUrl for data when moving a file and/or adding to a feed
TDownloader: add 'PostUrl' property to 'UserMediaD'
This commit is contained in:
Andy
2024-08-01 20:41:51 +03:00
parent 0b0933b6f0
commit 26db0e3e24
6 changed files with 75 additions and 6 deletions

View File

@@ -1,3 +1,12 @@
# 2024.8.1.0
*2024-08-01*
- Added
- Minor improvements
- Updated
- yt-dlp up to version **2024.08.01**
# 2024.7.24.0
*2024-07-24*

View File

@@ -574,6 +574,7 @@ Namespace DownloadObjects
Dim sesFilesReplaced As Boolean = False
Dim filesReplace As New List(Of KeyValuePair(Of SFile, SFile))
Dim updateFileLocations As Boolean = Settings.FeedMoveCopyUpdateFileLocationOnMove
Dim postUrl$
Dim result As Boolean = False
If FeedMediaData Is Nothing Then
@@ -678,7 +679,11 @@ Namespace DownloadObjects
mm_data = mm.Data
mm_data.File = df
__isSavedPosts = mm.IsSavedPosts And moveOptions.ReplaceUserProfile_Profile Is Nothing
mm = New UserMediaD(mm_data, If(moveOptions.ReplaceUserProfile_Profile, mm.User), mm.Session, mm.Date) With {.IsSavedPosts = __isSavedPosts}
postUrl = mm.PostUrl(True)
mm = New UserMediaD(mm_data, If(moveOptions.ReplaceUserProfile_Profile, mm.User), mm.Session, mm.Date) With {
.IsSavedPosts = __isSavedPosts,
.PostUrl = postUrl
}
If __isSavedPosts Then mm.UserInfo = __user
Downloader.Files(indx) = mm
downloaderFilesUpdated = True
@@ -709,7 +714,11 @@ Namespace DownloadObjects
mm_data = mm.Data
mm_data.File = df
__isSavedPosts = mm.IsSavedPosts And moveOptions.ReplaceUserProfile_Profile Is Nothing
mm = New UserMediaD(mm_data, If(moveOptions.ReplaceUserProfile_Profile, mm.User), mm.Session, mm.Date) With {.IsSavedPosts = __isSavedPosts}
postUrl = mm.PostUrl(True)
mm = New UserMediaD(mm_data, If(moveOptions.ReplaceUserProfile_Profile, mm.User), mm.Session, mm.Date) With {
.IsSavedPosts = __isSavedPosts,
.PostUrl = postUrl
}
If __isSavedPosts Then mm.UserInfo = __user
sessionData(indx) = mm
sesFilesReplaced = True

View File

@@ -455,6 +455,8 @@ Namespace DownloadObjects
Dim url$ = String.Empty
If IsSubscription Then
url = Post.URL_BASE
ElseIf Not Media.PostUrl.IsEmptyString Then
url = Media.PostUrl
Else
If Not UserKey.IsEmptyString And Not Post.Post.ID.IsEmptyString Then
Dim u As IUserData

View File

@@ -195,6 +195,7 @@ Namespace DownloadObjects
#Region "Add"
Friend Overloads Function Add(ByVal Item As UserMediaD, Optional ByVal AutoSave As Boolean = True) As Boolean
If Not Items.Contains(Item) Then
Item.PostUrl = Item.PostUrl(True)
Items.Add(Item)
If AutoSave Then Save()
Return True
@@ -242,6 +243,7 @@ Namespace DownloadObjects
Dim m As UserMedia
Dim f As SFile = Nothing
Dim ff As SFile
Dim postUrl$ = String.Empty
Dim user As IUserData
Dim processRemove As Boolean
Dim userArr As New List(Of IUserData)
@@ -254,7 +256,8 @@ Namespace DownloadObjects
m = d.Data
m.File = ff
d = New UserMediaD(m, If(replaceUser, d.User), d.Session, d.Date) With {
.IsSavedPosts = If(replaceUser Is Nothing, d.IsSavedPosts, DirectCast(replaceUser, UserDataBase).IsSavedPosts)
.IsSavedPosts = If(replaceUser Is Nothing, d.IsSavedPosts, DirectCast(replaceUser, UserDataBase).IsSavedPosts),
.PostUrl = postUrl
}
Items(i) = d
ri += 1
@@ -268,6 +271,7 @@ Namespace DownloadObjects
For i = Count - 1 To 0 Step -1
If p.Invoke(Items(i)) Then
d = Items(i)
postUrl = d.PostUrl(True)
f = Nothing
ff = Nothing
processRemove = True

View File

@@ -36,6 +36,7 @@ Namespace DownloadObjects
Private Const Name_Session As String = "Session"
Private Const Name_File As String = "File"
Private Const Name_IsSavedPosts As String = "IsSavedPosts"
Private Const Name_PostUrl As String = "PostUrl"
#End Region
Friend ReadOnly User As IUserData
Friend ReadOnly Data As UserMedia
@@ -43,6 +44,48 @@ Namespace DownloadObjects
Friend ReadOnly [Date] As Date
Friend Session As Integer
Friend IsSavedPosts As Boolean
Private _PostUrl As String
Friend Property PostUrl(Optional ByVal Generate As Boolean = False) As String
Get
Try
If Not _PostUrl.IsEmptyString Then
Return _PostUrl
ElseIf Generate Then
Dim url$ = String.Empty
With UserInfo
If Not .Plugin.IfNullOrEmpty(.Site).IsEmptyString And Not .Name.IsEmptyString And Not Data.Post.ID.IsEmptyString Then
Dim u As IUserData
If IsSavedPosts Then
If Not .Plugin.IsEmptyString Then
Dim host As SettingsHostCollection = Settings(.Plugin)
If Not host Is Nothing Then
u = host.Default.GetInstance(Download.SavedPosts, UserInfo, False, False)
If Not u Is Nothing AndAlso Not u.HOST Is Nothing Then
With DirectCast(u, UserDataBase)
.IsSavedPosts = True
.HostStatic = True
End With
Try : url = u.HOST.Source.GetUserPostUrl(u, Data) : Catch : End Try
u.Dispose()
End If
End If
End If
Else
u = Settings.GetUser(UserInfo)
If Not u Is Nothing Then url = UserDataBase.GetPostUrl(u, Data)
End If
End If
End With
Return url
End If
Catch
End Try
Return String.Empty
End Get
Set(ByVal _PostUrl As String)
Me._PostUrl = _PostUrl
End Set
End Property
Friend Sub New(ByVal Data As UserMedia, ByVal User As IUserData, ByVal Session As Integer)
Me.Data = Data
Me.User = User
@@ -78,6 +121,7 @@ Namespace DownloadObjects
Data = New UserMedia(e(Name_Media), User)
[Date] = AConvert(Of Date)(e.Value(Name_Date), DateTimeDefaultProvider, Now)
Session = e.Value(Name_Session).FromXML(Of Integer)(0)
_PostUrl = e.Value(Name_PostUrl)
Dim f As SFile = e.Value(Name_File)
If f.Exists Then Data.File = f
End If
@@ -106,7 +150,8 @@ Namespace DownloadObjects
New EContainer(Name_Date, AConvert(Of String)([Date], DateTimeDefaultProvider, String.Empty)),
New EContainer(Name_Session, Session),
New EContainer(Name_File, Data.File),
New EContainer(Name_IsSavedPosts, IsSavedPosts.BoolToInteger)},
New EContainer(Name_IsSavedPosts, IsSavedPosts.BoolToInteger),
New EContainer(Name_PostUrl, _PostUrl)},
If(IsSavedPosts, UserInfo.ToEContainer, If(Not User Is Nothing, DirectCast(User, UserDataBase).User.ToEContainer, Nothing)), LAP.IgnoreICopier)
End Function
End Structure

View File

@@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2024.7.24.0")>
<Assembly: AssemblyFileVersion("2024.7.24.0")>
<Assembly: AssemblyVersion("2024.8.1.0")>
<Assembly: AssemblyFileVersion("2024.8.1.0")>
<Assembly: NeutralResourcesLanguage("en")>