sufia-models 4.0.0.beta2 → 4.0.0.beta3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/app/actors/sufia/generic_file/actor.rb +118 -0
  3. data/app/models/batch.rb +3 -3
  4. data/app/models/checksum_audit_log.rb +3 -3
  5. data/app/models/collection.rb +41 -0
  6. data/{lib/sufia/models → app/models/concerns/sufia}/generic_file.rb +33 -43
  7. data/{lib/sufia/models → app/models/concerns/sufia}/generic_file/accessible_attributes.rb +3 -3
  8. data/{lib/sufia/models → app/models/concerns/sufia}/generic_file/audit.rb +12 -18
  9. data/{lib/sufia/models → app/models/concerns/sufia}/generic_file/characterization.rb +1 -8
  10. data/app/models/concerns/sufia/generic_file/derivatives.rb +26 -0
  11. data/{lib/sufia/models → app/models/concerns/sufia}/generic_file/export.rb +13 -13
  12. data/{lib/sufia/models → app/models/concerns/sufia}/generic_file/featured.rb +0 -0
  13. data/{lib/sufia/models → app/models/concerns/sufia}/generic_file/metadata.rb +0 -0
  14. data/{lib/sufia/models → app/models/concerns/sufia}/generic_file/mime_types.rb +15 -1
  15. data/{lib/sufia/models → app/models/concerns/sufia}/generic_file/permissions.rb +5 -1
  16. data/{lib/sufia/models → app/models/concerns/sufia}/generic_file/reload_on_save.rb +0 -0
  17. data/{lib/sufia/models → app/models/concerns/sufia}/generic_file/trophies.rb +0 -0
  18. data/app/models/concerns/sufia/generic_file/versions.rb +16 -0
  19. data/{lib/sufia/models → app/models/concerns/sufia}/generic_file/virus_check.rb +2 -3
  20. data/{lib/sufia/models → app/models/concerns/sufia}/generic_file/web_form.rb +9 -2
  21. data/app/models/concerns/sufia/properties_datastream_behavior.rb +3 -4
  22. data/app/models/concerns/sufia/user.rb +2 -2
  23. data/app/models/datastreams/fits_datastream.rb +137 -136
  24. data/app/models/datastreams/generic_file_rdf_datastream.rb +6 -0
  25. data/app/models/datastreams/paranoid_rights_datastream.rb +3 -3
  26. data/app/models/file_usage.rb +53 -0
  27. data/app/models/follow.rb +2 -4
  28. data/app/models/geo_names_resource.rb +5 -7
  29. data/app/models/local_authority.rb +14 -14
  30. data/app/models/single_use_link.rb +1 -1
  31. data/app/models/sufia/download.rb +9 -0
  32. data/app/models/trophy.rb +1 -1
  33. data/app/services/sufia/{usage_statistics.rb → analytics.rb} +1 -24
  34. data/app/services/sufia/id_service.rb +2 -2
  35. data/lib/generators/sufia/models/install_generator.rb +5 -2
  36. data/lib/generators/sufia/models/templates/config/setup_mail.rb +1 -1
  37. data/lib/generators/sufia/models/templates/config/sufia.rb +5 -3
  38. data/lib/generators/sufia/models/templates/migrations/acts_as_follower_migration.rb +6 -6
  39. data/lib/generators/sufia/models/templates/migrations/create_checksum_audit_logs.rb +2 -3
  40. data/lib/generators/sufia/models/templates/migrations/create_local_authorities.rb +20 -20
  41. data/lib/sufia/ability.rb +1 -1
  42. data/lib/sufia/models/engine.rb +3 -9
  43. data/lib/sufia/models/file_content/versions.rb +3 -3
  44. data/lib/sufia/models/jobs/active_fedora_pid_based_job.rb +6 -2
  45. data/lib/sufia/models/jobs/batch_update_job.rb +6 -10
  46. data/lib/sufia/models/jobs/characterize_job.rb +1 -13
  47. data/lib/sufia/models/jobs/create_derivatives_job.rb +14 -0
  48. data/lib/sufia/models/jobs/import_url_job.rb +27 -23
  49. data/lib/sufia/models/version.rb +1 -1
  50. data/lib/tasks/sufia-models_tasks.rake +1 -1
  51. data/sufia-models.gemspec +1 -1
  52. metadata +65 -64
  53. data/lib/sufia/models/generic_file/actions.rb +0 -50
  54. data/lib/sufia/models/generic_file/derivatives.rb +0 -31
  55. data/lib/sufia/models/generic_file/thumbnail.rb +0 -37
  56. data/lib/sufia/models/generic_file/versions.rb +0 -16
  57. data/lib/sufia/models/jobs/transcode_audio_job.rb +0 -15
  58. data/lib/sufia/models/jobs/transcode_video_job.rb +0 -15
  59. data/lib/sufia/models/solr_document_behavior.rb +0 -118
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0bc499ef1c7cbf4fe681e9100f2b46bb7ace0a77
4
- data.tar.gz: 90aa258a254bb929ab5631e96d253a42509f8c1e
3
+ metadata.gz: 63a65dabcbadf31012b903126436b9a24b8ee4ea
4
+ data.tar.gz: cab66737a44fe6bea825acdfbc8a38c4fbd679c8
5
5
  SHA512:
