-
Notifications
You must be signed in to change notification settings - Fork 0
/
Run.ps1
72 lines (55 loc) · 2.04 KB
/
Run.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#--------------------------------------------------#
# NotAYTMusic PS Script
#
# This script does makes a video from audio-file
# and picture by using FFMpeg and powershell-taglib.
# This can be used to recreate music album as video
# for simulating YT Music
#
# You will need to install powershell-taglib
# https://github.com/illearth/powershell-taglib
#
# ...and add ffmpeg to enviroment variable "path"
#
# Author: Veselcraft
#
# 2020
#--------------------------------------------------#
Import-Module taglib
$path = Read-Host -Prompt 'Type the path to the album (like D:\music\Autechre\Amber\ )'
$label = Read-Host -Prompt 'Music label (if exists)'
$filter = '*.mp3'
$files = Get-ChildItem -Path $path -Filter $filter | Where-Object { (-not $_.PSIsContainer) }
$alias = "[NotAYTMusic]"
Echo "$alias Searching for album cover"
$coverfilename = ""
foreach ($cover in Get-ChildItem -Path "$path*" -Include *.jpg, *.jpeg, *.png | Where-Object { (-not $_.PSIsContainer) }){
$coverfilename = $cover.Name
Echo "$alias Found $coverfilename!"
}
if([string]::IsNullOrEmpty($coverfilename)){
Echo "$alias Seems like you don't have any .jpg, .jpeg or .png file to make vid. Exiting."
}else{
foreach ($filename in $files){
$media = [TagLib.File]::Create(($path+$filename))
$title = $media.Tag.Title
$artist = $media.Tag.Artists
$album = $media.Tag.Album
$year = $media.Tag.Year
if([string]::IsNullOrEmpty($label)) {
$label = $artist
}
$desc = "Provided to YouTube by rutracker
$title · $artist
$album
℗ $label
Released on: $year
Auto-generated by NotAYTMusic."
Out-File -FilePath "$path$title.txt" -InputObject $desc -Encoding utf8
Echo "$alias [$title] Description file for description is generated"
Echo "$alias [$title] Begin to generate the video"
ffmpeg -loop 1 -y -i $path$coverfilename -i $path$filename -shortest -acodec aac -vcodec h264 "$path$title.mp4"
Echo "$alias [$title] Done!"
}
Echo "$alias Everything is done. Exiting"
}