summaryrefslogtreecommitdiffhomepage
path: root/musicSorter.rb
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2020-04-25 17:18:19 -0400
committerGitHub <[email protected]>2020-04-25 17:18:19 -0400
commit03e17ee820688cfe51513c4c7149463fb93726b1 (patch)
tree9a5495565511bfd77b7d27a052605403ad15e285 /musicSorter.rb
parent0169c548f9050252bb71980cb6e335d5020eb706 (diff)
downloadmusicSorter-03e17ee820688cfe51513c4c7149463fb93726b1.tar.gz
musicSorter-03e17ee820688cfe51513c4c7149463fb93726b1.zip
Cleaned up comments
Diffstat (limited to 'musicSorter.rb')
-rw-r--r--musicSorter.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/musicSorter.rb b/musicSorter.rb
index 61ee2f9..a7ec6d1 100644
--- a/musicSorter.rb
+++ b/musicSorter.rb
@@ -4,8 +4,9 @@ require 'fileutils'
#Code written by Tradam --> https://github.com/realtradam
-#Stores errors when reading tags
+#Stores errors that happen
errors = Array.new
+#Characters that are removed from the file/folder names as they are considered illegal in Windows
illegalCharacter = Array['/', '?', '\\', ':', '*', '"', '<', '>', '|']
#All extensions you want considered and moved
@@ -17,7 +18,7 @@ for extension in fileExtensions
songData = FFruby::File.new(song)
#Checks if any of the fields are not filled out
- #If they arent, save the song to an error log and skip it
+ #If they arent, save the song to an error log and skip it, except for track number
if songData.title == nil
errors.push("ERROR, TITLE IS NIL FOR: " + song)
next
@@ -46,6 +47,7 @@ for extension in fileExtensions
album = songData.album
track = songData.track.to_s.split('/')[0]
+ #Purges illegal characters
for character in illegalCharacter
title = title.delete character
genre = genre.delete character
@@ -91,7 +93,7 @@ for extension in fileExtensions
Dir.mkdir(songFolderGenre + songFolderArtist + songFolderAlbum)
FileUtils.mv song, songFolderGenre + songFolderArtist + songFolderAlbum + songFileName
end
- rescue Errno::ENOENT
+ rescue Errno::ENOENT#Incase the program tries to save to a folder not yet created, shouldnt ever happen
errors.push("ERROR, FILE OR FOLDER NAME ERROR AT " + song)
next
end