6
- metadata.gz: 5cc9ac7548fa1270e2a8c0a8fdf7100b7792978c946f8d5fe3ab190db32db42ef5f7f150993aa47beea7379567c433423680381379a22a5c93eab11f4b6cfa75
7
- data.tar.gz: 6f2aa0666ec2b61c65711666712c77cc0796875519690eb225c0acb766a090f22dde459f0d1f3772eaa0ed5b8dbf912b7eeaf8889d26d72e376cf1118ab3cb9a
6
+ metadata.gz: a82f963bd402cac50068911c17d906578534710f39a5b070fae36fec7db886f2511b8d564eedcc3a2573472abeef10298e6c21464d8676b0bed4503744b30074
7
+ data.tar.gz: fb673e84039480923a9d400814a48c59fd7d55bcd6bc3ea13e1db30a6269ee677544e23d84a9d73d5997c58dccb429cdb3e941d6d160dc7bade36d1bb2a619f3
@@ -0,0 +1,118 @@
1
+ module Sufia::GenericFile
2
+ # Actions are decoupled from controller logic so that they may be called from a controller or a background job.
3
+ class Actor
4
+
5
+ attr_reader :generic_file, :user
6
+
7
+ def initialize(generic_file, user)
8
+ @generic_file = generic_file
9
+ @user = user
10
+ end
11
+
12
+ # in order to avoid two saves in a row, create_metadata does not save the file by default.
13
+ # it is typically used in conjunction with create_content, which does do a save.
14
+ # If you want to save when using create_metadata, you can do this:
15
+ # create_metadata(batch_id) { |gf| gf.save }
16
+ def create_metadata(batch_id)
17
+ generic_file.apply_depositor_metadata(user)
18
+ generic_file.date_uploaded = Date.today
19
+ generic_file.date_modified = Date.today
20
+ generic_file.creator = user.name
21
+
22
+ if batch_id
23
+ generic_file.add_relationship("isPartOf", "info:fedora/#{Sufia::Noid.namespaceize(batch_id)}")
24
+ else
25
+ logger.warn "unable to find batch to attach to"
26
+ end
27
+ yield(generic_file) if block_given?
28
+ end
29
+
30
+ def create_content(file, file_name, dsid)
31
+ generic_file.add_file(file, dsid, file_name)
32
+ save_characterize_and_record_committer do
33
+ if Sufia.config.respond_to?(:after_create_content)
34
+ Sufia.config.after_create_content.call(generic_file, user)
35
+ end
36
+ end
37
+ end
38
+
39
+ def revert_content(revision_id, datastream_id)
40
+ revision = generic_file.content.get_version(revision_id)
41
+ generic_file.add_file(revision.content, datastream_id, revision.label)
42
+ save_characterize_and_record_committer do
43
+ if Sufia.config.respond_to?(:after_revert_content)
44
+ Sufia.config.after_revert_content.call(generic_file, user, revision_id)
45
+ end
46
+ end
47
+ end
48
+
49
+ def update_content(file, datastream_id)
50
+ generic_file.add_file(file, datastream_id, file.original_filename)
51
+ save_characterize_and_record_committer do
52
+ if Sufia.config.respond_to?(:after_update_content)
53
+ Sufia.config.after_update_content.call(generic_file, user)
54
+ end
55
+ end
56
+ end
57
+
58
+ def update_metadata(attributes, visibility)
59
+ generic_file.attributes = generic_file.sanitize_attributes(attributes)
60
+ generic_file.visibility = visibility
61
+ generic_file.date_modified = DateTime.now
62
+ save_and_record_committer do
63
+ if Sufia.config.respond_to?(:after_update_metadata)
64
+ Sufia.config.after_update_metadata.call(generic_file, user)
65
+ end
66
+ end
67
+ end
68
+
69
+ def destroy
70
+ pid = generic_file.pid #Work around for https://github.com/projecthydra/active_fedora/issues/422
71
+ generic_file.destroy
72
+ if Sufia.config.respond_to?(:after_destroy)
73
+ Sufia.config.after_destroy.call(pid, user)
74
+ end
75
+ end
76
+
77
+ # Takes an optional block and executes the block if the save was successful.
78
+ def save_characterize_and_record_committer
79
+ save_and_record_committer { push_characterize_job }.tap do |val|
80
+ yield if block_given? && val
81
+ end
82
+ end
83
+
84
+ # Takes an optional block and executes the block if the save was successful.
85
+ def save_and_record_committer
86
+ save_tries = 0
87
+ begin
88
+ return false unless generic_file.save
89
+ rescue RSolr::Error::Http => error
90
+ logger.warn "Sufia::GenericFile::Actor::save_and_record_committer Caught RSOLR error #{error.inspect}"
91
+ save_tries+=1
92
+ # fail for good if the tries is greater than 3
93
+ raise error if save_tries >=3
94
+ sleep 0.01
95
+ retry
96
+ end
97
+ yield if block_given?
98
+ generic_file.record_version_committer(user)
99
+ true
100
+ end
101
+
102
+ def push_characterize_job
103
+ Sufia.queue.push(CharacterizeJob.new(@generic_file.pid))
104
+ end
105
+
106
+ class << self
107
+ def virus_check(file)
108
+ path = file.is_a?(String) ? file : file.path
109
+ unless defined?(ClamAV)
110
+ logger.warn "Virus checking disabled, #{path} not checked"
111
+ return
112
+ end
113
+ scan_result = ClamAV.instance.scanfile(path)
114
+ raise Sufia::VirusFoundError.new("A virus was found in #{path}: #{scan_result}") unless scan_result == 0
115
+ end
116
+ end
117
+ end
118
+ end
@@ -3,10 +3,10 @@ class Batch < ActiveFedora::Base
3
3
  include Sufia::ModelMethods
