:date: 2012-08-28 10:26
.. role:: strike
.. seealso::
* :ref:`2012-wordpress_to_octopress`
* :ref:`2012-wordpress_to_octopress_audio`
* :ref:`2012-wordpress_to_octopress_comments`
* :ref:`2012-wordpress_to_octopress_galleries`
* :ref:`2012-wordpress_to_octopress_images`
.. index:: tech, blogg, octopress, wordpress
.. _`2012-wordpress_to_octopress_videos`:
Wordpress to Octopress: Videoer
===============================
.. image:: /_images/images/gallery/2012/2012-placeholder/20120828-wordpress_to_octopress.png
:alt: Wordpress to Octopress
:align: right
:scale: 50
A couple of months back I've started to :strike:`try` to migrate from `Wordpress `__ to `Octopress `__. As mentioned earlier the code formatting in Wordpress is and was driving me crazy. Long lines aren't broken in a reasonable manner, intends are unreasonable and the visual editor seems to occasionally add and remove tags, which results in almost unreadable posts.
Since this blog already has a couple of hundred posts which I don't want to loose, a migration should be well prepared. So I'm basically maintaining two blogs recently. This one on Wordpress and on Octopress.
Today I came another step closer to finish the migration.
Almost every Wednesday or so I include some music videos in the post about music. Wordpress uses a specific syntax for that:
.. code:: bash
[youtube=http://www.youtube.com/watch?v=JaNH56Vpg-A]
This isn't used by Octopress to embed a video. As far as I figured out per default you need to know where the MP4-file is in order to include a video Octopress. However: Using the photo-tag from `Devin Weaver `__ I modified that script to replace tags for you-tube with the corresponding code. Now the following code will be replaced with an embedded video:
.. code:: bash
{% youtube %}
Now I just had to replace the code in the posts with the new syntax. First I've made a test-run:
.. code:: bash
$ sed -n 's/\[youtube\=http\:\/\/.*=\(.*\)\]/\{\% youtube \1 \%\}/p' *.markdown
That helped me figure out where the replacement wouldn't go smooth and manual intervention was required. I fixed just about five posts that way. The actual run later went flawless:
.. code:: bash
$ sed -i 's/\[youtube\=http\:\/\/.*=\(.*\)\]/\{\% youtube \1 \%\}/g' *.markdown
You can download the rb-file `here `__
Later I found out that `this has been done `__ a month ago using the same syntax and the same result. Anyway, that way I've learned something new which I wouldn't if I haven't started thinking myself.
--------
A later update
--------------
On my way to replace `Wordpress `__ with `Octopress `__ I've needed to setup a solution for including FLV-videos in some posts. That was a minority of posts, but still needed to be fixed.
After I've initially tried to convert the :samp:`flv` movies back to MP4 files and use the built-in solution for showing these, I've switched my strategy to include the originally FLV files again.
The original syntax:
.. code:: bash
[flv= ]
I've replaced with
.. code:: bash
{% flv %}
I've basically used the photo-tag plugin from `Devin Weaver `__ again and have re-written it for implementing FLV video files. Somehow it works.
Since there were just a couple of videos embedded, I did it manually and didn't use _sed_ to help me out.
You need to modify the script a bit to make it working:
* Download the `JWPlayer `__ and decompress it.
* Upload the file :file:`player.swf` to your Webserver.
* Replace :samp:`www.myurl.com` with the correct URL to the :file:`player.swf`.
* Put the file :file:`flv_tag.rb` in the plugin folder of Octopress.