Sha256: 3a681078b2b0cd2c44682ae21a323692af3dc596fb79b8d4d4bab42ddda043a2
Contents?: true
Size: 927 Bytes
Versions: 1
Compression:
Stored size: 927 Bytes
Contents
require 'mp3info' require 'digest/sha1' module Dropcaster class Item attr_reader :file_name, :tag, :tag2, :duration, :file_size, :uuid, :pub_date, :pub_date, :lyrics attr_accessor :artist, :image_url, :url, :keywords def initialize(file_path, options = nil) Mp3Info.open(file_path){|mp3info| @file_name = Pathname.new(File.expand_path(file_path)).relative_path_from(Pathname.new(Dir.pwd)).cleanpath.to_s @tag = mp3info.tag @tag2 = mp3info.tag2 @duration = mp3info.length } @file_size = File.new(@file_name).stat.size @uuid = Digest::SHA1.hexdigest(File.read(file_name)) unless tag2.TDR.blank? @pub_date = DateTime.parse(tag2.TDR) else Dropcaster.logger.info("#{file_path} has no pub date set, using the file's modification time") @pub_date = DateTime.parse(File.new(file_name).mtime.to_s) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dropcaster-0.0.5.rc1 | lib/dropcaster/item.rb |