4
4
  include Sufia::Noid
5
5
 
6
- has_metadata :name => "descMetadata", :type => BatchRdfDatastream
6
+ has_metadata name: "descMetadata", type: BatchRdfDatastream
7
7
 
8
- belongs_to :user, :property => "creator"
9
- has_many :generic_files, :property => :is_part_of
8
+ belongs_to :user, property: "creator"
9
+ has_many :generic_files, property: :is_part_of
10
10
 
11
11
  has_attributes :title, :creator, :part, :status, datastream: :descMetadata, multiple: true
12
12
 
@@ -1,9 +1,9 @@
1
1
  class ChecksumAuditLog < ActiveRecord::Base
2
2
 
3
3
  def ChecksumAuditLog.get_audit_log(version)
4
- ChecksumAuditLog.find_or_create_by_pid_and_dsid_and_version(:pid => version.pid,
5
- :dsid => version.dsid,
6
- :version => version.versionID)
4
+ ChecksumAuditLog.find_or_create_by_pid_and_dsid_and_version(pid: version.pid,
5
+ dsid: version.dsid,
6
+ version: version.versionID)
7
7
  end
8
8
 
9
9
  def ChecksumAuditLog.prune_history(version)
@@ -0,0 +1,41 @@
1
+ class Collection < ActiveFedora::Base
2
+ include Hydra::Collection
3
+ include Sufia::ModelMethods
4
+ include Sufia::Noid
5
+ include Sufia::GenericFile::Permissions
6
+ include Sufia::GenericFile::WebForm # provides initialize_fields method
7
+
8
+ before_save :update_permissions
9
+ validates :title, presence: true
10
+
11
+ has_metadata "properties", type: PropertiesDatastream
12
+
13
+ def terms_for_display
14
+ [:title, :creator, :description, :date_modified, :date_uploaded]
15
+ end
16
+
17
+ def terms_for_editing
18
+ terms_for_display - [:date_modified, :date_uploaded]
19
+ end
20
+
21
+ # Test to see if the given field is required
22
+ # @param [Symbol] key a field
23
+ # @return [Boolean] is it required or not
24
+ def required?(key)
25
+ self.class.validators_on(key).any?{|v| v.kind_of? ActiveModel::Validations::PresenceValidator}
26
+ end
27
+
28
+ def to_param
29
+ noid
30
+ end
31
+
32
+ def to_solr(solr_doc={}, opts={})
33
+ super(solr_doc, opts)
34
+ solr_doc[Solrizer.solr_name("noid", Sufia::GenericFile.noid_indexer)] = noid
35
+ return solr_doc
36
+ end
37
+
38
+ def update_permissions
39
+ self.visibility = "open"
40
+ end
41
+ end
@@ -3,21 +3,9 @@ module Sufia
3
3
 
