aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--_plugins/linter.rb24
1 files changed, 19 insertions, 5 deletions
diff --git a/_plugins/linter.rb b/_plugins/linter.rb
index c0059c9..f9167e1 100644
--- a/_plugins/linter.rb
+++ b/_plugins/linter.rb
@@ -141,16 +141,21 @@ module Jekyll
end
end
+ MEDIA_EXTENSION = {
+ 'podcasts' => 'flac',
+ 'screencasts' => 'mkv'
+ }
+
def assert_media_metadata(site)
site.collections.each do |name, collection|
if ['podcasts', 'screencasts'].include? name then
collection.docs.each do |document|
date = document.data['date'].strftime('%Y-%m-%d')
slug = document.data['slug']
- file = "resources/#{name}/#{date}-#{slug}.flac"
+ ext = MEDIA_EXTENSION[name]
+ file = "resources/#{name}/#{date}-#{slug}.#{ext}"
if name == 'podcasts'
- stdout = `metaflac --export-tags-to=- #{file}`
- file_metadata = stdout.strip.split("\n")
+ stdout = `metaflac --export-tags-to=- #{file}`.strip.split("\n")
expected = [
"COMMENTS=#{site.config['url']}/#{file}",
'ARTIST=EuAndreh',
@@ -159,7 +164,7 @@ module Jekyll
"ALBUM=#{site.config['t']['podcasts']['feed']['title'][document.data['lang']]}"
]
expected.each do |metadata|
- unless file_metadata.include? metadata
+ unless stdout.include? metadata
tags = expected.join('\\n').gsub(/'/, "'\"'\"'")
add_metadata_cmd = "metaflac --remove-all #{file}\nprintf '#{tags}\\n' | metaflac --import-tags-from=- #{file}"
check_metadata_cmd = "metaflac --export-tags-to=- #{file}"
@@ -174,7 +179,16 @@ module Jekyll
raise "Cover art from '#{file}' doesn't match 'static/favicon.svg'.\nFix it with:\n\n#{add_cover_cmd}\n\nCheck with:\n #{check_cover_cmd}"
end
elsif name == 'screencasts' then
- p document
+ stdout = `mediainfo #{file} | awk -F: '/^Movie name/ { print $2 }'`.strip
+ expected = document.data['title'] + ' - EuAndreh'
+ unless stdout == expected then
+ escaped_title = expected.gsub(/'/, "'\"'\"'")
+ add_metadata_cmd = "mkvpropedit '#{file}' -e info -s title='#{escaped_title}'"
+ check_metadata_cmd = "mediainfo '#{file}' | grep 'Movie name'"
+ raise "Missing metadata entry 'title' in '#{file}'.\nAdd it with:\n\n#{add_metadata_cmd}\n\nCheck with:\n #{check_metadata_cmd}"
+ end
+ # mkvpropedit dbg.mkv -e info -s album="The album"
+ # p document
end
end
end