Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tumblr Migrator dies on audio posts #14

Closed
mitchellhislop opened this issue Mar 5, 2013 · 6 comments
Closed

Tumblr Migrator dies on audio posts #14

mitchellhislop opened this issue Mar 5, 2013 · 6 comments

Comments

@mitchellhislop
Copy link

Hello,

First - I am not a ruby guy, but I know enough to dig into pure ruby code.

I was trying to run the migrator, and it kept dying with:

/usr/lib/ruby/gems/1.8/gems/jekyll-0.11.2/lib/jekyll/migrators/tumblr.rb:72:in post_to_hash': undefined method 'at' for #Hash:0x7f56c4d622f8 (NoMethodError)
from /usr/lib/ruby/gems/1.8/gems/jekyll-0.11.2/lib/jekyll/migrators/tumblr.rb:27:in process'
from /usr/lib/ruby/gems/1.8/gems/jekyll-0.11.2/lib/jekyll/migrators/tumblr.rb:27:in map'
from /usr/lib/ruby/gems/1.8/gems/jekyll-0.11.2/lib/jekyll/migrators/tumblr.rb:27:in `process'
from -e:1

I dug into that line, dumped some vars, and figured out that it looks like the at function (due to a change in structure) was not there, but removing it worked fine:

when "audio"
          if !post["id3-title"].nil?
            title = post["id3-title"]
            content = post["audio-player"] + "<br/>" + post["audio-caption"]
          else
            title = post["audio-caption"]
            content = post["audio-player"]
          end

Sorry I can't contribute a pull request - I dont know near enough about gems or testing them.

@kfatehi
Copy link

kfatehi commented May 12, 2013

Hey I ran across the same thing. (Hash#at ???)
I ended up with this script for a successful import without modifying the gem.

Using jekyll-import 0.1.0.beta1

require 'rubygems'

## 
# Monkeypatch to fix the following
# tumblr.rb:73
#   content = post.at["audio-player"] + "<br/>" + post["audio-caption"]
class Hash
  def at
    self
  end
end

begin
  require 'jekyll/jekyll-import/tumblr'
rescue
  puts "Missing jekyll-import gem. Do this: gem install jekyll-import --pre"
  exit -1
end

JekyllImport::Tumblr.process("http://slog.keyvanfatehi.com", true)

@mitchellhislop
Copy link
Author

Yeah, I'm thinking that is the same thing, and that is far more elegant than my solution was.

Good ol' monkeypatches.

@parkr
Copy link
Member

parkr commented May 20, 2013

If any of you want to submit a PR to fix this, that would be splendid :)

@parkr
Copy link
Member

parkr commented May 20, 2013

Both @mattr- and I are attentive to issues and PRs here :)

@mitchellhislop
Copy link
Author

Ill see if I can learn enough Ruby to do just that - sounds like a fun challenge.

@parkr
Copy link
Member

parkr commented May 28, 2013

Why do we use Hash#at anyway?

parkr added a commit that referenced this issue Jun 30, 2013
@parkr parkr closed this as completed in 8d27040 Jun 30, 2013
@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017
antonizoon pushed a commit to antonizoon/jekyll-import that referenced this issue Jan 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants