Skip to content

Instantly share code, notes, and snippets.

@remomueller
Last active December 8, 2016 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save remomueller/9c0f5da531fde34da91a9c013f895fe2 to your computer and use it in GitHub Desktop.
Save remomueller/9c0f5da531fde34da91a9c013f895fe2 to your computer and use it in GitHub Desktop.
A simple edfize ruby script that efficiently replaces zero dates "00.00.00" with a valid EDF start date "01.01.85"
# frozen_string_literal: true
# gem install edfize --no-document
# ruby rewrite_signal_date.rb
require 'rubygems'
require 'edfize'
WRONG_DATE = '00.00.00'
CLIPPING_DATE = '01.01.85'
Edfize.edfs do |edf|
if edf.start_date_of_recording == WRONG_DATE
initial_date = edf.start_date_of_recording
edf.update(start_date_of_recording: CLIPPING_DATE)
puts initial_date.colorize(:red) + " to " + edf.start_date_of_recording.colorize(:green) + " for #{edf.filename}"
else
puts " OK".colorize(:green) + " #{edf.start_date_of_recording} for #{edf.filename}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment