imdb ids can be longer

This commit is contained in:
j 2019-07-23 16:23:34 +02:00
parent ef633b00b1
commit f142a1a70d
5 changed files with 73 additions and 3 deletions

View file

@ -15,7 +15,7 @@ def get_movie_id(request):
elif 'itemId' in request.GET:
movieId = request.GET['itemId']
if movieId:
if len(movieId) == 7:
if len(movieId) >= 7 and not movieId[1] == 'x':
movie_id = models.get_movie_id(imdb_id=movieId)
else:
try:
@ -68,7 +68,7 @@ def get(request, data):
elif 'itemId' in data:
movieId = data['itemId']
if movieId:
if len(movieId) == 7:
if len(movieId) >= 7 and not movieId[1] == 'x':
movie_id = models.get_movie_id(imdb_id=movieId)
else:
try:

View file

@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2019-07-23 14:19
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import oxdjango.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Imdb',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', models.DateTimeField(auto_now_add=True)),
('modified', models.DateTimeField(auto_now=True)),
('imdb', models.CharField(max_length=7, unique=True)),
('title', models.CharField(blank=True, default='', max_length=1000)),
('originalTitle', models.CharField(blank=True, default='', max_length=1000)),
('year', models.CharField(blank=True, default='', max_length=4)),
('director', models.CharField(blank=True, default='', max_length=9000)),
('season', models.IntegerField(blank=True, null=True)),
('episode', models.IntegerField(blank=True, null=True)),
('episodeTitle', models.CharField(blank=True, default='', max_length=1000)),
('episodeYear', models.CharField(blank=True, default='', max_length=4)),
('episodeDirector', models.CharField(blank=True, default='', max_length=1000)),
('seriesTitle', models.CharField(blank=True, default='', max_length=1000)),
('invalid', models.BooleanField(default=False)),
('patch', oxdjango.fields.DictField(blank=True, default=None, null=True)),
],
),
migrations.CreateModel(
name='Match',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('key', models.CharField(db_index=True, max_length=28)),
('item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='matches', to='movie.Imdb')),
],
),
]

View file

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-06-19 20:24
from __future__ import unicode_literals
import django.core.serializers.json
from django.db import migrations, models
import oxdjango.fields
class Migration(migrations.Migration):
dependencies = [
('movie', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='Imdb',
name='imdb',
field=models.CharField(max_length=16, unique=True),
),
]

View file

View file

@ -88,7 +88,7 @@ class Imdb(models.Model):
created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True)
imdb = models.CharField(max_length=7, unique=True)
imdb = models.CharField(max_length=16, unique=True)
title = models.CharField(max_length=1000, blank=True, default='')
originalTitle = models.CharField(max_length=1000, blank=True, default='')
year = models.CharField(max_length=4, blank=True, default='')