2024.4.13.0

YT
Add subtitles to information about downloaded files

PluginProvider
IPluginContentProvider: add 'ResetHistoryData' function

SCrawler
UserDataBase: call 'UpdateUsersList' when 'UpdateUserInformation' with argument 'OnlyDiff'; implement 'ResetHistoryData' function; set 'LastUpdated' to null and 'UpdateUserInformation' when erasing history data
API.Instagram: set 'FirstLoadingDone' to false when erasing history data; fix broken saved posts downloading
API.TikTok: set 'LastDownloadDate' to null when erasing history data
API.YouTube: set last download dates to null when erasing history data
GroupUsersViewer: add the number of users, object type and object name to the form title; add 'F1' to help hint; add '(Alt+)F3' to edit user
AutoDownloaderEditorForm, SchedulerEditorForm, GroupEditorForm, GroupListForm: update to 'GroupUsersViewer'
MainFrame: make 'EditSelectedUser' friend
UserDataHost: implement 'ResetHistoryData' function
SettingsCLS: add 'OnlyDiff' to the 'UpdateUsersList' function
UserInfo: add 'ExactEquals' shared function
This commit is contained in:
Andy
2024-04-13 10:10:27 +03:00
parent 7296fda977
commit 46372ec9fb
20 changed files with 118 additions and 38 deletions

View File

@@ -1,3 +1,17 @@
# 2024.4.13.0
*2024-04-13*
- Added
- Minor improvements
- PluginProvider
- IPluginContentProvider: added `ResetHistoryData` function
- Fixed
- Sites
- TikTok: remove last download date when erasing history data
- YouTube: remove last download date when erasing history data
- Instagram: **saved posts aren't downloading**
# 2024.4.10.0 # 2024.4.10.0
*2024-04-10* *2024-04-10*

View File

@@ -40,5 +40,6 @@ Namespace Plugin
Sub GetMedia(ByVal Token As Threading.CancellationToken) Sub GetMedia(ByVal Token As Threading.CancellationToken)
Sub Download(ByVal Token As Threading.CancellationToken) Sub Download(ByVal Token As Threading.CancellationToken)
Sub DownloadSingleObject(ByVal Data As IDownloadableMedia, ByVal Token As Threading.CancellationToken) Sub DownloadSingleObject(ByVal Data As IDownloadableMedia, ByVal Token As Threading.CancellationToken)
Sub ResetHistoryData()
End Interface End Interface
End Namespace End Namespace

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.4.10.0")> <Assembly: AssemblyVersion("2024.4.13.0")>
<Assembly: AssemblyFileVersion("2024.4.10.0")> <Assembly: AssemblyFileVersion("2024.4.13.0")>
<Assembly: NeutralResourcesLanguage("en")> <Assembly: NeutralResourcesLanguage("en")>

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.4.10.0")> <Assembly: AssemblyVersion("2024.4.13.0")>
<Assembly: AssemblyFileVersion("2024.4.10.0")> <Assembly: AssemblyFileVersion("2024.4.13.0")>
<Assembly: NeutralResourcesLanguage("en")> <Assembly: NeutralResourcesLanguage("en")>

View File

@@ -1219,19 +1219,21 @@ Namespace API.YouTube.Objects
'Subtitles 'Subtitles
ThrowAny(Token) ThrowAny(Token)
If PostProcessing_OutputSubtitlesFormats.Count > 0 Then If SubtitlesSelectedIndexes.Count > 0 And Not OutputSubtitlesFormat.IsEmptyString Then
files = SFile.GetFiles(File, String.Format(fPatternFiles, OutputSubtitlesFormat.StringToLower),, EDP.ReturnValue) files = SFile.GetFiles(File, String.Format(fPatternFiles, OutputSubtitlesFormat.StringToLower),, EDP.ReturnValue)
AddFile(files)
If files.ListExists Then If files.ListExists Then
For Each f In files AddFile(files)
For Each format In PostProcessing_OutputSubtitlesFormats If PostProcessing_OutputSubtitlesFormats.Count > 0 Then
format = format.StringToLower For Each f In files
commandFile = $"{f.PathWithSeparator}{f.Name}.{format}" For Each format In PostProcessing_OutputSubtitlesFormats
AddFile(commandFile) format = format.StringToLower
ThrowAny(Token) commandFile = $"{f.PathWithSeparator}{f.Name}.{format}"
.Execute($"ffmpeg -i ""{f}"" ""{commandFile}""") AddFile(commandFile)
ThrowAny(Token)
.Execute($"ffmpeg -i ""{f}"" ""{commandFile}""")
Next
Next Next
Next End If
End If End If
End If End If

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.4.10.0")> <Assembly: AssemblyVersion("2024.4.13.0")>
<Assembly: AssemblyFileVersion("2024.4.10.0")> <Assembly: AssemblyFileVersion("2024.4.13.0")>
<Assembly: NeutralResourcesLanguage("en")> <Assembly: NeutralResourcesLanguage("en")>

