aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2025-11-16 12:47:23 +0100
committerEugen Wissner <belka@caraus.de>2025-11-16 12:47:23 +0100
commita3530666a60dd004fe2c28bb87fbabdf5e5bebab (patch)
tree6fb162130eac52f948757e2c4975d7669fe0e49d /bin
parent964d815a90a78c0ebbfc2fa57f8b847c1fab298d (diff)
downloadkazbek-a3530666a60dd004fe2c28bb87fbabdf5e5bebab.tar.gz
7digital.rb: Support MissingFiles.txt
Diffstat (limited to 'bin')
-rwxr-xr-xbin/7digital.rb14
-rwxr-xr-xbin/cross_toolchain.rb2
-rwxr-xr-xbin/mock_server.rb2
-rwxr-xr-xbin/pg_jekyll.rb2
-rwxr-xr-xbin/read_logs.rb2
-rwxr-xr-xbin/rename.rb2
6 files changed, 15 insertions, 9 deletions
diff --git a/bin/7digital.rb b/bin/7digital.rb
index fc90823..0fb894e 100755
--- a/bin/7digital.rb
+++ b/bin/7digital.rb
@@ -1,13 +1,12 @@
#!/usr/bin/env ruby
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
-# obtain one at https://mozilla.org/MPL/2.0/. -}
+# obtain one at https://mozilla.org/MPL/2.0/.
# frozen_string_literal: true
require 'pathname'
require 'open3'
-require 'optparse'
require 'zip'
# Renames music files in a directory according to the file's tags.
@@ -38,7 +37,6 @@ end
def extract_and_rename_archive(album_archive, music_directory)
music_directory.mkpath
- artist_name, album_name = album_archive.basename('.zip').to_s.split(' - ')
Zip::File.open album_archive.to_path do |zip_file|
zip_file.each do |entry|
@@ -78,6 +76,7 @@ unless ARGV.length == 2
exit 1
end
+exit_code = 0
album_archive = Pathname.new ARGV[0]
music_directory = Pathname.new ARGV[1]
metadata = {}
@@ -87,7 +86,12 @@ extract_and_rename_archive album_archive, music_directory
Dir.each_child music_directory do |filename|
song_path = music_directory + filename
- metadata[song_path] = probe_song(song_path)
+ if filename == 'MissingFiles.txt'
+ IO.copy_stream File.open(song_path, 'r'), $stderr
+ exit_code = 2
+ else
+ metadata[song_path] = probe_song(song_path)
+ end
end
metadata.each_pair do |from, to|
@@ -96,3 +100,5 @@ metadata.each_pair do |from, to|
album_path.mkpath
File.rename(from, album_path + to.to_s)
end
+
+exit exit_code
diff --git a/bin/cross_toolchain.rb b/bin/cross_toolchain.rb
index 42b1865..29645c5 100755
--- a/bin/cross_toolchain.rb
+++ b/bin/cross_toolchain.rb
@@ -1,7 +1,7 @@
#!/usr/bin/env ruby
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
-# obtain one at https://mozilla.org/MPL/2.0/. -}
+# obtain one at https://mozilla.org/MPL/2.0/.
# frozen_string_literal: true
diff --git a/bin/mock_server.rb b/bin/mock_server.rb
index 09f6b91..b33eac6 100755
--- a/bin/mock_server.rb
+++ b/bin/mock_server.rb
@@ -1,7 +1,7 @@
#!/usr/bin/env ruby
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
-# obtain one at https://mozilla.org/MPL/2.0/. -}
+# obtain one at https://mozilla.org/MPL/2.0/.
# frozen_string_literal: true
diff --git a/bin/pg_jekyll.rb b/bin/pg_jekyll.rb
index ed2ac3b..464dcf9 100755
--- a/bin/pg_jekyll.rb
+++ b/bin/pg_jekyll.rb
@@ -1,7 +1,7 @@
#!/usr/bin/env ruby
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
-# obtain one at https://mozilla.org/MPL/2.0/. -}
+# obtain one at https://mozilla.org/MPL/2.0/.
# frozen_string_literal: true
diff --git a/bin/read_logs.rb b/bin/read_logs.rb
index b53760f..cf4011b 100755
--- a/bin/read_logs.rb
+++ b/bin/read_logs.rb
@@ -1,7 +1,7 @@
#!/usr/bin/env ruby
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
-# obtain one at https://mozilla.org/MPL/2.0/. -}
+# obtain one at https://mozilla.org/MPL/2.0/.
# frozen_string_literal: true
diff --git a/bin/rename.rb b/bin/rename.rb
index 654f220..1188653 100755
--- a/bin/rename.rb
+++ b/bin/rename.rb
@@ -1,7 +1,7 @@
#!/usr/bin/env ruby
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
-# obtain one at https://mozilla.org/MPL/2.0/. -}
+# obtain one at https://mozilla.org/MPL/2.0/.
# frozen_string_literal: true