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.7.24.0
*2024-07-24* *2024-07-24*

View File

@@ -574,6 +574,7 @@ Namespace DownloadObjects
Dim sesFilesReplaced As Boolean = False Dim sesFilesReplaced As Boolean = False
Dim filesReplace As New List(Of KeyValuePair(Of SFile, SFile)) Dim filesReplace As New List(Of KeyValuePair(Of SFile, SFile))
Dim updateFileLocations As Boolean = Settings.FeedMoveCopyUpdateFileLocationOnMove Dim updateFileLocations As Boolean = Settings.FeedMoveCopyUpdateFileLocationOnMove
Dim postUrl$
Dim result As Boolean = False Dim result As Boolean = False
If FeedMediaData Is Nothing Then If FeedMediaData Is Nothing Then
@@ -678,7 +679,11 @@ Namespace DownloadObjects
mm_data = mm.Data mm_data = mm.Data
mm_data.File = df mm_data.File = df
__isSavedPosts = mm.IsSavedPosts And moveOptions.ReplaceUserProfile_Profile Is Nothing __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 If __isSavedPosts Then mm.UserInfo = __user
Downloader.Files(indx) = mm Downloader.Files(indx) = mm
downloaderFilesUpdated = True downloaderFilesUpdated = True
@@ -709,7 +714,11 @@ Namespace DownloadObjects
mm_data = mm.Data mm_data = mm.Data
mm_data.File = df mm_data.File = df
__isSavedPosts = mm.IsSavedPosts And moveOptions.ReplaceUserProfile_Profile Is Nothing __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 If __isSavedPosts Then mm.UserInfo = __user
sessionData(indx) = mm sessionData(indx) = mm
sesFilesReplaced = True sesFilesReplaced = True

View File

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

View File

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

View File

@@ -36,6 +36,7 @@ Namespace DownloadObjects
Private Const Name_Session As String = "Session" Private Const Name_Session As String = "Session"
Private Const Name_File As String = "File" Private Const Name_File As String = "File"
Private Const Name_IsSavedPosts As String = "IsSavedPosts" Private Const Name_IsSavedPosts As String = "IsSavedPosts"
Private Const Name_PostUrl As String = "PostUrl"
#End Region #End Region
Friend ReadOnly User As IUserData Friend ReadOnly User As IUserData
Friend ReadOnly Data As UserMedia Friend ReadOnly Data As UserMedia
@@ -43,6 +44,48 @@ Namespace DownloadObjects
Friend ReadOnly [Date] As Date Friend ReadOnly [Date] As Date
Friend Session As Integer Friend Session As Integer
Friend IsSavedPosts As Boolean 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) Friend Sub New(ByVal Data As UserMedia, ByVal User As IUserData, ByVal Session As Integer)
Me.Data = Data Me.Data = Data
Me.User = User Me.User = User
@@ -78,6 +121,7 @@ Namespace DownloadObjects
Data = New UserMedia(e(Name_Media), User) Data = New UserMedia(e(Name_Media), User)
[Date] = AConvert(Of Date)(e.Value(Name_Date), DateTimeDefaultProvider, Now) [Date] = AConvert(Of Date)(e.Value(Name_Date), DateTimeDefaultProvider, Now)
Session = e.Value(Name_Session).FromXML(Of Integer)(0) Session = e.Value(Name_Session).FromXML(Of Integer)(0)
_PostUrl = e.Value(Name_PostUrl)
Dim f As SFile = e.Value(Name_File) Dim f As SFile = e.Value(Name_File)
If f.Exists Then Data.File = f If f.Exists Then Data.File = f
End If End If
@@ -106,7 +150,8 @@ Namespace DownloadObjects
New EContainer(Name_Date, AConvert(Of String)([Date], DateTimeDefaultProvider, String.Empty)), New EContainer(Name_Date, AConvert(Of String)([Date], DateTimeDefaultProvider, String.Empty)),
New EContainer(Name_Session, Session), New EContainer(Name_Session, Session),
New EContainer(Name_File, Data.File), 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) If(IsSavedPosts, UserInfo.ToEContainer, If(Not User Is Nothing, DirectCast(User, UserDataBase).User.ToEContainer, Nothing)), LAP.IgnoreICopier)
End Function End Function
End Structure End Structure

View File

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