diff --git a/src/couchpotato/__init__.py b/couchpotato/__init__.py similarity index 100% rename from src/couchpotato/__init__.py rename to couchpotato/__init__.py diff --git a/src/couchpotato/cli.py b/couchpotato/cli.py similarity index 100% rename from src/couchpotato/cli.py rename to couchpotato/cli.py diff --git a/src/couchpotato/db.py b/couchpotato/db.py similarity index 100% rename from src/couchpotato/db.py rename to couchpotato/db.py diff --git a/setup.py b/setup.py index fee69e4..60d44d1 100755 --- a/setup.py +++ b/setup.py @@ -17,7 +17,6 @@ from setuptools import setup setup(name="couchpotato", packages=['couchpotato'], - package_dir={'': 'src'}, install_requires=[ 'argparse', 'elixir', diff --git a/src/couchpotato/model.py b/src/couchpotato/model.py deleted file mode 100644 index 6edf280..0000000 --- a/src/couchpotato/model.py +++ /dev/null @@ -1,129 +0,0 @@ -from sqlalchemy.orm import scoped_session, sessionmaker -from sqlalchemy import create_engine -from sqlalchemy.schema import ThreadLocalMetaData -from elixir import * - -engine = None -session = scoped_session(sessionmaker(autoflush=True, transactional=True)) -metadata - - -class Language(Entity): - name = OneToMany("LanguageName") - - -class LanguageName(Entity): - translation_id = Field(Integer, primary_key=True) - language = ManyToOne('Language', primary_key=True) - text = Field(Unicode(20), unique=True) - - -class Provider(Entity): - url = Field(String(20), unique=True) - - -class ExternalMovieId(Entity): - provider = ManyToOne('Provider') - value = Field(Unicode(40)) - movie = ManyToOne('Movie') - # such as IMDB's, maybe some use text -> long - - -class MovieTitle(Entity): - language = ManyToOne('Language') - movie = ManyToOne('Movie') - title = Field(UnicodeText) - - def __init__(self, title, movie=None): - self.title = unicode(title) - self.movie = movie - -class Movie(Entity): - titles = OneToMany('MovieTitle', lazy=False) - plot = Field(UnicodeText) - year = Field(Integer) - tagline = Field(UnicodeText(255)) - genres = ManyToMany('Genre') - identifiers = OneToMany('ExternalMovieId') - characters = ManyToMany('Character') - - def __init__(self, title, year): - try: - title = unicode(title) - self.titles.append(MovieTitle(title)) - except TypeError: - pass - - -class Character(Entity): - names = OneToMany('CharacterName', required=True) - movies = ManyToMany('Movie') - - -class CharacterName(Entity): - language = ManyToOne('Language') - character = ManyToOne('Character') - - -class AssociatedPeople(Entity): - directors = ManyToMany('Person') - screenwriters = ManyToMany('Person') - actors = ManyToMany('Person') - - -class AspectRatio(Entity): - name = Field(Unicode(20), required=True, unique=True) - ratio = Field(Float) - movies = ManyToMany('Movie') - # The Dark Knight has multiple... - -class Specification(Entity): - language = ManyToOne('Language') - color = Field(Boolean) - - -class Genre(Entity): - name = Field(UnicodeText(255)) - - -class Person(Entity): - name = Field(UnicodeText(50)) - birthday = Field(Date) - - -class Rating(Entity): - name = Field(UnicodeText(40)) - position = Field(Float) - movies = ManyToMany('Movie') - - def __cmp__(self, other): - if self.position < other.position: - return -1 - elif self.primary_key > other.position: - return 1 - else: - return 0 - - -class AgeRating(Entity): - name = Field(UnicodeText(40)) - position = Field(Float) - movies = ManyToMany('Movie') - - def __cmp__(self, other): - if self.position < other.position: - return -1 - elif self.primary_key > other.position: - return 1 - else: - return 0 - - -def doctest(engine=None): - """Test - >>> from couchpotato import model - >>> model.metadata.bind = "sqlite:///:memory:" - >>> model.setup_all() - >>> model.setup_all() - """ - pass