From a13e0a75e8cb296f794df208a1e5a6d4f99f4af4 Mon Sep 17 00:00:00 2001 From: Ruud Date: Mon, 10 Feb 2014 23:08:14 +0100 Subject: [PATCH] Remove test --- couchpotato/core/plugins/nosql/__init__.py | 7 -- couchpotato/core/plugins/nosql/index.py | 17 ----- couchpotato/core/plugins/nosql/main.py | 82 ---------------------- 3 files changed, 106 deletions(-) delete mode 100644 couchpotato/core/plugins/nosql/__init__.py delete mode 100644 couchpotato/core/plugins/nosql/index.py delete mode 100644 couchpotato/core/plugins/nosql/main.py diff --git a/couchpotato/core/plugins/nosql/__init__.py b/couchpotato/core/plugins/nosql/__init__.py deleted file mode 100644 index 7f0e952e..00000000 --- a/couchpotato/core/plugins/nosql/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -from .main import NoSQL - - -def start(): - return NoSQL() - -config = [] diff --git a/couchpotato/core/plugins/nosql/index.py b/couchpotato/core/plugins/nosql/index.py deleted file mode 100644 index f88738fb..00000000 --- a/couchpotato/core/plugins/nosql/index.py +++ /dev/null @@ -1,17 +0,0 @@ -from hashlib import md5 -from CodernityDB.tree_index import TreeBasedIndex, MultiTreeBasedIndex - - -class NameIndex(TreeBasedIndex): - - def __init__(self, *args, **kwargs): - kwargs['key_format'] = '16s' - super(NameIndex, self).__init__(*args, **kwargs) - - def make_key(self, key): - return key - - def make_key_value(self, data): - if data.get('_t') == 'media' and data.get('title') is not None: - return data.get('title'), None - diff --git a/couchpotato/core/plugins/nosql/main.py b/couchpotato/core/plugins/nosql/main.py deleted file mode 100644 index b5243d9f..00000000 --- a/couchpotato/core/plugins/nosql/main.py +++ /dev/null @@ -1,82 +0,0 @@ -import time -from couchpotato import CPLog, get_db -from couchpotato.core.event import addEvent -from couchpotato.core.plugins.base import Plugin - -log = CPLog(__name__) - - -class NoSQL(Plugin): - - db = None - - def __init__(self): - - pass #addEvent('app.load', self.test) - - def test(self): - - db = get_db() - - try: db.add_index(YearIndex(db.path, 'year')) - except: - log.debug('Index already exists') - db.edit_index(YearIndex(db.path, 'year')) - - return - - try: db.add_index(ReleaseIndex(db.path, 'release')) - except: log.debug('Index already exists') - - for id in range(10): - media = db.insert({ - '_t': 'media', - 'type': 'movie', - 'tmdb': id, - 'imdb': 'tt%s' % id, - 'last_edit': 0, - 'status': 'active', - 'title': 'Lord of the Rings: The Return of the King', - 'year': 2011, - 'profile_id': 0, - 'category_id': 0, - }) - - db.insert({ - 'media_id': media['_id'], - 'type': 'title', - 'title': 'Lord of the Rings: The Return of the King', - }) - - for x in range(40): - db.insert({ - 'media_id': media['_id'], - 'type': 'release', - 'name': 'Release %s' % x - }) - - print db.count(db.all, 'media') - - m = db.get('media', 'tt0') - db.get('id', m['_id']) - - start = time.time() - print list(db.get_many('media_title', 'lord of')) - print time.time() - start - - return - - for media in db.all('media', with_doc = True): - doc = media['doc'] - for r in db.run('release', 'for_media', media['_id']): - db.delete(r) - - db.delete(doc) - break - - start = time.time() - db.reindex() - print time.time() - start - - print db.count(db.all, 'media') - print db.count(db.all, 'release')