Skip to content

Commit

Permalink
mkdir for mkv in TMDbNotFound
Browse files Browse the repository at this point in the history
  • Loading branch information
ccf-2012 committed Feb 6, 2023
1 parent 8830306 commit d5c59d7
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions torcp/torcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,12 @@ def makeLogfile(self, fromLoc, toLocPath, logDir=None):
if not os.path.exists(destDir):
self.ensureDir(destDir)
with codecs.open(logFilename, "a+", "utf-8") as logfile:
logfile.write(fromLoc+'\n')
logfile.close()
try:
logfile.write(fromLoc+'\n')
logfile.close()
except:
print("Error occur when write log file")
pass


def hdlinkCopy(self, fromLoc, toLocPath, toLocFile=''):
Expand Down Expand Up @@ -702,8 +706,9 @@ def processMovieDir(self, mediaSrc, folderCat, folderGenName, folderTmdbParser):
# p.resolution)
return
elif cat in ['TMDbNotFound', 'HDTV', 'Audio', 'eBook']:
self.targetCopy(mediaSrc, cat)
self.targetDirHook(cat, tmdbidstr=str(p.tmdbid), tmdbcat=p.tmdbcat, tmdbtitle=p.title)
# catItemFolder = os.path.join(cat, movieItem)
self.targetCopy(mediaSrc, destFolderName)
self.targetDirHook(destFolderName, tmdbidstr=str(p.tmdbid), tmdbcat=p.tmdbcat, tmdbtitle=p.title)
continue
else:
if self.ARGS.origin_name:
Expand Down Expand Up @@ -976,7 +981,6 @@ def loadArgs(self, argv=None):
self.ARGS.hd_path = os.path.expanduser(self.ARGS.hd_path)
self.makeKeepExts()


def hasIMDbId(self, str):
m1 = re.search(r'\[imdb(id)?\=(tt\d+)\]', str.strip(), flags=re.A | re.I)
m2 = re.search(r'(tt\d+)\s*$', str, flags=re.A | re.I)
Expand All @@ -987,7 +991,6 @@ def hasIMDbId(self, str):
else:
return None


def matchSiteId(self, str):
if self.ARGS.site_str:
# argSites = ARGS.site_str.split(',')
Expand All @@ -1002,7 +1005,6 @@ def matchSiteId(self, str):
else:
return None


def onlyOneDirInSiteIdFolder(self, cpLocation, foldername):
siteid = self.matchSiteId(foldername)
if siteid:
Expand Down Expand Up @@ -1080,8 +1082,7 @@ def main(self, argv=None, exportObject=None):

if self.isCollections(itemName) and os.path.isdir(
os.path.join(parentLocation, itemName)):
print('\033[35mProcess collections: %s \033[0m' %
itemName)
print('\033[35mProcess collections: %s \033[0m' % itemName)
packDir = os.path.join(parentLocation, itemName)
for fn in os.listdir(packDir):
if self.ARGS.cache:
Expand Down

0 comments on commit d5c59d7

Please sign in to comment.