reverted flake

This commit is contained in:
2024-11-03 15:40:20 -06:00
parent 5f27d4612a
commit 455224c045
78 changed files with 0 additions and 27 deletions

View File

@@ -0,0 +1,95 @@
$downloadDirectory = 'D:\Downloads\'
Set-Location $downloadDirectory
switch -Regex ($args[0]){
<#'music.'{
$YTcommand = "youtube-dl --no-playlist --newline -x --audio-format best --add-metadata --audio-quality 0 $args[0]""
}#>
'youtu'{$YTcommand = "youtube-dl -o ""$downloadDirectory\%(title)s.%(ext)s"" $args[0]"}
'twitter'{$YTcommand = "youtube-dl -o ""$downloadDirectory\%(id)s.%(ext)s"" $args[0]"}
'chaturbate'{
for ($i=1;$i -le 40;$i++){
$waitTimer = 30
$chaturbate = "youtube-dl -o ""$downloadDirectory\%(title)s.%(ext)s"" $args[0]"
Invoke-Expression $chaturbate
$timeMultiply = $waitTimer * $i
$ts = [timespan]::FromSeconds($timeMultiply)
Start-Sleep -Seconds $waitTimer
Write-Host 'Waited for' $ts
}
}
'series'{
$channels = @(
'https://www.youtube.com/user/Worthikids'
'https://www.youtube.com/user/CrazyBorisProduction'
'https://www.youtube.com/c/JelloApocalypse/videos'
'https://www.youtube.com/c/BRFootball/videos'
)
$regexs = @(
'(?i)^bigtop burger'
'(?i)^dungeon dynamite'
'(?i)^epithet erased'
'(?i)^the champions(?! League)'
)
$locations = @(
'D:\OneDrive\Videos\Series\Bigtop Burger'
'D:\OneDrive\Videos\Series\Dungeon Dynamite'
'D:\OneDrive\Videos\Series\Epithet Erased'
'D:\OneDrive\Videos\Series\The Champions'
)
for ($i = 0; $i -lt $channels.Count; $i++){
$channel = $channels[$i]
$location = $locations[$i]
$regex = $regexs[$i]
$channelSeries = "youtube-dl --match-title ""$regex"" -i --ignore-config --add-metadata --embed-subs --all-subs --convert-subs srt --merge-output-format mkv -o ""$location\%(title)s.%(ext)s"" ""$channel"""
Invoke-Expression $channelSeries
}
$Channels = @(
'https://www.youtube.com/channel/UC1DTYW241WD64ah5BFWn4JA/videos'
'https://www.youtube.com/c/ContraPoints/videos'
)
$locations = @(
"D:\OneDrive\Videos\Series\Sam O'Nella"
"D:\OneDrive\Videos\Series\ContraPoints"
)
#Channels Hd
for ($i = 0; $i -lt $channels.Count; $i++){
$channel = $channels[$i]
$location = $locations[$i]
$regex = $regexs[$i]
$channelSeries = "youtube-dl -i --ignore-config --add-metadata --embed-subs --all-subs --convert-subs srt --merge-output-format mkv -o ""$location\%(title)s.%(ext)s"" ""$channel"""
Invoke-Expression $channelSeries
}
#Rhys
$playlists = @(
'https://youtu.be/BhMIUJ-OeaQ?list=PLzxc0OSXCoWxzE6IvnzCcOqlI0puY0513'
'https://youtu.be/ilYzQJ-geCc?list=PLzxc0OSXCoWxhI9_F5ZHgsC2MZ9uyZK8V'
'https://youtu.be/b5S7WPRbVDk?list=PLzxc0OSXCoWwItlpwhY7TOR8RWu8wyQHC'
)
foreach ($playlist in $playlists){
$location = 'D:\OneDrive\Videos\Series\Rhys'
$urlCommand = "youtube-dl -i --ignore-config --add-metadata --recode-video mp4 -o ""$location\%(playlist)s\%(title)s.%(ext)s"" ""$playlist"""
Invoke-Expression $urlCommand
}
#CGkid
$channel = 'https://www.youtube.com/c/CgKid/videos'
$location = 'D:\OneDrive\Videos\Series\CGKid'
$urlCommand = "youtube-dl -f ""best[height<480]"" -i --ignore-config --add-metadata --recode-video mp4 -o ""$location\%(title)s.%(ext)s"" ""$channel"""
Invoke-Expression $urlCommand
}
Default {
$linkCom = "youtube-dl -o ""$downloadDirectory\%(title)s.%(ext)s"" $args[0]"
Invoke-Expression $linkCom
}
}
if ($YTcommand){
Invoke-Expression $YTcommand
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,145 @@
Import-Module PSWriteColor
#Set-Location 'F:\Library\Graphic Novels' #Resets location to root
#Set-Location 'E:\Comic'
#$txtDelete = 'F:\Library\Delete.txt'
function removeEmptyDirectory{
remove-emtpy.ps1 -Path .\ -Remove -VerifyNoEmpty
}
function renamePages{
# Parameter help description
param (
[string]$dirLocation,
[int]$issuePart
)
Set-Location $dirLocation #Set location to the issue directory
$files = Get-ChildItem * -Include '*.jpg', '*.png', '*.jpeg', '*.gif'
for($i = 1; $i -le $files.Count; $i++){ #creates a serialized array of the new file names
$newName = ([string]$issuePart).PadLeft(4,'0') + ([string]$i).PadLeft(4,'0') + $files[$i-1].Extension
#$newName
Rename-Item $files[$i-1] -NewName $newName
}
}
function unzipCBZ{
param (
$cbzFiles
)
$removeEmptyDirectoryDef = $Function:removeEmptyDirectory.ToString()
$renamePagesDef = $Function:renamePages.ToString()
$cbzFiles | ForEach-Object -parallel { #Creates a list of CBZ files on all the subdirectories and runs for each one
#define functions inside the thrad
$Function:removeEmptyDirectory = $using:removeEmptyDirectoryDef
$Function:renamePages = $using:renamePagesDef
Set-Location $_.DirectoryName #Changes location to a children directory to avoid uncompressing into the wrong folders
7z x $_ -o* > $txtDelete
Remove-Item $_.FullName #Removes the CBZ file after extracted
Set-Location $_.BaseName #Set the location to the uncompressed directory
$issueDirectoryLocation = Get-Location #store the issue location for later use
#Remove emtpy directories and creates a check variable
removeEmptyDirectory
$dirDirectories = Get-ChildItem -Directory
#If statements to check and rename files according to how many directories they contain
if (($dirDirectories).Count -gt 0){
for ($i = 0; $i -le ($dirDirectories).Count; $i++){ #system to rename every file according with an increment of which "part" directory of the TPB they belong to
renamePages $dirDirectories[$i] $i
}
Set-Location $issueDirectoryLocation
Get-ChildItem -Recurse -File -Exclude 'ComicInfo.xml' | Move-Item -Destination $issueDirectoryLocation #move files to the root
removeEmptyDirectory
if ((Get-ChildItem -Directory).Count -gt 0){
Get-ChildItem -Recurse -File 'ComicInfo.xml' | Remove-Item
Set-Location $issueDirectoryLocation
removeEmptyDirectory
}
}
elseif (($dirDirectories).Count -eq 0){
$dirLocation = Get-Location
renamePages $dirLocation 0
}
} -ThrottleLimit 15
}
function convertFiles{
Get-ChildItem -Recurse *.jpg | ForEach-Object -parallel { #convert PNG
Set-Location $_.Directory
$fileName = $_.BaseName
magick convert -quality 100 $_ "$fileName.png"
Remove-Item $_
}
Get-ChildItem -Recurse *.png | ForEach-Object -parallel { #convert JPG
Set-Location $_.Directory
$fileName = $_.BaseName
magick convert -quality 100 $_ "$fileName.jpg"
Remove-Item $_
}
}
function partDirs{
param (
$workingDir
)
$dirParts = Get-ChildItem -Directory -Recurse | Where-Object {$_.Name -match 'Part'}
foreach ($dirPart in $dirParts){
Set-Location $dirPart.Parent
$TPBname = $dirPart.Name.Split(' (')
if(!(Test-Path $TPBname[0])){
New-Item -ItemType Directory $TPBname[0]
}
else{
$nameFixed = $TPBname[0] + ' '
$nameFixed
$dirMove = Get-ChildItem -Directory -Exclude $TPBname[0] | Where-Object {$_.Name -match $nameFixed}
if ($dirMove){
$dirMove
$TPBname[0]
Move-Item $dirMove -Destination $TPBname[0]
}
}
}
Set-Location $workingDir ################FIX THIS############
#########################
############
foreach ($dir in Get-ChildItem -Recurse -Directory){
if(test-path($dir)){Set-Location $dir}
$issueDirectoryLocation = Get-Location
if(Get-ChildItem -Directory | Where-Object {$_.Name -match 'Part'}){
$dirRename = Get-ChildItem -Directory
for ($i = 0; $i -le ($dirRename).Count; $i++){ #system to rename every file according with an increment of which "part" directory of the TPB they belong to
renamePages $dirRename[$i] $i
}
Set-Location $issueDirectoryLocation
Get-ChildItem -Recurse -File -Exclude 'ComicInfo.xml' | Move-Item -Destination $issueDirectoryLocation #move files to the root
removeEmptyDirectory
}
}
}
switch ($args[0]) {
'1'{
$cbzFiles = Get-ChildItem *.cbz -Recurse -File
unzipCBZ $cbzFiles
}
'2'{
convertFiles
}
'3'{
Set-Location $args[1]
partDirs $args[1]
}
'4'{
Set-Location 'F:\Library\Comic'
foreach ($dir in Get-ChildItem -Recurse -Directory){
renamePages $dir 0
}
}
}

View File

@@ -0,0 +1,338 @@
D:\OneDrive\Programs\bin\task.ps1
Clear-Host
#Variables
switch ($env:COMPUTERNAME){
"WORKSTATION"
{
$Env:dirDownload = 'F:\Library'
$Env:dirJson = 'F:\Library\gallery-dl'
}
"SURFACE"
{
$Env:dirDownload = 'C:\Users\JawZ\Downloads'
$Env:dirJson = '\\WORKSTATION\Library\gallery-dl'
}
}
$Env:database = "$Env:dirJson\manga.sqlite3"
$mAll= "$Env:dirJson\manga.json"
$mVol = "$Env:dirJson\manga-i(vol).json"
$list = "$Env:dirJson\manga.txt"
$downloadList_1 = "$Env:dirJson\download_1.txt"
$downloadList_2 = "$Env:dirJson\download_2.txt"
$downloadList_3 = "$Env:dirJson\download_3.txt"
$downloadList_4 = "$Env:dirJson\download_4.txt"
$downloadList_5 = "$Env:dirJson\download_5.txt"
$textInfo = (Get-Culture).TextInfo
function removeEmptyDirectory{
remove-emtpy.ps1 -Path .\ -Remove -VerifyNoEmpty
}
function Write-Separator{Write-Color '---' -Color DarkGray}
function email ($body){
$EmailFrom = "jawzoned@gmail.com"
$EmailTo = "captainjawz@outlook.com"
$Subject = "New files on the library! "
$SMTPServer = "smtp.gmail.com"
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)
$SMTPClient.EnableSsl = $true
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("jawzoned", "od3g4t!T&yJq");
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, "$Body")
}
function automaticManga{#Download manga automatically
foreach ($webtoon in [System.IO.File]::ReadLines("$list")){
if ($webtoon | Select-String -Pattern 'webtoon'){
gallery-dl --sleep 5 --download-archive $Env:database -c "$mAll" --chapter-range '1' "$webtoon"
}
}
foreach ($manga in [System.IO.File]::ReadLines("$list")){
if ($manga | Select-String -Pattern 'manga'){
gallery-dl --sleep 5 --download-archive $Env:database -c "$mAll" --chapter-range '1-5' "$manga"
}
}
Set-Location $Env:dirDownload\New
removeEmptyDirectory
$newDirectories = Get-ChildItem -Path "$Env:dirDownload\New" -Directory -Recurse
if ($newDirectories){
$body = $newDirectories.Name | Out-String
email $body
}
}
function mangaRange($range){#Download manga automatically
$counter = -1
Write-Separator
foreach ($line in [System.IO.File]::ReadLines($list)){
$counter++
if ($line | Select-String -Pattern 'manga'){
$lineName = $line.Substring(($line.LastIndexOf('/')+1)).Replace("-", " ").Replace("_", " ") #Fix the name so it is presentable
$lineName = $textInfo.ToTitleCase($lineName)
Write-Color "$counter) ", "$lineName" -Color White, Yellow
}
}
Write-Separator
Write-Color 'Make a choice:' -C White
Write-Separator
$selection = Read-Host
Clear-Host
#[string]$range = "'" + $range + "'"
$line = [System.IO.File]::ReadLines($list) | Select-Object -Index $selection
gallery-dl --download-archive $Env:database -c $mAll --chapter-range $range $line
Set-Location $Env:dirDownload\New
removeEmptyDirectory
}
$DO = $args[0]
if($DO){
Switch($DO){
'a'{automaticManga}
'edit'{
Write-Color '1) ', 'Edit manga list' -C White, Yellow
Write-Color '2) ', 'Edit download list 1' -C White, Yellow
Write-Color '3) ', 'Edit download list 2' -C White, Yellow
Write-Color '4) ', 'Edit download list 3' -C White, Yellow
Write-Color '5) ', 'Edit download list 4' -C White, Yellow
Write-Color '6) ', 'Edit download list 5' -C White, Yellow
Write-Separator
$selectOperation = Read-Host
switch($selectOperation){
'1'{Invoke-Item $list}
'2'{Invoke-Item $downloadList_1}
'3'{Invoke-Item $downloadList_2}
'4'{Invoke-Item $downloadList_3}
'5'{Invoke-Item $downloadList_4}
'6'{Invoke-Item $downloadList_5}
}
}
}
}
else{
#Menu
Write-Color '1) ', 'Update Manga custom range' -C White, Yellow
Write-Color '2) ', 'Update comic from list' -C White, Yellow
Write-Color '3) ', 'Update everything' -C White, Yellow
Write-Color '4) ', 'Download individual comic/manga' -C White, Yellow
Write-Color '5) ', 'Download individual comic/manga per Volume' -C White, Yellow
Write-Color '6) ', 'Download batch' -C White, Yellow
Write-Color '7) ', 'Sort list file'-C White, Yellow
Write-Separator
#Actions
if ((Test-Path $Env:database) -and (Test-Path $mAll) -and (Test-Path $mVol) -and (Test-Path $list) -and (Test-Path $Env:dirDownload)){
$selectOperation = Read-Host
Write-Separator
switch ($selectOperation){
'1' {
Write-Color 'Insert a custom range ', '(ex 1-10)' -C Gray, DarkGray
Write-Separator
$range = Read-Host
mangaRange $range
}
'2' { #Update comic
$userInput = ''
Do {
Clear-Host
$counter = -1
foreach ($line in [System.IO.File]::ReadLines($list)) { #Print each lines from the list containing Comic pattern
$counter++
if ($line | Select-String -Pattern 'readcomiconline') {
$lineName = $line.Substring(($line.LastIndexOf('/')+1)).Replace("-", " ").Replace("_", " ") #Fix the name so it is presentable
$lineName = $textInfo.ToTitleCase($lineName)
Write-Color "$counter) ", "$lineName" -Color White, Yellow
}
}
Write-Separator
Write-Color 'Make a selection:' -C White
Write-Separator
$selection = Read-Host
Clear-Host
$line = [System.IO.File]::ReadLines($list) | Select-Object -Index $selection
$lineName = $line.Substring(($line.LastIndexOf('/')+1)).Replace("_", " ").Replace("-"," ") #Fix name so it is presentable
$lineName = $textInfo.ToTitleCase($lineName)
Write-Color 'Your selection is: ', $lineName -C White, Yellow
Write-Separator
Write-Color 'Is your choice correct?', '(y/n)' -C White, DarkGray
Write-Separator
$userInput = Read-Host #Ask user if selection is correct
} while (($userInput -eq '') -or ($userInput -eq 'n')) #if selection is incorrect reprint the list
Clear-Host
gallery-dl --download-archive $Env:database -c $mAll --chapter-range '1' "$line"
}
'3'{
Clear-Host
gallery-dl --download-archive $Env:database -c "$mAll" -i "$list"
}
'4'{
Clear-Host
Write-Separator
Write-Color 'Enter link' -C White
Write-Separator
$link = Read-Host
Write-Separator
Write-Color 'Do you want to use the Database?', '(y/n)' -C White, DarkGray
Write-Separator
$useDB = Read-Host
Write-Separator
Clear-Host
if ($useDB -eq 'y'){
gallery-dl --download-archive $Env:database -c "$mAll" "$link"
}
else{
gallery-dl -c "$mAll" "$link"
}
}
'5'{
Clear-Host
Write-Color 'Enter link:' -C White
Write-Separator
$link = Read-Host
Write-Separator
Clear-Host
gallery-dl --download-archive $Env:database -c "$mVol" "$link"
}
'6'{
#$date = get-date -Format '(ddMMyyy_hhmm)'
#$log = "$Env:dirJson\logs\log $date.txt"
Clear-Host
Write-Color 'Which list do you want to use?' -C White
Write-Separator
$listNumber = Read-Host
switch ($listNumber) {
'1'{gallery-dl --sleep 0 -c "$mAll" -i "$downloadList_1"}
'2'{gallery-dl --sleep 0 -c "$mAll" -i "$downloadList_2"}
'3'{gallery-dl --sleep 0 -c "$mAll" -i "$downloadList_3"}
'4'{gallery-dl --sleep 0 -c "$mAll" -i "$downloadList_4"}
'5'{gallery-dl --sleep 2 --download-archive $Env:database -c "$mAll" -i "$downloadList_5"}
}
}
'7'{
$finalContent = @()
$content = (Get-Content $list).ToLower() | Sort-Object | Select-Object -Unique
foreach ($line in $content){
[string]$line = $line
<#$line = $line.Replace('http:', 'https:')
if ($line -Match '\/$'){
$line = $line.TrimEnd('/')
}#>
$finalContent += $line
}
$finalContent -match '\S' > $list
}
}
}
else {
Clear-Host
Write-Output 'ERROR: One of the configuration files is missing'
Write-Output "Database"
Test-Path $Env:database
Write-Output "manga.json"
Test-Path $mAll
Write-Output "manga-1(vol).json"
Test-Path $mVol
Write-Output "Manga list.txt"
Test-Path $list
Write-Output "Download directory"
Test-Path $Env:dirDownload
}
}
function Capitalize{
#Set-Location 'F:\Library\New'
<#foreach ($directory in Get-ChildItem -Recurse -Directory){
Set-Location $directory
$capitalizeFiles = Get-ChildItem -File
ReNamer.exe /silent /rename Capitalize $capitalizeFiles
Wait-Process -Name "ReNamer"
}#>
Set-Location 'F:\Library\New'
foreach ($directory in Get-ChildItem -Directory -Recurse){
$directory.FullName
ReNamer.exe /silent /rename Capitalize $directory.FullName
Wait-Process -Name "ReNamer"
}
}
function moveSeries{
$serieLocationNames= @(
"Amory Wars"
"Batman"
"Borderlands"
"Brit"
"Clive Barker"
"Colder"
"Constantine"
"Critical Role"
"Dark Ark"
"Deadpool"
"Dicks"
"Ether"
"Fables"
"Grimm Fairy Tales"
"Guardians of the Galaxy"
"Gwenpool"
"Hack Slash"
"Harley Quinn"
"Hellboy"
"Hercules"
"Joker"
"Justice League"
"Kick-Ass"
"Lazarus"
"Lobo"
"Mad Max"
"Midnighter"
"Nailbiter"
"Pilot Season"
"Punisher"
"Rumble"
"Sonic"
"Star Wars"
"Suicide Squad"
"The Boys"
"The Last Zombie"
"The Realm"
"The Walking Dead"
"Thor"
"Transformers"
"Venom"
"Vikings"
"WWE"
"X-Men"
"Wolverine"
"Battle Angel Alita"
"Battle Through The Heavens"
"Boku No Hero Academia"
"Dr. Stone"
"Franken Fran"
"Kakegurui"
"Kami-Sama No Iutoori"
"Shaman King"
"Tensei Shitara Slime Datta Ken"
"Touhou"
)
foreach ($serieLocationName in $serieLocationNames){
$testPathComicLocation = 'F:\Library\New\Comic\' + $serieLocationName
$testPathMangaLocation = 'F:\Library\New\Manga\' + $serieLocationName
if(Test-Path $testPathComicLocation){
$files = Get-ChildItem -Path $testPathComicLocation
$newDir = $testPathComicLocation + '\' + $serieLocationName
if(!(Test-Path $newDir)){mkdir $newDir}
Move-Item $files $newDir
}
if(Test-Path $testPathMangaLocation){
$files = Get-ChildItem -Path $testPathMangaLocation
$newDir = $testPathMangaLocation + '\' + $serieLocationName
if(!(Test-Path $newDir)){mkdir $newDir}
Move-Item $files $newDir
}
}
}
Clear-Host
Capitalize
moveSeries