View File

@@ -1001,7 +1001,7 @@ BlockNullPicture:
x.Save(MyFileSettings) x.Save(MyFileSettings)
End Using End Using
If Not IsSavedPosts Then Settings.UpdateUsersList(User) If Not IsSavedPosts Then Settings.UpdateUsersList(User, True)
Catch ex As Exception Catch ex As Exception
LogError(ex, "user information saving error") LogError(ex, "user information saving error")
End Try End Try
@@ -1894,7 +1894,9 @@ BlockNullPicture:
If m.Contains(IUserData.EraseMode.History) Then If m.Contains(IUserData.EraseMode.History) Then
If MyFilePosts.Delete(SFO.File, SFODelete.DeleteToRecycleBin, e) Then result = True If MyFilePosts.Delete(SFO.File, SFODelete.DeleteToRecycleBin, e) Then result = True
If MyFileData.Delete(SFO.File, SFODelete.DeleteToRecycleBin, e) Then result = True If MyFileData.Delete(SFO.File, SFODelete.DeleteToRecycleBin, e) Then result = True
LastUpdated = Nothing
EraseData_AdditionalDataFiles() EraseData_AdditionalDataFiles()
UpdateUserInformation()
End If End If
If m.Contains(IUserData.EraseMode.Data) Then If m.Contains(IUserData.EraseMode.Data) Then
Dim files As List(Of SFile) = SFile.GetFiles(DownloadContentDefault_GetRootDir.CSFileP,, SearchOption.AllDirectories, e) Dim files As List(Of SFile) = SFile.GetFiles(DownloadContentDefault_GetRootDir.CSFileP,, SearchOption.AllDirectories, e)
@@ -1916,7 +1918,7 @@ BlockNullPicture:
Return ErrorsDescriber.Execute(EDP.SendToLog + EDP.ReturnValue, ex, $"EraseData({CInt(Mode)}): {ToStringForLog()}", False) Return ErrorsDescriber.Execute(EDP.SendToLog + EDP.ReturnValue, ex, $"EraseData({CInt(Mode)}): {ToStringForLog()}", False)
End Try End Try
End Function End Function
Protected Overridable Sub EraseData_AdditionalDataFiles() Protected Overridable Sub EraseData_AdditionalDataFiles() Implements IPluginContentProvider.ResetHistoryData
End Sub End Sub
Friend Overridable Function Delete(Optional ByVal Multiple As Boolean = False, Optional ByVal CollectionValue As Integer = -1) As Integer Implements IUserData.Delete Friend Overridable Function Delete(Optional ByVal Multiple As Boolean = False, Optional ByVal CollectionValue As Integer = -1) As Integer Implements IUserData.Delete
Dim f As SFile = SFile.GetPath(MyFile.CutPath.Path) Dim f As SFile = SFile.GetPath(MyFile.CutPath.Path)

View File

