Scan files to library fixes

This commit is contained in:
Ruud
2011-11-06 20:22:30 +01:00
parent 36ed61f549
commit 2768bf4743
2 changed files with 5 additions and 3 deletions
+3 -2
View File
@@ -4,6 +4,7 @@ from couchpotato.core.event import fireEvent, addEvent
from couchpotato.core.helpers.request import getParam, jsonified
from couchpotato.core.logger import CPLog
from couchpotato.core.plugins.base import Plugin
from couchpotato.core.plugins.scanner.main import Scanner
from couchpotato.core.settings.model import File, Release as Relea, Movie
from sqlalchemy.sql.expression import and_, or_
@@ -40,7 +41,7 @@ class Release(Plugin):
rel = db.query(Relea).filter(
or_(
Relea.identifier == identifier,
and_(Relea.identifier.startswith(group['library']['identifier'], Relea.status_id == snatched_status.get('id')))
and_(Relea.identifier.startswith(group['library']['identifier']), Relea.status_id == snatched_status.get('id'))
)
).first()
if not rel:
@@ -76,7 +77,7 @@ class Release(Plugin):
properties = {}
# Check database and update/insert if necessary
return fireEvent('file.add', path = file, part = self.getPartNumber(file), type = self.file_types[type], properties = properties, single = True)
return fireEvent('file.add', path = file, part = fireEvent('scanner.partnumber', file, single = True), type = Scanner.file_types[type], properties = properties, single = True)
def delete(self):
+2 -1
View File
@@ -27,7 +27,7 @@ class Scanner(Plugin):
extensions = {
'movie': ['mkv', 'wmv', 'avi', 'mpg', 'mpeg', 'mp4', 'm2ts', 'iso', 'img'],
'dvd': ['vts_*', 'vob'],
'nfo': ['nfo', 'nfo-orig', 'txt', 'tag'],
'nfo': ['nfo', 'txt', 'tag'],
'subtitle': ['sub', 'srt', 'ssa', 'ass'],
'subtitle_extra': ['idx'],
'trailer': ['mov', 'mp4', 'flv']
@@ -75,6 +75,7 @@ class Scanner(Plugin):
addEvent('scanner.files', self.scanToFilesLibrary)
addEvent('scanner.folder', self.scanToFolderLibrary)
addEvent('scanner.name_year', self.getReleaseNameYear)
addEvent('scanner.partnumber', self.getPartNumber)
def scanToFilesLibrary(self, folder = None, files = None):