# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-25 19:05
from __future__ import unicode_literals

from django.db import migrations

from movieratings.models import Movie


def load_movie_data(*args):
    with open("/Users/BenjaminGHigh/PycharmProjects/bens_movie_ratings/movieratings/migrations/u.item") as users:
        for user in users.readlines():
            Movie.objects.create(movie_id=user.split("|")[0], movie_title=user.split("|")[1],
                                 release_date=user.split("|")[2], video_release_date=user.split("|")[3],
                                 imdb=user.split("|")[4], unknown_genre=user.split("|")[5],
                                 action=user.split("|")[6], adventure=user.split("|")[7],
                                 animation=user.split("|")[8], childrens=user.split("|")[9],
                                 comedy=user.split("|")[10], crime=user.split("|")[11],
                                 documentary=user.split("|")[12], drama=user.split("|")[13],
                                 fantasy=user.split("|")[14], filmnoir=user.split("|")[15],
                                 horror=user.split("|")[16], musical=user.split("|")[17],
                                 mystery=user.split("|")[18], romance=user.split("|")[19],
                                 scifi=user.split("|")[20], thriller=user.split("|")[21],
                                 war=user.split("|")[22], western=user.split("|")[23])


class Migration(migrations.Migration):

    dependencies = [
        ('movieratings', '0003_remove_rater_user_id'),
    ]

    operations = [
        migrations.RunPython(load_movie_data)
    ]