4
4
  module GenericFile
5
5
  extend ActiveSupport::Concern
6
- extend ActiveSupport::Autoload
7
- autoload :Actions, 'sufia/models/generic_file/actions'
8
- autoload :Permissions, 'sufia/models/generic_file/permissions'
9
- autoload :WebForm, 'sufia/models/generic_file/web_form'
10
- autoload :AccessibleAttributes, 'sufia/models/generic_file/accessible_attributes'
11
- autoload :Trophies, 'sufia/models/generic_file/trophies'
12
- autoload :Featured, 'sufia/models/generic_file/featured'
13
- autoload :Metadata, 'sufia/models/generic_file/metadata'
14
- autoload :Versions, 'sufia/models/generic_file/versions'
15
- autoload :VirusCheck, 'sufia/models/generic_file/virus_check'
16
- autoload :ReloadOnSave, 'sufia/models/generic_file/reload_on_save'
17
6
  include Sufia::ModelMethods
18
7
  include Sufia::Noid
19
8
  include Sufia::GenericFile::MimeTypes
20
- include Sufia::GenericFile::Thumbnail
21
9
  include Sufia::GenericFile::Export
22
10
  include Sufia::GenericFile::Characterization
23
11
  include Sufia::GenericFile::Audit
@@ -30,13 +18,14 @@ module Sufia
30
18
  include Sufia::GenericFile::Versions
31
19
  include Sufia::GenericFile::VirusCheck
32
20
  include Sufia::GenericFile::ReloadOnSave
21
+ include Hydra::Collections::Collectible
33
22
 
34
23
  included do
35
- belongs_to :batch, :property => :is_part_of
24
+ belongs_to :batch, property: :is_part_of
36
25
 
37
- around_save :characterize_if_changed, :retry_warming
26
+ around_save :retry_warming
38
27
 
39
- attr_accessible *(ds_specs['descMetadata'][:type].fields + [:permissions])
28
+ attr_accessible *(terms_for_display + [:part_of, :permissions])
40
29
  end
41
30
 
42
31
  def persistent_url
@@ -44,34 +33,34 @@ module Sufia
44
33
  end
45
34
 
46
35
  def retry_warming
47
- save_tries = 0
48
- conflict_tries = 0
49
- begin
50
- yield
51
- rescue RSolr::Error::Http => error
52
- save_tries += 1
53
- logger.warn "Retry Solr caught RSOLR error on #{self.pid}: #{error.inspect}"
54
- # fail for good if the tries is greater than 3
55
- raise if save_tries >=3
56
- sleep 0.01
57
- retry
58
- rescue ActiveResource::ResourceConflict => error
36
+ save_tries = 0
37
+ conflict_tries = 0
38
+ begin
39
+ yield
40
+ rescue RSolr::Error::Http => error
41
+ save_tries += 1
42
+ logger.warn "Retry Solr caught RSOLR error on #{self.pid}: #{error.inspect}"
43
+ # fail for good if the tries is greater than 3
44
+ raise if save_tries >=3
45
+ sleep 0.01
46
+ retry
47
+ rescue ActiveResource::ResourceConflict => error
48
+ conflict_tries += 1
49
+ logger.warn "Retry caught Active Resource Conflict #{self.pid}: #{error.inspect}"
50
+ raise if conflict_tries >=10
51
+ sleep 0.01
52
+ retry
53
+ rescue => error
54
+ if error.to_s.downcase.include? "conflict"
59
55
  conflict_tries += 1
60
56
  logger.warn "Retry caught Active Resource Conflict #{self.pid}: #{error.inspect}"
61
57
  raise if conflict_tries >=10
62
58
  sleep 0.01
63
59
  retry