@@ -886,8 +886,8 @@ NextPageBlock:
PostIDKV = New PostKV(.Value("code"), .Value("id"), Section) PostIDKV = New PostKV(.Value("code"), .Value("id"), Section)
PostOriginUrl = DefaultParser_PostUrlCreator(PostIDKV) PostOriginUrl = DefaultParser_PostUrlCreator(PostIDKV)
Pinned = .Contains("timeline_pinned_user_ids") Pinned = .Contains("timeline_pinned_user_ids")
If (Section = Sections.Timeline And Not DefaultParser_IgnorePass) AndAlso PostKvExists(PostIDKV) Then If Not DefaultParser_IgnorePass AndAlso PostKvExists(PostIDKV) Then
If Not Pinned Then Return False If Not Section = Sections.Timeline OrElse Not Pinned Then Return False
Else Else
_TempPostsList.Add(PostIDKV.ID) _TempPostsList.Add(PostIDKV.ID)
PostsKVIDs.ListAddValue(PostIDKV, LNC) PostsKVIDs.ListAddValue(PostIDKV, LNC)
@@ -1233,6 +1233,7 @@ NextPageBlock:
Protected Overrides Sub EraseData_AdditionalDataFiles() Protected Overrides Sub EraseData_AdditionalDataFiles()
Dim f As SFile = MyFilePostsKV Dim f As SFile = MyFilePostsKV
If f.Exists Then f.Delete(SFO.File, SFODelete.DeleteToRecycleBin, EDP.ReturnValue) If f.Exists Then f.Delete(SFO.File, SFODelete.DeleteToRecycleBin, EDP.ReturnValue)
FirstLoadingDone = False
End Sub End Sub
#End Region #End Region
#Region "Exceptions" #Region "Exceptions"

View File

@@ -359,6 +359,11 @@ Namespace API.TikTok
_TempMediaList.Add(m) _TempMediaList.Add(m)
End Sub End Sub
#End Region #End Region
#Region "EraseData"
Protected Overrides Sub EraseData_AdditionalDataFiles()
LastDownloadDate = Nothing
End Sub
#End Region
#Region "Exception" #Region "Exception"
Protected Overrides Function DownloadingException(ByVal ex As Exception, ByVal Message As String, Optional ByVal FromPE As Boolean = False, Protected Overrides Function DownloadingException(ByVal ex As Exception, ByVal Message As String, Optional ByVal FromPE As Boolean = False,
Optional ByVal EObj As Object = Nothing) As Integer Optional ByVal EObj As Object = Nothing) As Integer

View File

@@ -467,6 +467,13 @@ Namespace API.YouTube
_TempMediaList.Add(New UserMedia(Data)) _TempMediaList.Add(New UserMedia(Data))
End Sub End Sub
#End Region #End Region
#Region "EraseData"
Protected Overrides Sub EraseData_AdditionalDataFiles()
LastDownloadDateVideos = Nothing
LastDownloadDateShorts = Nothing
LastDownloadDatePlaylist = Nothing
End Sub
#End Region
#Region "DownloadingException" #Region "DownloadingException"
Protected Overrides Function DownloadingException(ByVal ex As Exception, ByVal Message As String, Optional ByVal FromPE As Boolean = False, Protected Overrides Function DownloadingException(ByVal ex As Exception, ByVal Message As String, Optional ByVal FromPE As Boolean = False,
Optional ByVal EObj As Object = Nothing) As Integer Optional ByVal EObj As Object = Nothing) As Integer

View File

@@ -100,7 +100,7 @@ Namespace DownloadObjects
users.ListAddList(DownloadGroup.GetUsers(g)) users.ListAddList(DownloadGroup.GetUsers(g))
End Using End Using
End If End If
GroupUsersViewer.Show(users) GroupUsersViewer.Show(users, $"S {DEF_GROUP.TXT_NAME.Text}")
users.Clear() users.Clear()
End If End If
Catch ex As Exception Catch ex As Exception

View File

@@ -381,7 +381,7 @@ Namespace DownloadObjects
users.ListAddList(Groups.DownloadGroup.GetUsers(.Self)) users.ListAddList(Groups.DownloadGroup.GetUsers(.Self))
End If End If
End If End If
Groups.GroupUsersViewer.Show(users) Groups.GroupUsersViewer.Show(users, $"S { .Name}")
users.Clear() users.Clear()
End With End With
End If End If

