Last active
January 7, 2016 17:45
-
-
Save nycdavid/bcd28c6c0e31a502331b to your computer and use it in GitHub Desktop.
ProjectFolderGenerator class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "csv" | |
| require "fileutils" | |
| TYPES = ["Instrumental", "Vocal"] | |
| GENRES = [ | |
| "Ambient", "Americana", "Blues", "Childrens", "Classical", | |
| "Country", "Disco", "Easy Listening", "Electronica", "Folk", | |
| "Funk", "Gospel", "Hip Hop", "Holiday", "Jazz", "Latin", | |
| "Lounge", "None", "Orchestral", "Pop", "R&B", "Reggae", | |
| "Rock", "SFX", "Ska", "World" | |
| ] | |
| MOODS = [ | |
| "Aggressive", "Ambient", "Determined", "Dramatic", "Edgy", | |
| "Happy", "Laid Back", "Melancholic", "None", "Positive", | |
| "Quirky", "Reflective", "Sensual", "Sentimental", "Suspenseful", | |
| "Tragic", "Triumphant", "Unsettling" | |
| ] | |
| module Avid | |
| class FolderGenerator | |
| def initialize(generation_path) | |
| @folder_combinations = TYPES.product(GENRES, MOODS) | |
| @generation_path = generation_path # Always give it a leading slash | |
| end | |
| end | |
| class ProjectFolderGenerator < FolderGenerator | |
| def generate | |
| @folder_combinations.each do |combo| | |
| path = "#{@generation_path}#{combo[0..1].join("/")}" | |
| FileUtils.mkdir_p path unless Dir.exist? path | |
| end | |
| end | |
| end | |
| class MediaFolderGenerator < FolderGenerator | |
| def generate | |
| @folder_combinations.each do |combo| | |
| path = "#{@generation_path}#{combo.join('/')}" | |
| FileUtils.mkdir_p path unless Dir.exist? path | |
| end | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment