EOD commit (WIP). Commented out schema added yesterday in favour of a more global scheme. Added menu option in GUI to search for tv shows (placed on top of movie one for now). Partially implemented thetvdb provider. Search is working and returns a list of shows for GUI search along with posters. posters still need work.

This commit is contained in:
Jason Mehring
2013-08-16 02:44:41 -04:00
parent 8fcc246f25
commit bc11f90529
33 changed files with 5102 additions and 167 deletions
+132 -130
View File
@@ -71,12 +71,12 @@ class MutableDict(Mutable, dict):
MutableDict.associate_with(JsonType)
class Movie(Entity):
"""Movie Resource a movie could have multiple releases
The files belonging to the movie object are global for the whole movie
such as trailers, nfo, thumbnails"""
type = Field(String(10), default="movie", index=True)
last_edit = Field(Integer, default = lambda: int(time.time()), index = True)
library = ManyToOne('Library', cascade = 'delete, delete-orphan', single_parent = True)
@@ -90,6 +90,8 @@ class Movie(Entity):
class Library(Entity):
""""""
# For Movies, CPS uses three: omdbapi (no prio !?), tmdb (prio 2) and couchpotatoapi (prio 1)
provider = Field(String(10), default="imdb", index=True)
year = Field(Integer)
identifier = Field(String(20), index = True)
@@ -115,140 +117,140 @@ class LibraryTitle(Entity):
libraries = ManyToOne('Library')
class Show(Entity):
"""Combined Show and Library"""
using_options(order_by = '-default') # ???
last_edit = Field(Integer, default = lambda: int(time.time()), index = True)
#identifier = Field(String(20), index = True)
title = Field(Unicode) # Show title
simple_title = Field(Unicode, index = True) # Simple show title
default = Field(Boolean, default = False, index = True) # ???
## Wont need the following commented out vars since a show can not be downloaded,
## only episodes can be
##status = ManyToOne('Status') # Download, watched, etc
##releases = OneToMany('Release', cascade = 'all, delete-orphan') # List all available releases that can be downloaded?
##files = ManyToMany('File', cascade = 'all, delete-orphan', single_parent = True) # File on hard drive
profile = ManyToOne('Profile') # ??? Quality ???
category = ManyToOne('Category') # ???
language = OneToMany('Language') # Language ??? (en) ???
# New fields
air_by_date = Field(Boolean, default=False) # True if no season or episode number
original_air_date = Field(Integer) # First date ever released
year = Field(Integer) # 1983
air_day = Field(Integer) # Monday, Tuesday...
air_time = Field(Integer) # 8PM EST
series_id = Field(Integer) # Series id
show_stauts = Field(Integer) # Continuing, Ended
duration = Field(Integer) # Length of show in seconds
summary = Field(Unicode) # Description of show
network = Field(Unicode) # ABC, Fox
rating = Field(Float) # 0.000-10.000 (star rating)
content_rating = Field(Unicode) # "TV-PG"
default_provider = Field(Integer, default=0)# thetvdb for example; allows per show providers
genre = ManyToMany('Genre') # Genre (comedy, etc)
episodes = OneToMany('Episode') # All the episodes that belong to this show
seasons = ManyToOne('Season') # Seasons artwork
banners = ManyToOne('Banner') # Banner artwork
posters = ManyToOne('Poster') # Poster artwork
fanart = ManyToOne('Fanart') # Fanart artwork
actors = ManyToMany('Actor') # Actor info and artwork
provider_ids = ManyToMany('ProviderIds') # 'imdb_id', 'zap2it_id', 'tvrage'
titles = OneToMany('ShowTitle', cascade = 'all, delete-orphan')
class ShowTitle(Entity):
""""""
using_options(order_by = '-default')
title = Field(Unicode)
simple_title = Field(Unicode, index = True)
default = Field(Boolean, default = False, index = True)
language = OneToMany('Language')
shows = ManyToOne('Show')
class Episode(Entity):
"""Combined Show and Library"""
#class Show(Entity):
#"""Combined Show and Library"""
#using_options(order_by = '-default') # ???
#identifier = Field(String(20), index = True)
last_edit = Field(Integer, default = lambda: int(time.time()), index = True)
title = Field(Unicode) # Show title
simple_title = Field(Unicode, index = True) # Simple show title
default = Field(Boolean, default = False, index = True) # ???
#last_edit = Field(Integer, default = lambda: int(time.time()), index = True)
##identifier = Field(String(20), index = True)
#title = Field(Unicode) # Show title
#simple_title = Field(Unicode, index = True) # Simple show title
#default = Field(Boolean, default = False, index = True) # ???
status = ManyToOne('Status') # Download, watched, etc
profile = ManyToOne('Profile') # ??? Quality ???
category = ManyToOne('Category') # ???
releases = OneToMany('Release', cascade = 'all, delete-orphan') # List all available releases that can be downloaded?
files = ManyToMany('File', cascade = 'all, delete-orphan', single_parent = True) # File on hard drive
language = OneToMany('Language') # Language ??? (en) ???
### Wont need the following commented out vars since a show can not be downloaded,
### only episodes can be
###status = ManyToOne('Status') # Download, watched, etc
###releases = OneToMany('Release', cascade = 'all, delete-orphan') # List all available releases that can be downloaded?
###files = ManyToMany('File', cascade = 'all, delete-orphan', single_parent = True) # File on hard drive
#profile = ManyToOne('Profile') # ??? Quality ???
#category = ManyToOne('Category') # ???
#language = OneToMany('Language') # Language ??? (en) ???
# New fields
season = Field(Integer) # Season number
number = Field(Integer) # Episode number
image = Field(BLOB) # Episode Image (XXX: What to do with images?)
air_date = Field(Integer) # Origianl air date
duration = Field(Integer) # Length of show (24:34) in seconds
summary = Field(Unicode) # Description of show
rating = Field(Float) # 0.000-10.000 (star rating)
content_rating = Field(Unicode) # "TV-PG"
production_code = Field(Unicode) # Production code (should this be an Integer)
## New fields
#air_by_date = Field(Boolean, default=False) # True if no season or episode number
#original_air_date = Field(Integer) # First date ever released
#year = Field(Integer) # 1983
#air_day = Field(Integer) # Monday, Tuesday...
#air_time = Field(Integer) # 8PM EST
#series_id = Field(Integer) # Series id
#show_stauts = Field(Integer) # Continuing, Ended
show = ManyToOne('Show') # Parent show
actors = ManyToMany('Actor') # Guest Actor info and artwork
directors = ManyToMany('Director') # Directors of episode
writers = ManyToMany('Writer') # Writers of episode
provider_ids = ManyToMany('ProviderIds') # 'imdb_id', 'zap2it_id', 'tvrage'
#duration = Field(Integer) # Length of show in seconds
#summary = Field(Unicode) # Description of show
#network = Field(Unicode) # ABC, Fox
#rating = Field(Float) # 0.000-10.000 (star rating)
#content_rating = Field(Unicode) # "TV-PG"
#default_provider = Field(Integer, default=0)# thetvdb for example; allows per show providers
#genre = ManyToMany('Genre') # Genre (comedy, etc)
#episodes = OneToMany('Episode') # All the episodes that belong to this show
#seasons = ManyToOne('Season') # Seasons artwork
#banners = ManyToOne('Banner') # Banner artwork
#posters = ManyToOne('Poster') # Poster artwork
#fanart = ManyToOne('Fanart') # Fanart artwork
#actors = ManyToMany('Actor') # Actor info and artwork
#provider_ids = ManyToMany('ProviderIds') # 'imdb_id', 'zap2it_id', 'tvrage'
#titles = OneToMany('ShowTitle', cascade = 'all, delete-orphan')
class Fanart(Entity):
"""Stub for Now"""
show = OneToMany('Show')
#class ShowTitle(Entity):
#""""""
#using_options(order_by = '-default')
#title = Field(Unicode)
#simple_title = Field(Unicode, index = True)
#default = Field(Boolean, default = False, index = True)
#language = OneToMany('Language')
#shows = ManyToOne('Show')
class Actor(Entity):
"""Stub for Now"""
shows = ManyToMany('Show')
episodes = ManyToMany('Episode')
class Director(Entity):
"""Stub for Now"""
episodes = ManyToMany('Episode')
#class Episode(Entity):
#"""Combined Show and Library"""
class Writer(Entity):
"""Stub for Now"""
episodes = ManyToMany('Episode')
##using_options(order_by = '-default') # ???
##identifier = Field(String(20), index = True)
class Genre(Entity):
"""Stub for Now"""
shows = ManyToMany('Show')
#last_edit = Field(Integer, default = lambda: int(time.time()), index = True)
#title = Field(Unicode) # Show title
#simple_title = Field(Unicode, index = True) # Simple show title
#default = Field(Boolean, default = False, index = True) # ???
#status = ManyToOne('Status') # Download, watched, etc
#profile = ManyToOne('Profile') # ??? Quality ???
#category = ManyToOne('Category') # ???
#releases = OneToMany('Release', cascade = 'all, delete-orphan') # List all available releases that can be downloaded?
#files = ManyToMany('File', cascade = 'all, delete-orphan', single_parent = True) # File on hard drive
#language = OneToMany('Language') # Language ??? (en) ???
class Season(Entity):
"""Stub for Now"""
show = OneToMany('Show')
## New fields
#season = Field(Integer) # Season number
#number = Field(Integer) # Episode number
#image = Field(BLOB) # Episode Image (XXX: What to do with images?)
#air_date = Field(Integer) # Origianl air date
#duration = Field(Integer) # Length of show (24:34) in seconds
#summary = Field(Unicode) # Description of show
#rating = Field(Float) # 0.000-10.000 (star rating)
#content_rating = Field(Unicode) # "TV-PG"
#production_code = Field(Unicode) # Production code (should this be an Integer)
class Banner(Entity):
"""Stub for Now"""
show = OneToMany('Show')
#show = ManyToOne('Show') # Parent show
#actors = ManyToMany('Actor') # Guest Actor info and artwork
#directors = ManyToMany('Director') # Directors of episode
#writers = ManyToMany('Writer') # Writers of episode
#provider_ids = ManyToMany('ProviderIds') # 'imdb_id', 'zap2it_id', 'tvrage'
class Poster(Entity):
"""Stub for Now"""
show = OneToMany('Show')
class ProviderIds(Entity):
"""Stub for Now"""
shows = ManyToMany('Show')
episodes = ManyToMany('Episode')
#class Fanart(Entity):
#"""Stub for Now"""
#show = OneToMany('Show')
#class Actor(Entity):
#"""Stub for Now"""
#shows = ManyToMany('Show')
#episodes = ManyToMany('Episode')
#class Director(Entity):
#"""Stub for Now"""
#episodes = ManyToMany('Episode')
#class Writer(Entity):
#"""Stub for Now"""
#episodes = ManyToMany('Episode')
#class Genre(Entity):
#"""Stub for Now"""
#shows = ManyToMany('Show')
#class Season(Entity):
#"""Stub for Now"""
#show = OneToMany('Show')
#class Banner(Entity):
#"""Stub for Now"""
#show = OneToMany('Show')
#class Poster(Entity):
#"""Stub for Now"""
#show = OneToMany('Show')
#class ProviderIds(Entity):
#"""Stub for Now"""
#shows = ManyToMany('Show')
#episodes = ManyToMany('Episode')
class Language(Entity):
@@ -258,9 +260,9 @@ class Language(Entity):
label = Field(Unicode)
titles = ManyToOne('LibraryTitle')
show_titles = ManyToOne('ShowTitle')
show = ManyToOne('Show')
episode = ManyToOne('Episode')
#show_titles = ManyToOne('ShowTitle')
#show = ManyToOne('Show')
#episode = ManyToOne('Episode')
class Release(Entity):
@@ -271,7 +273,7 @@ class Release(Entity):
identifier = Field(String(100), index = True)
movie = ManyToOne('Movie')
episode = ManyToOne('Episode')
#episode = ManyToOne('Episode')
status = ManyToOne('Status')
quality = ManyToOne('Quality')
files = ManyToMany('File')
@@ -310,8 +312,8 @@ class Status(Entity):
label = Field(Unicode(20))
releases = OneToMany('Release')
movies = OneToMany('Movie')
episodes = OneToMany('Episode')
#movies = OneToMany('Movie')
#episodes = OneToMany('Episode')
class Quality(Entity):
@@ -339,8 +341,8 @@ class Profile(Entity):
hide = Field(Boolean, default = False)
movie = OneToMany('Movie')
show = OneToMany('Show')
episode = OneToMany('Episode')
#show = OneToMany('Show')
#episode = OneToMany('Episode')
types = OneToMany('ProfileType', cascade = 'all, delete-orphan')
def to_dict(self, deep = {}, exclude = []):
@@ -362,8 +364,8 @@ class Category(Entity):
destination = Field(Unicode(255))
movie = OneToMany('Movie')
show = OneToMany('Show')
episode = OneToMany('Episode')
#show = OneToMany('Show')
#episode = OneToMany('Episode')
destination = Field(Unicode(255))
@@ -391,7 +393,7 @@ class File(Entity):
history = OneToMany('RenameHistory')
movie = ManyToMany('Movie')
episodes = ManyToMany('Episode')
#episodes = ManyToMany('Episode')
release = ManyToMany('Release')
library = ManyToMany('Library')