-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathYouTubeChannelToInfinity.rb
More file actions
executable file
·54 lines (39 loc) · 1.49 KB
/
Copy pathYouTubeChannelToInfinity.rb
File metadata and controls
executable file
·54 lines (39 loc) · 1.49 KB
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
# encoding: UTF-8
require_relative "Libs/loader.rb"
=begin
yt-dlp \
-o '%(upload_date)s-%(title)s-%(id)s.%(ext)s' \
-f 'bestvideo[height<=720]+bestaudio/best[height<=720]' \
"https://www.youtube.com/@veritasium/videos"
=end
youTubeURL = "https://www.youtube.com/@jomakaze/videos"
tmpDirectoryName = SecureRandom.hex(5)
puts "Downloading videos"
query = <<-QUERY
mkdir /Users/pascal/Desktop/#{tmpDirectoryName}
cd /Users/pascal/Desktop/#{tmpDirectoryName}
yt-dlp \
-o '%(upload_date)s-%(title)s-%(id)s.%(ext)s' \
-f 'bestvideo[height<=720]+bestaudio/best[height<=720]' \
"#{youTubeURL}"
QUERY
system(query)
raise "This script needs updating, we are no longer using global-positioning-4233 or parentuuid-0014"
positions = []
insertions = positions.zip(positions.drop(1))
.select{|pair| pair.compact.size == 2 }
.map{|pair| 0.5 * (pair[0] + pair[1]) }
.drop(10) # we skip the first 10 positions
filepaths = LucilleCore::locationsAtFolder("/Users/pascal/Desktop/#{tmpDirectoryName}")
while insertions.size < filepaths.size do
insertions << insertions.last + 1
end
coordinates = filepaths.zip(insertions)
coordinates.each{|filepath, position|
item = NxTasks::locationToTask(File.basename(filepath), filepath)
Items::setAttribute(item["uuid"], "global-positioning-4233", position)
item = Items::itemOrNull(item["uuid"])
puts JSON.pretty_generate(item)
}
LucilleCore::removeFileSystemLocation("/Users/pascal/Desktop/#{tmpDirectoryName}")
puts "process completed"