From 70e73c7d9740c966cfcf129e76d96d3ef1132272 Mon Sep 17 00:00:00 2001 From: Andy <88590076+AAndyProgram@users.noreply.github.com> Date: Sat, 11 Dec 2021 07:44:43 +0300 Subject: [PATCH] 1.0.0.3 Fix typo in properties, re-enabling the "Download all" button after changing the mode, removed unused elements --- Changelog.md | 6 ++++++ SCrawler/API/Base/Structures.vb | 1 - SCrawler/API/Base/UserDataBase.vb | 2 +- SCrawler/API/Reddit/UserData.vb | 22 +++++++++------------- SCrawler/API/Twitter/UserData.vb | 14 ++++++-------- SCrawler/Editors/UserCreatorForm.vb | 2 +- SCrawler/MainFrame.vb | 2 +- SCrawler/My Project/AssemblyInfo.vb | 4 ++-- 8 files changed, 26 insertions(+), 27 deletions(-) diff --git a/Changelog.md b/Changelog.md index df5f686..8cfe317 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,9 @@ +# 1.0.0.3 + +- Fixed + - Custom "Download videos" option is not saved + - The "Download all" button is not activated after changing modes + # 1.0.0.2 - Added diff --git a/SCrawler/API/Base/Structures.vb b/SCrawler/API/Base/Structures.vb index 18c8e8d..63e77cb 100644 --- a/SCrawler/API/Base/Structures.vb +++ b/SCrawler/API/Base/Structures.vb @@ -49,7 +49,6 @@ ''' Post ID Friend ID As String Friend [Date] As Date? - Friend Title As String #Region "Channel compatible fields" Friend UserID As String Friend CachedFile As SFile diff --git a/SCrawler/API/Base/UserDataBase.vb b/SCrawler/API/Base/UserDataBase.vb index a744c00..06f1d6d 100644 --- a/SCrawler/API/Base/UserDataBase.vb +++ b/SCrawler/API/Base/UserDataBase.vb @@ -436,7 +436,7 @@ BlockNullPicture: SeparateVideoFolder = AConvert(Of Boolean)(x.Value(Name_SeparateVideoFolder), Nothing) ReadyForDownload = x.Value(Name_ReadyForDownload).FromXML(Of Boolean)(True) DownloadImages = x.Value(Name_DownloadImages).FromXML(Of Boolean)(True) - DownloadedVideos = x.Value(Name_DownloadVideos).FromXML(Of Boolean)(True) + DownloadVideos = x.Value(Name_DownloadVideos).FromXML(Of Boolean)(True) _CountVideo = x.Value(Name_VideoCount).FromXML(Of Integer)(0) _CountPictures = x.Value(Name_PicturesCount).FromXML(Of Integer)(0) LastUpdated = AConvert(Of Date)(x.Value(Name_LastUpdated), ADateTime.Formats.BaseDateTime, Nothing) diff --git a/SCrawler/API/Reddit/UserData.vb b/SCrawler/API/Reddit/UserData.vb index 8b3357b..9a8700c 100644 --- a/SCrawler/API/Reddit/UserData.vb +++ b/SCrawler/API/Reddit/UserData.vb @@ -92,7 +92,7 @@ Namespace API.Reddit Dim URL$ = String.Empty Try Dim PostID$ = String.Empty - Dim PostDate$, PostTitle$ + Dim PostDate$ Dim n As EContainer, nn As EContainer, s As EContainer Dim NewPostDetected As Boolean = False Dim ExistsDetected As Boolean = False @@ -124,30 +124,29 @@ Namespace API.Reddit ExistsDetected = True Continue For End If - PostTitle = nn.Value("title") If CheckNode(nn) Then _ItemsBefore = _TempMediaList.Count added = True s = nn.ItemF({"source", "url"}) If s.XmlIfNothingValue("/").Contains("redgifs.com") Then - _TempMediaList.ListAddValue(MediaFromData(UTypes.VideoPre, s.Value, PostID, PostDate,, IsChannel, PostTitle), LNC) + _TempMediaList.ListAddValue(MediaFromData(UTypes.VideoPre, s.Value, PostID, PostDate,, IsChannel), LNC) Else s = nn.ItemF({"media"}).XmlIfNothing __ItemType = s("type").XmlIfNothingValue Select Case __ItemType - Case "gallery" : If Not DownloadGallery(s, PostID, PostDate,,, PostTitle) Then added = False + Case "gallery" : If Not DownloadGallery(s, PostID, PostDate) Then added = False Case "image", "gifvideo" If s.Contains("content") Then _TempMediaList.ListAddValue(MediaFromData(UPicType(__ItemType), s.Value("content"), - PostID, PostDate,, IsChannel, PostTitle), LNC) + PostID, PostDate,, IsChannel), LNC) Else added = False End If Case "video" If Settings.UseM3U8 AndAlso s("hlsUrl").XmlIfNothingValue("/").ToLower.Contains("m3u8") Then _TempMediaList.ListAddValue(MediaFromData(UTypes.m3u8, s.Value("hlsUrl"), - PostID, PostDate,, IsChannel, PostTitle), LNC) + PostID, PostDate,, IsChannel), LNC) Else added = False End If @@ -167,7 +166,7 @@ Namespace API.Reddit End Select End With If Not tmpType = UTypes.Undefined Then - _TempMediaList.ListAddValue(MediaFromData(tmpType, s.Value, PostID, PostDate,, IsChannel, PostTitle), LNC) + _TempMediaList.ListAddValue(MediaFromData(tmpType, s.Value, PostID, PostDate,, IsChannel), LNC) End If End If End If @@ -270,8 +269,7 @@ Namespace API.Reddit #End Region #Region "Download Base Functions" Private Function DownloadGallery(ByVal w As EContainer, ByVal PostID As String, ByVal PostDate As String, - Optional ByVal _UserID As String = Nothing, Optional ByVal FirstOnly As Boolean = False, - Optional ByVal Title As String = Nothing) As Boolean + Optional ByVal _UserID As String = Nothing, Optional ByVal FirstOnly As Boolean = False) As Boolean Try Dim added As Boolean = False Dim cn$ = IIf(IsChannel, "media_metadata", "mediaMetadata") @@ -280,7 +278,7 @@ Namespace API.Reddit For Each n As EContainer In w(cn) t = n.ItemF({"s", "u"}) If Not t Is Nothing AndAlso Not t.Value.IsEmptyString Then - _TempMediaList.ListAddValue(MediaFromData(UTypes.Picture, t.Value, PostID, PostDate, _UserID, IsChannel, Title), LNC) + _TempMediaList.ListAddValue(MediaFromData(UTypes.Picture, t.Value, PostID, PostDate, _UserID, IsChannel), LNC) added = True If FirstOnly Then Exit For End If @@ -340,15 +338,13 @@ Namespace API.Reddit #End Region #Region "Structure creator" Protected Shared Function MediaFromData(ByVal t As UTypes, ByVal _URL As String, ByVal PostID As String, ByVal PostDate As String, - Optional ByVal _UserID As String = "", Optional ByVal IsChannel As Boolean = False, - Optional ByVal Title As String = Nothing) As UserMedia + Optional ByVal _UserID As String = "", Optional ByVal IsChannel As Boolean = False) As UserMedia If _URL.IsEmptyString And t = UTypes.Picture Then Return Nothing _URL = LinkFormatterSecure(RegexReplace(_URL.Replace("\", String.Empty), LinkPattern)) Dim m As New UserMedia(_URL, t) With {.Post = New UserPost With {.ID = PostID, .UserID = _UserID}} If t = UTypes.Picture Or t = UTypes.GIF Then m.File = UrlToFile(m.URL) Else m.File = Nothing If m.URL.Contains("preview") Then m.URL = $"https://i.redd.it/{m.File.File}" If Not PostDate.IsEmptyString Then m.Post.Date = AConvert(Of Date)(PostDate, If(IsChannel, DateProviderChannel, DateProvider), Nothing) Else m.Post.Date = Nothing - If Not Title.IsEmptyString Then m.Post.Title = Title Return m End Function Private Function TryFile(ByVal URL As String) As Boolean diff --git a/SCrawler/API/Twitter/UserData.vb b/SCrawler/API/Twitter/UserData.vb index e8b839a..7a67552 100644 --- a/SCrawler/API/Twitter/UserData.vb +++ b/SCrawler/API/Twitter/UserData.vb @@ -47,7 +47,7 @@ Namespace API.Twitter Dim URL$ = String.Empty Try Dim PostID$ = String.Empty - Dim PostDate$, PostTitle$ + Dim PostDate$ Dim m As EContainer, nn As EContainer, s As EContainer Dim NewPostDetected As Boolean = False Dim ExistsDetected As Boolean = False @@ -83,18 +83,17 @@ Namespace API.Twitter ExistsDetected = True Continue For End If - PostTitle = nn.Value("full_text") If Not ParseUserMediaOnly OrElse (Not nn.Contains("retweeted_status") OrElse (Not ID.IsEmptyString AndAlso UID(nn("retweeted_status")) = ID)) Then - If Not CheckVideoNode(nn, PostID, PostDate, PostTitle) Then + If Not CheckVideoNode(nn, PostID, PostDate) Then s = nn.ItemF({"extended_entities", "media"}) If s Is Nothing OrElse s.Count = 0 Then s = nn.ItemF({"retweeted_status", "extended_entities", "media"}) If Not s Is Nothing AndAlso s.Count > 0 Then For Each m In s If m.Count > 0 AndAlso m.Contains("media_url") Then _TempMediaList.ListAddValue(MediaFromData(m("media_url").Value, - PostID, PostDate, GetPictureOption(m), PostTitle), LNC) + PostID, PostDate, GetPictureOption(m)), LNC) End If Next End If @@ -159,10 +158,10 @@ Namespace API.Twitter End Function #End Region #Region "Video options" - Private Function CheckVideoNode(ByVal w As EContainer, ByVal PostID As String, ByVal PostDate As String, ByVal Title As String) As Boolean + Private Function CheckVideoNode(ByVal w As EContainer, ByVal PostID As String, ByVal PostDate As String) As Boolean Try Dim URL$ = GetVideoNodeURL(w) - If Not URL.IsEmptyString Then _TempMediaList.ListAddValue(MediaFromData(URL, PostID, PostDate,, Title), LNC) : Return True + If Not URL.IsEmptyString Then _TempMediaList.ListAddValue(MediaFromData(URL, PostID, PostDate), LNC) : Return True Return False Catch ex As Exception LogError(ex, "[CheckVideoNode]") @@ -194,7 +193,7 @@ Namespace API.Twitter End Sub #End Region Private Shared Function MediaFromData(ByVal _URL As String, ByVal PostID As String, ByVal PostDate As String, - Optional ByVal _PictureOption As String = "", Optional ByVal Title As String = Nothing) As UserMedia + Optional ByVal _PictureOption As String = "") As UserMedia _URL = LinkFormatterSecure(RegexReplace(_URL.Replace("\", String.Empty), LinkPattern)) Dim m As New UserMedia(_URL) With {.PictureOption = _PictureOption, .Post = New UserPost With {.ID = PostID}} If Not m.URL.IsEmptyString Then m.File = CStr(RegexReplace(m.URL, FilesPattern)) @@ -202,7 +201,6 @@ Namespace API.Twitter m.URL_BASE = $"{m.URL.Replace($".{m.File.Extension}", String.Empty)}?format={m.File.Extension}&name={m.PictureOption}" End If If Not PostDate.IsEmptyString Then m.Post.Date = AConvert(Of Date)(PostDate, Declarations.DateProvider, Nothing) Else m.Post.Date = Nothing - If Not Title.IsEmptyString Then m.Post.Title = Title Return m End Function #End Region diff --git a/SCrawler/Editors/UserCreatorForm.vb b/SCrawler/Editors/UserCreatorForm.vb index 72a9f05..cabcbcc 100644 --- a/SCrawler/Editors/UserCreatorForm.vb +++ b/SCrawler/Editors/UserCreatorForm.vb @@ -106,7 +106,7 @@ Namespace Editors CH_PARSE_USER_MEDIA.Checked = .ParseUserMediaOnly CH_READY_FOR_DOWN.Checked = .ReadyForDownload CH_DOWN_IMAGES.Checked = .DownloadImages - CH_DOWN_VIDEOS.Checked = .DownloadedVideos + CH_DOWN_VIDEOS.Checked = .DownloadVideos TXT_DESCR.Text = .Description UserLabels.ListAddList(.Labels) If UserLabels.ListExists Then TXT_LABELS.Text = UserLabels.ListToString diff --git a/SCrawler/MainFrame.vb b/SCrawler/MainFrame.vb index 0576df6..4361170 100644 --- a/SCrawler/MainFrame.vb +++ b/SCrawler/MainFrame.vb @@ -405,7 +405,7 @@ CloseResume: End If End If Settings.ShowingMode.Value = m - If Not m = ShowingModes.All Then BTT_DOWN_ALL.Enabled = False + BTT_DOWN_ALL.Enabled = m = ShowingModes.All End Sub Private Sub BTT_SELECT_LABELS_Click(sender As Object, e As EventArgs) Handles BTT_SELECT_LABELS.Click OpenLabelsForm() diff --git a/SCrawler/My Project/AssemblyInfo.vb b/SCrawler/My Project/AssemblyInfo.vb index 12fa90e..368b9d5 100644 --- a/SCrawler/My Project/AssemblyInfo.vb +++ b/SCrawler/My Project/AssemblyInfo.vb @@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices ' by using the '*' as shown below: ' - - + +