View File

@@ -85,7 +85,7 @@ Namespace DownloadObjects.Groups
If e = ShowUsersButtonKey Then If e = ShowUsersButtonKey Then
Using g As New GroupParameters Using g As New GroupParameters
DEFS_GROUP.Get(g) DEFS_GROUP.Get(g)
GroupUsersViewer.Show(DownloadGroup.GetUsers(g)) GroupUsersViewer.Show(DownloadGroup.GetUsers(g), $"{IIf(FilterMode, "F", "G")} {g.Name}")
End Using End Using
End If End If
Catch ex As Exception Catch ex As Exception

View File

@@ -305,10 +305,11 @@ Namespace DownloadObjects.Groups
Try Try
If _LatestSelected.ValueBetween(0, MyGroups.Count - 1) Then If _LatestSelected.ValueBetween(0, MyGroups.Count - 1) Then
Dim i% Dim i%
Dim n$ = String.Empty
Dim users As New List(Of API.Base.IUserData) Dim users As New List(Of API.Base.IUserData)
If Not IsViewFilter Then If Not IsViewFilter Then
i = Settings.Groups.IndexOf(MyGroups(_LatestSelected)) i = Settings.Groups.IndexOf(MyGroups(_LatestSelected))
If i >= 0 Then users.ListAddList(DownloadGroup.GetUsers(Settings.Groups(i))) If i >= 0 Then users.ListAddList(DownloadGroup.GetUsers(Settings.Groups(i))) : n = $"F {Settings.Groups(i).Name}"
ElseIf _LatestSelected.ValueBetween(0, MyGroupParams.Count - 1) Then ElseIf _LatestSelected.ValueBetween(0, MyGroupParams.Count - 1) Then
With MyGroupParams(_LatestSelected) With MyGroupParams(_LatestSelected)
If TypeOf .Self Is AutoDownloader Then If TypeOf .Self Is AutoDownloader Then
@@ -325,14 +326,15 @@ Namespace DownloadObjects.Groups
users.ListAddList(DownloadGroup.GetUsers(.Self)) users.ListAddList(DownloadGroup.GetUsers(.Self))
End If End If
End If End If
n = $"S { .Name}"
End With End With
ElseIf TypeOf .Self Is DownloadGroup Then ElseIf TypeOf .Self Is DownloadGroup Then
i = Settings.Groups.IndexOf(.Name, .IsViewFilter) i = Settings.Groups.IndexOf(.Name, .IsViewFilter)
If i >= 0 Then users.ListAddList(DownloadGroup.GetUsers(Settings.Groups(i))) If i >= 0 Then users.ListAddList(DownloadGroup.GetUsers(Settings.Groups(i))) : n = $"G {Settings.Groups(i).Name}"
End If End If
End With End With
End If End If
GroupUsersViewer.Show(users) GroupUsersViewer.Show(users, n)
users.Clear() users.Clear()
End If End If
Catch ex As Exception Catch ex As Exception

View File

