mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-21 13:53:15 -07:00
Added function to return a list of archive files.
Cleaned and fixed code in TorrentToMedia, should resolve issue #314
This commit is contained in:
parent
192cd6691a
commit
06c2dae5ce
2 changed files with 67 additions and 43 deletions
|
@ -581,6 +581,37 @@ def clean_nzbname(nzbname):
|
|||
return nzbname.strip()
|
||||
|
||||
|
||||
def isArchiveFile(filename):
|
||||
# ignore samples
|
||||
|
||||
# ignore MAC OS's retarded "resource fork" files
|
||||
if filename.startswith('._'):
|
||||
return False
|
||||
|
||||
sepFile = filename.rpartition(".")
|
||||
|
||||
if sepFile[2].lower() in [i.replace(".","") for i in nzbtomedia.COMPRESSEDCONTAINER]:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def listArchiveFiles(path):
|
||||
if not dir or not os.path.isdir(path):
|
||||
return []
|
||||
|
||||
files = []
|
||||
for curFile in os.listdir(path):
|
||||
fullCurFile = os.path.join(path, curFile).replace("\\","/")
|
||||
|
||||
# if it's a folder do it recursively
|
||||
if os.path.isdir(fullCurFile) and not curFile.startswith('.'):
|
||||
files += listMediaFiles(fullCurFile)
|
||||
|
||||
elif isMediaFile(curFile):
|
||||
files.append(fullCurFile)
|
||||
|
||||
return files
|
||||
|
||||
def isMediaFile(filename):
|
||||
# ignore samples
|
||||
if re.search('(^|[\W_])(sample\d*)[\W_]', filename, re.I):
|
||||
|
@ -600,7 +631,6 @@ def isMediaFile(filename):
|
|||
else:
|
||||
return False
|
||||
|
||||
|
||||
def listMediaFiles(path):
|
||||
if not dir or not os.path.isdir(path):
|
||||
return []
|
||||
|
@ -618,7 +648,6 @@ def listMediaFiles(path):
|
|||
|
||||
return files
|
||||
|
||||
|
||||
def find_imdbid(dirName, nzbName):
|
||||
imdbid = None
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue