Skip to content

Commit

Permalink
2024.8.1.0
Browse files Browse the repository at this point in the history
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'
  • Loading branch information
AAndyProgram committed Aug 1, 2024
1 parent 0b0933b commit 26db0e3
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 6 deletions.
9 changes: 9 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -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*
Expand Down
13 changes: 11 additions & 2 deletions SCrawler/Download/Feed/DownloadFeedForm.vb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions SCrawler/Download/Feed/FeedMedia.vb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion SCrawler/Download/Feed/FeedSpecial.vb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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
Expand Down
47 changes: 46 additions & 1 deletion SCrawler/Download/TDownloader.vb
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,56 @@ 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
Friend UserInfo As UserInfo
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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions SCrawler/My Project/AssemblyInfo.vb
Original file line number Diff line number Diff line change
Expand Up @@ -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")>

0 comments on commit 26db0e3

Please sign in to comment.