@@ -10,11 +10,16 @@ Imports SCrawler.API.Base
Imports PersonalUtilities.Forms Imports PersonalUtilities.Forms
Namespace DownloadObjects.Groups Namespace DownloadObjects.Groups
Friend Class GroupUsersViewer : Inherits SimpleListForm(Of IUserData) Friend Class GroupUsersViewer : Inherits SimpleListForm(Of IUserData)
Friend Sub New(ByVal Users As IEnumerable(Of IUserData)) Friend Sub New(ByVal Users As IEnumerable(Of IUserData), ByVal AdditText As String)
MyBase.New(Users, Settings.Design) MyBase.New(Users, Settings.Design)
DesignXMLNodeName = "GroupUsersViewer" DesignXMLNodeName = "GroupUsersViewer"
Provider = New CustomProvider(Function(u As UserDataBase) u.ToStringForLog) Provider = New CustomProvider(Function(u As UserDataBase) u.ToStringForLog)
FormText = "Users" FormText = $"Users ({If(Users?.Count, 0)})"
If Not AdditText.IsEmptyString Then
Dim a$ = AdditText.Trim.Take(100).ListToStringE(String.Empty,,, " ", EDP.ReturnValue)
If Not a = AdditText Then AdditText &= "..."
FormText &= $" [{a}]"
End If
Icon = My.Resources.UsersIcon_32 Icon = My.Resources.UsersIcon_32
MyDefs.DelegateClosingChecker = False MyDefs.DelegateClosingChecker = False
Mode = SimpleListFormModes.SelectedItems Mode = SimpleListFormModes.SelectedItems
@@ -23,18 +28,26 @@ Namespace DownloadObjects.Groups
End Sub End Sub
Protected Overrides Sub MyForm_KeyDown(sender As Object, e As KeyEventArgs) Protected Overrides Sub MyForm_KeyDown(sender As Object, e As KeyEventArgs)
Try Try
Dim b As Boolean = True
If e.KeyCode = Keys.F And e.Control Then If e.KeyCode = Keys.F And e.Control Then
e.Handled = True
FocusUser() FocusUser()
ElseIf e.KeyCode = Keys.F3 Then
EditUser(e.Alt)
ElseIf e = ShowUsersButtonKey Then ElseIf e = ShowUsersButtonKey Then
MsgBoxE(New MMessage(DataSourceCollection.ListToStringE(vbCr, Provider,,, EDP.LogMessageValue), "User list") With {.Editable = True}) MsgBoxE(New MMessage(DataSourceCollection.ListToStringE(vbCr, Provider,,, EDP.LogMessageValue), "User list") With {.Editable = True})
ElseIf e.KeyCode = Keys.F1 And Not e.Alt And Not e.Control Then
MsgBoxE({$"Hotkeys:{vbCr}Alt+F1 - show user list{vbCr}Ctrl+F - find the selected user in the main window{vbCr}" &
$"F3 - edit selected user{vbCr}Alt+F3 - edit selected collection", "Hotkeys"})
Else
b = False
End If End If
If b Then e.Handled = True
Catch Catch
End Try End Try
End Sub End Sub
Friend Overloads Shared Sub Show(ByVal Users As IEnumerable(Of IUserData)) Friend Overloads Shared Sub Show(ByVal Users As IEnumerable(Of IUserData), ByVal AdditText As String)
If Users.ListExists Then If Users.ListExists Then
MainFrameObj.OpenedGroupUsersForms.Add(New GroupUsersViewer(Users)) MainFrameObj.OpenedGroupUsersForms.Add(New GroupUsersViewer(Users, AdditText))
MainFrameObj.OpenedGroupUsersForms.Last.Show() MainFrameObj.OpenedGroupUsersForms.Last.Show()
Else Else
MsgBoxE({"No users were found based on the selected parameters", "Show group users"}, vbExclamation) MsgBoxE({"No users were found based on the selected parameters", "Show group users"}, vbExclamation)
@@ -49,6 +62,15 @@ Namespace DownloadObjects.Groups
Catch Catch
End Try End Try
End Sub End Sub
Private Sub EditUser(ByVal EditCollection As Boolean)
Try
If _LatestSelected.ValueBetween(0, DataSourceCollection.Count - 1) Then
Dim u As IUserData = Settings.GetUser(DataSourceCollection(_LatestSelected).Key, EditCollection)
If Not u Is Nothing Then ControlInvokeFast(MainFrameObj.MF, Sub() MainFrameObj.MF.EditSelectedUser(u), EDP.None)
End If
Catch
End Try
End Sub
Friend Overloads Sub Show() Friend Overloads Sub Show()
MyForm.Show() MyForm.Show()
End Sub End Sub

View File

