mirror of
https://github.com/AAndyProgram/SCrawler.git
synced 2026-03-14 15:52:18 +00:00
Plugins.Attributes: add 'DependentFields' attribute Plugins.IPluginContentProvider: add 'Options' and 'IsSubscription' properties Plugins.ISiteSettings: add 'SubscriptionsAllowed' property Plugins.ExchangeOptions: add 'Options' field Plugins.Attributes.PropertyUpdater: replace 'Dependencies' with 'Arguments' YT: add 'OutputPathAskForName' and 'OutputPathAutoAddPaths' properties; add the ability to store download locations; add 'DownloadLocation' and 'DownloadLocationsCollection' objects YT.IDownloaderSettings: add 'OutputPathAskForName' and 'OutputPathAutoAddPaths' properties YT.Downloader: fixed bug with re-saving elements when loading a video list; fixed bug when files were not deleted when clicking on the delete button; fixed a bug that caused the video to redownload; download job removes elements at wrong indexes; added skipping of downloaded elements in the job; fixed a bug, pending option did not change after download complete YT.YouTubeMediaContainerBase: add '_MediaStateOnLoad' field and 'NeedToSave' function; update the 'Save' function to prevent saving a file when a download is complete and the file has already been saved; update code for new yt-dlp version Fixed cache deletion errors Add user queue Add global locations API.Base.SiteSettingsBase: implement 'SubscriptionsAllowed' property; remove request headers with null values on save; add '_AllowUserAgentUpdate' parameter API.Base.Structures: add 'SiteModes' enum API.Base.UserDataBase: add 'Erase' button; implement 'Options' and 'IsSubscription' properties; add 'SpecialLabels' property; update 'LVIKey'; update 'FitToAddParams' function; add 'EraseData' function; user colors; Not UserExists notification, UserQueue support API.Base: add 'DeclaredNames' API.Instagram: remove default values for headers; disable updating UserAgent from global; check for a new username for non-existent users API.Mastodon: bypass new inherited twitter options; update names and headers API.OnlyFans: make 'HH_BROWSER' property nullable; remove 'HH_BROWSER' from required; fix username bug (dots); handling of 504 and 429 errors; add 'DownloadHighlights' and 'DownloadChatMedia' options; add 'UserExchangeOptions'; fixed incorrect error handler API.PathPlugin: fixed incorrect detection of path existence API.Pinterest: add 'SpecialLabels' API.PornHub: add new video regex; remove old regex; added 'DownloadUploaded', 'DownloadTagged', 'DownloadPrivate' and 'DownloadFavorite' properties to 'SiteSettings', 'UserData' and 'UserExchangeOptions'; update regex to define user; added downloading search queries; update 'GetUserUrl' function; hide unnecessary 'RegexFieldsTextBecameNullException' errors; add subscriptions API.Reddit: add 'SpecialLabels'; add bearer token and its refresh interval; add OAuth; add additional options API.RedGifs: add 'DependentFields' for 'Token' API.ThisVid: add 'DownloadFavourite' option; add downloading search queries, tags, categories; add 'SpecialLabels'; add subscriptions; updating cookies issue API.TikTok: rewrite algorithms API.Twitter: add 'UseAppropriateModel', 'UseNewEndPointSearch', 'UseNewEndPointProfiles', 'AbortOnLimit', 'DownloadAlreadyParsed', 'MediaModelAllowNonUserTweets' properties; remove old commented code; remove 'TwitterPic_400' and replace with 'TwitterIcon_32.ToBitmap'; add 'DownloadModelForceApply' user option; update environment to GDL 1.25.8; fixed gifs downloading; fix typo in 'ReparseMissing'; update names API.UserDataBind: prevent adding site-specific labels when adding to a collection API.Xhamster: add downloading search queries, tags, categories; add 'SpecialLabels'; add additional nodes for channels; add subscriptions API.XVIDEOS: add downloading search queries, tags, categories; add 'SpecialLabels'; add subscriptions; changed users creation method; add subscriptions API.YouTube: add subscriptions AutoDownloader: add new group subscription options; update predicates; fixed excluded labels and sites in default mode; update notifications; add an additional skip options, add 'Force start' option DownloadedInfoForm: add subscriptions; fixed size/location bug; hide unnecessary error (refill) Feed: add subscriptions; update filters; add 'Ctrl+G' shortcut FeedMedia: add subscriptions; fixed 'webm' bug; add title for subscription media; add site icon to post; user colors; always using 'FriendlyName' instead of 'UserName' if it exists DownloadGroup, GroupDefaults, GroupParameters: add subscription and 'UsersCount' options MissingPostsForm: add 'BTT_DELETE_ALL' VideoDownloaderForm, DownloaderUrlForm, DownloaderUrlsArrForm: add download locations support VideoDownloaderForm: add subscriptions support GlobalSettingsForm: add new properties UserCreatorForm: add subscriptions; add 'Options' support (of 'ExchangeOptions'); user colors ListImagesLoader: add subscription colors; user colors MainFrame: add subscriptions; add filters by subscription and user; update predicates NuGet: update 'LibVLCSharp', 'LibVLCSharp.WinForms', 'VideoLAN.LibVLC.Windows' DownloadableMediaHost: update 'Save' function PropertyValueHost: fix 'CaptionWidth' bug; add 'Dependents' SettingsHost: add 'Dependents' UserDataHost: add 'Options' and 'IsSubscription' properties SettingsCLS: implement new 'IDownloaderSettings' properties; add 'CacheSnapshots'; add 'DownloadLocations'; add new properties UserInfo, UserFinder: add subscriptions UserSearchForm: fixed search by name bug
135 lines
8.1 KiB
VB.net
135 lines
8.1 KiB
VB.net
' Copyright (C) 2023 Andy https://github.com/AAndyProgram
|
|
' This program is free software: you can redistribute it and/or modify
|
|
' it under the terms of the GNU General Public License as published by
|
|
' the Free Software Foundation, either version 3 of the License, or
|
|
' (at your option) any later version.
|
|
'
|
|
' This program is distributed in the hope that it will be useful,
|
|
' but WITHOUT ANY WARRANTY
|
|
Imports PersonalUtilities.Tools
|
|
Imports PersonalUtilities.Tools.Web
|
|
Imports PersonalUtilities.Functions.Messaging
|
|
Imports SCrawler.DownloadObjects.STDownloader
|
|
Public Module MainModShared
|
|
Public Property BATCH As BatchExecutor
|
|
Private _BatchLogSent As Boolean = False
|
|
''' <param name="e"><see cref="EDP.None"/></param>
|
|
Public Sub GlobalOpenPath(ByVal f As SFile, Optional ByVal e As ErrorsDescriber = Nothing)
|
|
Dim b As Boolean = False
|
|
If Not e.Exists Then e = EDP.None
|
|
Try
|
|
If f.Exists(SFO.Path, False) Then
|
|
If MyDownloaderSettings.OpenFolderInOtherProgram AndAlso Not MyDownloaderSettings.OpenFolderInOtherProgram_Command.IsEmptyString Then
|
|
If BATCH Is Nothing Then BATCH = New BatchExecutor With {.RedirectStandardError = True}
|
|
b = True
|
|
With BATCH
|
|
.Reset()
|
|
.Execute({String.Format(MyDownloaderSettings.OpenFolderInOtherProgram_Command, f.PathWithSeparator)}, EDP.SendToLog + EDP.ThrowException)
|
|
If .HasError Or Not .ErrorOutput.IsEmptyString Then Throw New Exception(.ErrorOutput, .ErrorException)
|
|
End With
|
|
Else
|
|
f.Open(SFO.Path,, e)
|
|
End If
|
|
End If
|
|
Catch ex As Exception
|
|
If b Then
|
|
If Not _BatchLogSent Then ErrorsDescriber.Execute(EDP.SendToLog, ex, $"GlobalOpenPath({f.Path})") : _BatchLogSent = True
|
|
f.Open(SFO.Path,, e)
|
|
End If
|
|
End Try
|
|
End Sub
|
|
Public Sub ShowProgramInfo(ByVal ProgramText As String, ByVal CurrentVersion As Version, ByVal CheckForUpdate As Boolean, ByVal Force As Boolean,
|
|
ByVal EnvirData As IDownloaderSettings, ByVal IsYouTube As Boolean,
|
|
Optional ByRef NewVersionDestination As String = Nothing, Optional ByVal ShowNewVersionNotification As Boolean = True,
|
|
Optional ByVal AdditText As String = Nothing)
|
|
Try
|
|
Dim GoToSite As New MsgBoxButton("Go to site") With {.CallBack = Sub(r, n, b) Process.Start("https://github.com/AAndyProgram/SCrawler/releases/latest")}
|
|
If CheckForUpdate AndAlso GitHub.NewVersionExists(CurrentVersion, "AAndyProgram", "SCrawler", NewVersionDestination) Then
|
|
If ShowNewVersionNotification Or Force Then
|
|
If MsgBoxE(New MMessage($"{ProgramText}: new version detected" & vbCr &
|
|
$"Current version: {CurrentVersion}" & vbCr &
|
|
$"New version: {NewVersionDestination}",
|
|
"New version",
|
|
{"OK", GoToSite, "Disable notifications"})) = 2 Then ShowNewVersionNotification = False
|
|
End If
|
|
Else
|
|
If Force Then
|
|
Dim pVer$ = $"{ProgramText} v{CurrentVersion} ({IIf(Environment.Is64BitProcess, "x64", "x86")})"
|
|
Dim eText$ = Editors.ProgramInfo.GetProgramBaseText(ProgramText, CurrentVersion, AdditText)
|
|
Dim m As New MMessage($"{pVer}" & vbCr &
|
|
"Address: https://github.com/AAndyProgram/SCrawler" & vbCr &
|
|
"Created by Greek LGBT person Andy (Gay)",
|
|
"Program information",
|
|
{"OK",
|
|
GoToSite,
|
|
New MsgBoxButton("Environment", "Show program environment") With {
|
|
.IsDialogResultButton = False,
|
|
.CallBack = Sub(r, n, b) ShowProgramEnvir(EnvirData, IsYouTube, eText)}
|
|
}) With {.DefaultButton = 0, .CancelButton = 0}
|
|
If Not AdditText.IsEmptyString Then m.Text &= $"{vbCr}{AdditText}"
|
|
m.Show()
|
|
End If
|
|
ShowNewVersionNotification = True
|
|
End If
|
|
Catch ex As Exception
|
|
End Try
|
|
End Sub
|
|
Private Sub ShowProgramEnvir(ByVal EnvirData As IDownloaderSettings, ByVal IsYouTube As Boolean, ByVal AdditCopyText As String)
|
|
Dim m As New MMessage(Editors.ProgramInfo.GetProgramEnvirText(EnvirData, IsYouTube), "Program environment", {"OK", "Copy"}) With {.Editable = True, .DefaultButton = 0, .CancelButton = 0}
|
|
If m.Text = Editors.ProgramInfo.EnvironmentNotFound Then m.Style = vbCritical
|
|
m.Text = $"{AdditCopyText}{vbCr}{m.Text}"
|
|
If m.Show() = 1 Then BufferText = m.Text
|
|
End Sub
|
|
End Module
|
|
Namespace Editors
|
|
Public NotInheritable Class ProgramInfo
|
|
Public Const EnvironmentNotFound As String = "Environment not found"
|
|
Private Sub New()
|
|
End Sub
|
|
Public Shared Function GetProgramText(ByVal ProgramText As String, ByVal CurrentVersion As Version, ByVal IsYouTube As Boolean,
|
|
ByVal EnvirData As IDownloaderSettings, Optional ByVal AdditText As String = Nothing) As String
|
|
Return GetProgramBaseText(ProgramText, CurrentVersion, AdditText) & vbNewLine & GetProgramEnvirText(EnvirData, IsYouTube)
|
|
End Function
|
|
Public Shared Function GetProgramBaseText(ByVal ProgramText As String, ByVal CurrentVersion As Version, Optional ByVal AdditText As String = Nothing) As String
|
|
Dim pVer$ = $"{ProgramText} v{CurrentVersion} ({IIf(Environment.Is64BitProcess, "x64", "x86")})"
|
|
Dim WinVer$ = String.Empty
|
|
Try : WinVer = $"OS: {My.Computer.Info.OSFullName} ({IIf(Environment.Is64BitOperatingSystem, "x64", "x86")})" : Catch : End Try
|
|
Return pVer.StringDup(1).StringAppendLine(WinVer).StringAppendLine(AdditText)
|
|
End Function
|
|
Public Shared Function GetProgramEnvirText(ByVal EnvirData As IDownloaderSettings, ByVal IsYouTube As Boolean) As String
|
|
Try
|
|
Dim output$ = String.Empty
|
|
Using b As New BatchExecutor(True)
|
|
Dim f As SFile
|
|
Dim cmd$, ff$, vText$
|
|
|
|
For i% = 0 To IIf(IsYouTube, 1, 3)
|
|
cmd = "--version"
|
|
Select Case i
|
|
Case 0 : f = EnvirData.ENVIR_FFMPEG : ff = "ffmpeg" : cmd = "-version"
|
|
Case 1 : f = EnvirData.ENVIR_YTDLP : ff = "yt-dlp"
|
|
Case 2 : f = EnvirData.ENVIR_GDL : ff = "gallery-dl"
|
|
Case 3 : f = EnvirData.ENVIR_CURL : ff = "cURL"
|
|
Case Else : f = Nothing : ff = Nothing : cmd = Nothing
|
|
End Select
|
|
If Not ff.IsEmptyString Then
|
|
If f.IsEmptyString Then
|
|
output.StringAppendLine($"[{ff}] NOT FOUND")
|
|
Else
|
|
b.Reset()
|
|
b.Execute($"""{f}"" {cmd}", EDP.None)
|
|
If b.OutputData.Count > 3 Then vText = b.OutputData(3) Else vText = "undefined"
|
|
output.StringAppendLine($"{ff} version: {vText}")
|
|
End If
|
|
End If
|
|
Next
|
|
|
|
If output.IsEmptyString Then output = EnvironmentNotFound
|
|
End Using
|
|
Return output
|
|
Catch ex As Exception
|
|
Return ErrorsDescriber.Execute(EDP.SendToLog + EDP.ReturnValue, ex, "[ProgramInfo.GetProgramEnvirText]", String.Empty)
|
|
End Try
|
|
End Function
|
|
End Class
|
|
End Namespace |