add categories
This commit is contained in:
@@ -143,6 +143,10 @@ class Renamer(Plugin):
|
||||
remove_releases = []
|
||||
|
||||
movie_title = getTitle(group['library'])
|
||||
try:
|
||||
destination = group['category']['path']
|
||||
except:
|
||||
destination = self.conf('to')
|
||||
|
||||
# Add _UNKNOWN_ if no library item is connected
|
||||
if not group['library'] or not movie_title:
|
||||
|
||||
@@ -385,24 +385,30 @@ class Searcher(Plugin):
|
||||
nzb_words = re.split('\W+', nzb_name)
|
||||
|
||||
# Make sure it has required words
|
||||
required_words = splitString(self.conf('required_words').lower())
|
||||
try:
|
||||
required_words = splitString(movie['category']['required'].lower())
|
||||
except:
|
||||
required_words = splitString(self.conf('required_words').lower())
|
||||
req_match = 0
|
||||
for req_set in required_words:
|
||||
req = splitString(req_set, '&')
|
||||
req_match += len(list(set(nzb_words) & set(req))) == len(req)
|
||||
|
||||
if self.conf('required_words') and req_match == 0:
|
||||
if len(required_words) > 0 and req_match == 0:
|
||||
log.info2('Wrong: Required word missing: %s', nzb['name'])
|
||||
return False
|
||||
|
||||
# Ignore releases
|
||||
ignored_words = splitString(self.conf('ignored_words').lower())
|
||||
try:
|
||||
ignored_words = splitString(movie['category']['ignored'].lower())
|
||||
except:
|
||||
ignored_words = splitString(self.conf('ignored_words').lower())
|
||||
ignored_match = 0
|
||||
for ignored_set in ignored_words:
|
||||
ignored = splitString(ignored_set, '&')
|
||||
ignored_match += len(list(set(nzb_words) & set(ignored))) == len(ignored)
|
||||
|
||||
if self.conf('ignored_words') and ignored_match:
|
||||
if len(ignored_words) > 0 and ignored_match:
|
||||
log.info2("Wrong: '%s' contains 'ignored words'", (nzb['name']))
|
||||
return False
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ class Movie(Entity):
|
||||
library = ManyToOne('Library', cascade = 'delete, delete-orphan', single_parent = True)
|
||||
status = ManyToOne('Status')
|
||||
profile = ManyToOne('Profile')
|
||||
category = ManyToOne('Category')
|
||||
releases = OneToMany('Release', cascade = 'all, delete-orphan')
|
||||
files = ManyToMany('File', cascade = 'all, delete-orphan', single_parent = True)
|
||||
|
||||
@@ -174,6 +175,22 @@ class Profile(Entity):
|
||||
|
||||
return orig_dict
|
||||
|
||||
class Category(Entity):
|
||||
""""""
|
||||
using_options(order_by = 'order')
|
||||
|
||||
label = Field(Unicode(50))
|
||||
order = Field(Integer, default = 0, index = True)
|
||||
core = Field(Boolean, default = False)
|
||||
hide = Field(Boolean, default = False)
|
||||
|
||||
movie = OneToMany('Movie')
|
||||
path = Field(Unicode(255))
|
||||
required = Field(Unicode(255))
|
||||
preferred = Field(Unicode(255))
|
||||
ignored = Field(Unicode(255))
|
||||
|
||||
|
||||
class ProfileType(Entity):
|
||||
""""""
|
||||
using_options(order_by = 'order')
|
||||
|
||||
Reference in New Issue
Block a user