@@ -1706,9 +1706,9 @@ ResumeDownloadingOperation:
End If End If
End If End If
End Sub End Sub
Private Sub EditSelectedUser() Friend Sub EditSelectedUser(Optional ByVal CUser As IUserData = Nothing)
Const MsgTitle$ = "User update" Const MsgTitle$ = "User update"
Dim user As IUserData = GetSelectedUser() Dim user As IUserData = If(CUser, GetSelectedUser())
If Not user Is Nothing Then If Not user Is Nothing Then
On Error Resume Next On Error Resume Next
If Not user.IsCollection OrElse DirectCast(user, UserDataBind).Count > 0 Then If Not user.IsCollection OrElse DirectCast(user, UserDataBind).Count > 0 Then

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.4.10.0")> <Assembly: AssemblyVersion("2024.4.13.0")>
<Assembly: AssemblyFileVersion("2024.4.10.0")> <Assembly: AssemblyFileVersion("2024.4.13.0")>
<Assembly: NeutralResourcesLanguage("en")> <Assembly: NeutralResourcesLanguage("en")>

View File

@@ -104,6 +104,9 @@ Namespace Plugin.Hosts
End With End With
End If End If
End Sub End Sub
Protected Overrides Sub EraseData_AdditionalDataFiles()
ExternalPlugin.ResetHistoryData()
End Sub
Protected Overrides Function DownloadingException(ByVal ex As Exception, ByVal Message As String, Optional ByVal FromPE As Boolean = False, Protected Overrides Function DownloadingException(ByVal ex As Exception, ByVal Message As String, Optional ByVal FromPE As Boolean = False,
Optional ByVal EObj As Object = Nothing) As Integer Optional ByVal EObj As Object = Nothing) As Integer
LogError(ex, Message) LogError(ex, Message)

View File

@@ -825,14 +825,19 @@ Friend Class SettingsCLS : Implements IDownloaderSettings, IDisposable
Return _UserListUpdateRequired Return _UserListUpdateRequired
End Get End Get
End Property End Property
Friend Overloads Sub UpdateUsersList(ByVal u As UserInfo) Friend Overloads Sub UpdateUsersList(ByVal u As UserInfo, Optional ByVal OnlyDiff As Boolean = False)
Dim result As Boolean = True
Dim i% = UsersList.IndexOf(u) Dim i% = UsersList.IndexOf(u)
If i >= 0 Then If i >= 0 Then
UsersList(i) = u If Not OnlyDiff OrElse Not UserInfo.ExactEquals(UsersList(i), u) Then
UsersList(i) = u
Else
result = False
End If
Else Else
UsersList.Add(u) UsersList.Add(u)
End If End If
UpdateUsersList() If result Then UpdateUsersList()
End Sub End Sub
Friend Overloads Sub UpdateUsersList() Friend Overloads Sub UpdateUsersList()
Try Try

View File

@@ -182,6 +182,22 @@ Partial Friend Module MainMod
End Function End Function
#End Region #End Region
#Region "IEquatable Support" #Region "IEquatable Support"
Friend Shared Function ExactEquals(ByVal x As UserInfo, ByVal y As UserInfo) As Boolean
Return x.Name = y.Name And
x.Site = y.Site And
x.Plugin = y.Plugin And
x.AccountName = y.AccountName And
x.File = y.File And
x.IsSubscription = y.IsSubscription And
x.SpecialPath = y.SpecialPath And
x.SpecialCollectionPath = y.SpecialCollectionPath And
x.Merged = y.Merged And
x.UserModel = y.UserModel And
x.CollectionName = y.CollectionName And
x.CollectionModel = y.CollectionModel And
x.[Protected] = y.[Protected] And
AEquals(Of Date)(x.LastSeen, y.LastSeen)
End Function
Friend Overloads Function Equals(ByVal Other As UserInfo) As Boolean Implements IEquatable(Of UserInfo).Equals Friend Overloads Function Equals(ByVal Other As UserInfo) As Boolean Implements IEquatable(Of UserInfo).Equals
Return Site.StringToLower = Other.Site.StringToLower And Name.StringToLower = Other.Name.StringToLower And Return Site.StringToLower = Other.Site.StringToLower And Name.StringToLower = Other.Name.StringToLower And
IsSubscription = Other.IsSubscription And (Not Plugin = PathPlugin.PluginKey Or SpecialPath = Other.SpecialPath) IsSubscription = Other.IsSubscription And (Not Plugin = PathPlugin.PluginKey Or SpecialPath = Other.SpecialPath)