aboutsummaryrefslogtreecommitdiffstats
path: root/lib/seventy_eights/record.rb
blob: 2abbb69907b95a3aa829436bb9744a9151263238 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require 'nokogiri'
require 'open-uri'

module SeventyEights
  class Record
    attr_reader :title, :artist, :label, :catalog, :url

    def initialize(title, artist, label, catalog, url)
      @title, @artist, @label, @catalog, @url = title, artist, label, catalog, url
    end

    def to_filename
      "#{safe @title} - #{safe @artist} - #{safe @label} - #{safe @catalog}.mp3"
    end

    private

    def safe(str)
      str.gsub('/', '-')
    end
  end
end