64
- rescue =>error
65
- if (error.to_s.downcase.include? "conflict")
66
- conflict_tries += 1
67
- logger.warn "Retry caught Active Resource Conflict #{self.pid}: #{error.inspect}"
68
- raise if conflict_tries >=10
69
- sleep 0.01
70
- retry
71
- else
72
- raise
73
- end
60
+ else
61
+ raise
74
62
  end
63
+ end
75
64
  end
76
65
 
77
66
  # Get the files with a sibling relationship (belongs_to :batch)
@@ -99,12 +88,13 @@ module Sufia
99
88
  end
100
89
 
101
90
  def to_solr(solr_doc={}, opts={})
102
- solr_doc = super(solr_doc, opts)
103
- solr_doc[Solrizer.solr_name('label')] = self.label
104
- solr_doc[Solrizer.solr_name('noid', Sufia::GenericFile.noid_indexer)] = noid
105
- solr_doc[Solrizer.solr_name('file_format')] = file_format
106
- solr_doc[Solrizer.solr_name('file_format', :facetable)] = file_format
107
- return solr_doc
91
+ super(solr_doc, opts).tap do |solr_doc|
92
+ solr_doc[Solrizer.solr_name('label')] = self.label
93
+ solr_doc[Solrizer.solr_name('noid', Sufia::GenericFile.noid_indexer)] = noid
94
+ solr_doc[Solrizer.solr_name('file_format')] = file_format
95
+ solr_doc[Solrizer.solr_name('file_format', :facetable)] = file_format
96
+ solr_doc = index_collection_pids(solr_doc)
97
+ end
108
98
  end
109
99
 
110
100
  # Redefine this for more intuitive keys in Redis
@@ -41,7 +41,7 @@ module Sufia
41
41
  # attr_accessor :name, :credit_rating
42
42
  #
43
43
  # attr_accessible :name
44
- # attr_accessible :name, :credit_rating, :as => :admin
44
+ # attr_accessible :name, :credit_rating, as: :admin
45
45
  #
46
46
  # def assign_attributes(values, options = {})
47
47
  # sanitize_for_mass_assignment(values, options[:as]).each do |k, v|
@@ -53,7 +53,7 @@ module Sufia
53
53
  # When using the :default role:
54
54
  #
55
55
  # customer = Customer.new
56
- # customer.assign_attributes({ "name" => "David", "credit_rating" => "Excellent", :last_login => 1.day.ago }, :as => :default)
56
+ # customer.assign_attributes({ "name" => "David", "credit_rating" => "Excellent", last_login: 1.day.ago }, as: :default)
57
57
  # customer.name # => "David"
58
58
  # customer.credit_rating # => nil
59
59
  #
@@ -63,7 +63,7 @@ module Sufia
63
63
  # And using the :admin role:
64
64
  #
65
65
  # customer = Customer.new
66
- # customer.assign_attributes({ "name" => "David", "credit_rating" => "Excellent", :last_login => 1.day.ago }, :as => :admin)
66
+ # customer.assign_attributes({ "name" => "David", "credit_rating" => "Excellent", last_login: 1.day.ago }, as: :admin)
67
67
  # customer.name # => "David"
68
68
  # customer.credit_rating # => "Excellent"
69
69
  #
@@ -24,7 +24,7 @@ module Sufia
24
24
  end
25
25
 
26
26
  def logs(dsid)
27
- ChecksumAuditLog.where(:dsid=>dsid, :pid=>self.pid).order('created_at desc, id desc')
27
+ ChecksumAuditLog.where(dsid: dsid, pid: self.pid).order('created_at desc, id desc')
28
28
  end
29
29
 
30
30
  def audit!
@@ -40,19 +40,18 @@ module Sufia
40
40
  audit_results = logs.collect { |result| result["pass"] }
41
41
 
42
42
  # check how many non runs we had
43
- non_runs =audit_results.reduce(0) { |sum, value| (value == NO_RUNS) ? sum = sum+1 : sum }
44
- if (non_runs == 0)
45
- result =audit_results.reduce(true) { |sum, value| sum && value }
43
+ non_runs = audit_results.reduce(0) { |sum, value| value == NO_RUNS ? sum += 1 : sum }
44
+ if non_runs == 0
45
+ result = audit_results.reduce(true) { |sum, value| sum && value }
46
46
  return result
