Class: BerkeleyLibrary::AV::Record

Inherits:
Object
  • Object
show all
Includes:
Util
Defined in:
lib/berkeley_library/av/record.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(collection:, tracks:, metadata:) ⇒ Record

TODO: stop passing in track list & just get it from metadata & collection



15
16
17
18
19
# File 'lib/berkeley_library/av/record.rb', line 15

def initialize(collection:, tracks:, metadata:)
  @collection = collection
  @tracks = tracks.sort
  @metadata = 
end

Instance Attribute Details

#collectionObject (readonly)

Returns the value of attribute collection.



12
13
14
# File 'lib/berkeley_library/av/record.rb', line 12

def collection
  @collection
end

#metadataObject (readonly)

Returns the value of attribute metadata.



12
13
14
# File 'lib/berkeley_library/av/record.rb', line 12

def 
  @metadata
end

#tracksObject (readonly)

Returns the value of attribute tracks.



12
13
14
# File 'lib/berkeley_library/av/record.rb', line 12

def tracks
  @tracks
end

Class Method Details

.from_metadata(collection:, record_id:) ⇒ Object

Loads the metadata for the specified record and creates a record object from it.

Note that for TIND records the record ID is not the TIND internal ID (MARC field 001) but rather the ID assigned by the UC Berkeley Library (MARC field 035).

Parameters:

  • collection (String)

    The collection name (Wowza application id).

  • record_id (String)

    The record ID.



76
77
78
79
80
81
82
83
# File 'lib/berkeley_library/av/record.rb', line 76

def (collection:, record_id:)
   = Metadata.for_record(record_id:)
  Record.new(
    collection:,
    metadata:,
    tracks: Track.tracks_from(.marc_record, collection:)
  )
end

Instance Method Details

#bib_numberObject



25
26
27
# File 'lib/berkeley_library/av/record.rb', line 25

def bib_number
  .bib_number
end

#calnet_only?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/berkeley_library/av/record.rb', line 41

def calnet_only?
  .calnet_only?
end

#calnet_or_ip?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/berkeley_library/av/record.rb', line 37

def calnet_or_ip?
  .calnet_or_ip?
end

#descriptionObject



63
64
65
# File 'lib/berkeley_library/av/record.rb', line 63

def description
  .description
end

#display_uriObject



59
60
61
# File 'lib/berkeley_library/av/record.rb', line 59

def display_uri
  .display_uri
end

#player_uriObject

TODO: is this needed?



55
56
57
# File 'lib/berkeley_library/av/record.rb', line 55

def player_uri
  @player_uri ||= URIs.append(AV::Config.avplayer_base_uri, collection, record_id)
end

#record_idObject



33
34
35
# File 'lib/berkeley_library/av/record.rb', line 33

def record_id
  .record_id
end

#tind_idObject



29
30
31
# File 'lib/berkeley_library/av/record.rb', line 29

def tind_id
  .tind_id
end

#titleObject



21
22
23
# File 'lib/berkeley_library/av/record.rb', line 21

def title
  .title
end

#type_labelObject



45
46
47
48
49
50
51
52
# File 'lib/berkeley_library/av/record.rb', line 45

def type_label
  @type_label ||= begin
    file_types = Set.new(tracks.map(&:file_type)).to_a.sort
    file_types = AV::Types::FileType.to_a if file_types.empty?

    file_types.map(&:label).join(' / ')
  end
end