merge config, model and process

This commit is contained in:
Fred Pauchet 2013-08-03 22:18:15 +02:00
commit 81fb149f75
3 changed files with 8 additions and 3 deletions

View File

@ -2,8 +2,8 @@
# Configuration file
### Defines the folder to watch and the destination folder
ROOT_FOLDER = r'/home/fred/Videos/Series'
DL_FOLDER = r'/home/fred/Téléchargements/complete'
ROOT_FOLDER = r'/home/<username>/Videos/Series'
DL_FOLDER = r'/home/<username>/Downloads/complete'
### If a folder only contains these types of files, we can delete it.
useless_files_extensions = ('srr', 'nfo', 'sfv', 'nzb')
@ -16,4 +16,3 @@ shows_dict = {
'wc' : 'white collar',
'tbbt' : 'the big bang theory',
'beingerica' : 'being erica',
}

View File

@ -19,6 +19,7 @@ class Show(object):
self.path = path
self.name = os.path.basename(path)
def directory(self):
return os.path.dirname(self.path)

View File

@ -39,6 +39,7 @@ class PigeonHole(object):
for filename in files:
if not filename.endswith(extensions):
print "%s doesn't end with %s" % (filename, extensions)
yield os.path.join(root, filename)
def process(self):
@ -60,6 +61,7 @@ class PigeonHole(object):
if destinationfile is not None:
self.move(show.path, destinationfile)
self.movedFiles.append(destinationfile)
if self.isDeletable(show.directory()):
@ -83,6 +85,7 @@ class PigeonHole(object):
for s in self.series:
if s.name.lower() in result:
print "Association found %s %s" % (s.directory, show.name)
return os.path.join(s.directory, show.name)
@ -101,6 +104,7 @@ class PigeonHole(object):
print "Foldername value is %s" % (foldername)
if foldername == self.downloadDir or foldername == self.rootShows:
return False
@ -132,3 +136,4 @@ if __name__ == "__main__":
pHole.getSubtitles()
#pHole.structure.writeUrls()