47
- elsif (non_runs < audit_results.length)
48
- result =audit_results.reduce(true) { |sum, value| (value == NO_RUNS) ? sum : sum && value }
47
+ elsif non_runs < audit_results.length
48
+ result = audit_results.reduce(true) { |sum, value| value == NO_RUNS ? sum : sum && value }
49
49
  return 'Some audits have not been run, but the ones run were '+ ((result)? 'passing' : 'failing') + '.'
50
50
  else
51
51
  return 'Audits have not yet been run on this file.'
52
52
  end
53
53
  end
54
54
 
55
-
56
55
  module ClassMethods
57
56
  def audit!(version)
58
57
  ::GenericFile.audit(version, true)
@@ -68,24 +67,20 @@ module Sufia
68
67
 
69
68
  # run the find just incase the job has finished already
70
69
  latest_audit = self.find(version.pid).logs(version.dsid).first
71
- latest_audit = ChecksumAuditLog.new(:pass=>NO_RUNS, :pid=>version.pid, :dsid=>version.dsid, :version=>version.versionID) unless latest_audit
72
- return latest_audit
70
+ latest_audit = ChecksumAuditLog.new(pass: NO_RUNS, pid: version.pid, dsid: version.dsid, version: version.versionID) unless latest_audit
71
+ latest_audit
73
72
  end
74
73
 
75
74
  def needs_audit?(version, latest_audit)
76
75
  if latest_audit and latest_audit.updated_at
77
- #logger.debug "***AUDIT*** last audit = #{latest_audit.updated_at.to_date}"
78
76
  days_since_last_audit = (DateTime.now - latest_audit.updated_at.to_date).to_i
79
- #logger.debug "***AUDIT*** days since last audit: #{days_since_last_audit}"
80
77
  if days_since_last_audit < Sufia.config.max_days_between_audits
81
- #logger.debug "***AUDIT*** No audit needed for #{version.pid} #{version.versionID} (#{latest_audit.updated_at})"
82
78
  return false
83
79
  end
84
80
  else
85
81
  logger.warn "***AUDIT*** problem with audit log! Latest Audit is not nil, but updated_at is not set #{latest_audit}" unless latest_audit.nil?
86
82
  end
87
- #logger.info "***AUDIT*** Audit needed for #{version.pid} #{version.versionID}"
88
- return true
83
+ true
89
84
  end
90
85
 
91
86
  def audit_everything(force = false)
@@ -102,16 +97,15 @@ module Sufia
102
97
 
103
98
  def run_audit(version)
104
99
  if version.dsChecksumValid
105
- #logger.info "***AUDIT*** Audit passed for #{version.pid} #{version.versionID}"
106
100
  passing = 1
107
101
  ChecksumAuditLog.prune_history(version)
108
102
  else
109
103
  logger.warn "***AUDIT*** Audit failed for #{version.pid} #{version.versionID}"
110
104
  passing = 0
111
105
  end
112
- check = ChecksumAuditLog.create!(:pass=>passing, :pid=>version.pid,
113
- :dsid=>version.dsid, :version=>version.versionID)
114
- return check
106
+ check = ChecksumAuditLog.create!(pass: passing, pid: version.pid,
107
+ dsid: version.dsid, version: version.versionID)
108
+ check
115
109
  end
116
110
  end
117
111
  end
@@ -3,7 +3,7 @@ module Sufia
3
3
  module Characterization
4
4
  extend ActiveSupport::Concern
5
5
  included do
6
- has_metadata "characterization", :type => FitsDatastream
6
+ has_metadata "characterization", type: FitsDatastream
7
7
  has_attributes :mime_type, datastream: :characterization, multiple: false
8
8
  has_attributes :format_label, :file_size, :last_modified,
9
9
  :filename, :original_checksum, :rights_basis,
@@ -40,12 +40,6 @@ module Sufia
40
40
  characterization.sample_rate.blank? ? characterization.video_sample_rate : characterization.sample_rate
41
41
  end
42
42
 
43
- def characterize_if_changed
44
- content_changed = self.content.changed?
45
- yield
46
- Sufia.queue.push(CharacterizeJob.new(self.pid)) if content_changed
47
- end
48
-
49
43
  ## Extract the metadata from the content datastream and record it in the characterization datastream
50
44
  def characterize
51
45
  self.characterization.ng_xml = self.content.extract_metadata
@@ -89,7 +83,6 @@ module Sufia
89
83
  h
90
84
  end
91
85
 
92
-
93
86
  end
94
87
  end
95
88
  end