sufia-models 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/batch.rb +2 -2
- data/app/models/checksum_audit_log.rb +3 -4
- data/lib/sufia/models.rb +1 -0
- data/lib/sufia/models/engine.rb +5 -0
- data/lib/sufia/models/generic_file.rb +8 -0
- data/lib/sufia/models/id_service.rb +10 -7
- data/lib/sufia/models/jobs/batch_update_job.rb +1 -2
- data/lib/sufia/models/jobs/transcode_audio_job.rb +2 -3
- data/lib/sufia/models/model_methods.rb +6 -0
- data/lib/sufia/models/version.rb +1 -1
- data/lib/tasks/sufia-models_tasks.rake +7 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddd7181cafb3b120aefffbbde8d170b1e2149ec5
|
4
|
+
data.tar.gz: 3f255cafe12f0e78f81fad2f8651adfb10f49404
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bb4039d4dd6ce49c74193559605ca2fccee547861654f4963ca664238656ae8fa78b03efefa09fddcab81da0d1f21780a6b775de95bb048c948f9fcf2acb928
|
7
|
+
data.tar.gz: bb7584fe3c1bb62f8f17390665df49f55c71e3dd2bd1c82dfef199435d5cf3f541c8c68e9d968204e98ceee05a027d0264337498ee2b5ad034a8c920e832c46a
|
data/app/models/batch.rb
CHANGED
@@ -16,10 +16,9 @@ class ChecksumAuditLog < ActiveRecord::Base
|
|
16
16
|
attr_accessible :pass, :pid, :dsid, :version, :created_at
|
17
17
|
|
18
18
|
def ChecksumAuditLog.get_audit_log(version)
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
log
|
19
|
+
ChecksumAuditLog.find_or_create_by_pid_and_dsid_and_version(:pid => version.pid,
|
20
|
+
:dsid => version.dsid,
|
21
|
+
:version => version.versionID)
|
23
22
|
end
|
24
23
|
|
25
24
|
def ChecksumAuditLog.prune_history(version)
|
data/lib/sufia/models.rb
CHANGED
data/lib/sufia/models/engine.rb
CHANGED
@@ -12,6 +12,11 @@ module Sufia
|
|
12
12
|
config.autoload_paths += %W(
|
13
13
|
#{config.root}/lib/sufia/models/jobs
|
14
14
|
)
|
15
|
+
|
16
|
+
rake_tasks do
|
17
|
+
load File.expand_path('../../../tasks/sufia-models_tasks.rake', __FILE__)
|
18
|
+
end
|
19
|
+
|
15
20
|
initializer "patches" do
|
16
21
|
require 'sufia/models/active_fedora/redis'
|
17
22
|
require 'sufia/models/active_record/redis'
|
@@ -6,6 +6,13 @@ module Sufia
|
|
6
6
|
module GenericFile
|
7
7
|
extend ActiveSupport::Concern
|
8
8
|
extend ActiveSupport::Autoload
|
9
|
+
autoload :Export
|
10
|
+
autoload :Thumbnail
|
11
|
+
autoload :Characterization
|
12
|
+
autoload :Audit
|
13
|
+
autoload :Actions
|
14
|
+
autoload :Permissions
|
15
|
+
autoload :WebForm
|
9
16
|
include Sufia::ModelMethods
|
10
17
|
include Sufia::Noid
|
11
18
|
include Sufia::GenericFile::Thumbnail
|
@@ -13,6 +20,7 @@ module Sufia
|
|
13
20
|
include Sufia::GenericFile::Characterization
|
14
21
|
include Sufia::GenericFile::Audit
|
15
22
|
include Sufia::GenericFile::Permissions
|
23
|
+
include Sufia::GenericFile::WebForm
|
16
24
|
|
17
25
|
included do
|
18
26
|
has_metadata :name => "descMetadata", :type => GenericFileRdfDatastream
|
@@ -16,8 +16,12 @@ require 'noid'
|
|
16
16
|
|
17
17
|
module Sufia
|
18
18
|
module IdService
|
19
|
-
|
20
|
-
|
19
|
+
|
20
|
+
def self.noid_template
|
21
|
+
Sufia.config.noid_template
|
22
|
+
end
|
23
|
+
|
24
|
+
@minter = ::Noid::Minter.new(:template => noid_template)
|
21
25
|
@pid = $$
|
22
26
|
@namespace = Sufia.config.id_namespace
|
23
27
|
@semaphore = Mutex.new
|
@@ -39,20 +43,19 @@ module Sufia
|
|
39
43
|
|
40
44
|
def self.next_id
|
41
45
|
pid = ''
|
42
|
-
File.open(
|
46
|
+
File.open(Sufia::Engine.config.minter_statefile, File::RDWR|File::CREAT, 0644) do |f|
|
43
47
|
f.flock(File::LOCK_EX)
|
44
48
|
yaml = YAML::load(f.read)
|
45
|
-
yaml = {:template =>
|
49
|
+
yaml = {:template => noid_template} unless yaml
|
46
50
|
minter = ::Noid::Minter.new(yaml)
|
47
|
-
pid =
|
51
|
+
pid = "#{@namespace}:#{minter.mint}"
|
48
52
|
f.rewind
|
49
53
|
yaml = YAML::dump(minter.dump)
|
50
54
|
f.write yaml
|
51
55
|
f.flush
|
52
56
|
f.truncate(f.pos)
|
53
|
-
|
57
|
+
end
|
54
58
|
return pid
|
55
59
|
end
|
56
|
-
|
57
60
|
end
|
58
61
|
end
|
@@ -14,7 +14,6 @@
|
|
14
14
|
|
15
15
|
class BatchUpdateJob
|
16
16
|
include Hydra::PermissionsQuery
|
17
|
-
include GenericFileHelper
|
18
17
|
include Rails.application.routes.url_helpers
|
19
18
|
|
20
19
|
def queue_name
|
@@ -79,7 +78,7 @@ class BatchUpdateJob
|
|
79
78
|
end
|
80
79
|
|
81
80
|
def file_list ( files)
|
82
|
-
return files.map {|gf| '<a href="'+Sufia::Engine.routes.url_helpers.generic_files_path+'/'+gf.noid+'">'+
|
81
|
+
return files.map {|gf| '<a href="'+Sufia::Engine.routes.url_helpers.generic_files_path+'/'+gf.noid+'">'+gf.to_s+'</a>'}.join(', ')
|
83
82
|
|
84
83
|
end
|
85
84
|
|
@@ -28,10 +28,9 @@ class TranscodeAudioJob < FfmpegTranscodeJob
|
|
28
28
|
opts = ""
|
29
29
|
if generic_file.mime_type == 'audio/mpeg'
|
30
30
|
# Don't re-encode, just copy
|
31
|
-
generic_file.add_file_datastream(generic_file.content.read, :dsid=>'mp3', :mimeType=>'audio/
|
32
|
-
#generic_file.content.rewind
|
31
|
+
generic_file.add_file_datastream(generic_file.content.read, :dsid=>'mp3', :mimeType=>'audio/mpeg')
|
33
32
|
else
|
34
|
-
encode_datastream('mp3', 'audio/
|
33
|
+
encode_datastream('mp3', 'audio/mpeg', opts)
|
35
34
|
end
|
36
35
|
end
|
37
36
|
|
data/lib/sufia/models/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sufia-models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Friesen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|