Fixes issues #344, #314

Added in code to place single files or groups of files that are not contained in a folder into there own folder or grouped folder based on parsing of the filenames to extract details required to determin correcting folder naming.
This commit is contained in:
echel0n 2014-04-23 19:50:51 -07:00
commit f7e56b979b
258 changed files with 73367 additions and 174 deletions

View file

@ -1,12 +1,29 @@
import os
import datetime
import nzbtomedia
from nzbtomedia.nzbToMediaUtil import extractFiles, append_downloadID
from nzbtomedia import nzbToMediaDB
from nzbtomedia.nzbToMediaUtil import get_downloadInfo
# Initialize the config
nzbtomedia.initialize()
inputDirectory = "Z:\complete\tv\Game.of.Thrones.S04E03.HDTV.XviD-RARBG"
inputName = "Game of Thrones - S04E03 - Breaker of Chains"
inputHash = 'wdfc8fdn09w1wn908ede0820d8berd434213'
inputDirectory = 'Z:/complete/music/B.O.A.T.S. II_ Me Time [2013]'
outputDestination = 'Z:\\test\\music\\B.O.A.T.S. II_ Me Time [2013]'
outputDestinationMaster = outputDestination # Save the original, so we can change this within the loop below, and reset afterwards.
outputDestination = append_downloadID(inputDirectory, inputHash)
print outputDestination
now = datetime.datetime.now()
for dirpath, dirnames, filenames in os.walk(inputDirectory):
for file in filenames:
filePath = os.path.join(dirpath, file)
fileName, fileExtension = os.path.splitext(file)
newDir = dirpath # find the full path
newDir = newDir.replace(inputDirectory, "") #find the extra-depth directory
if len(newDir) > 0 and newDir[0] == "/":
newDir = newDir[1:] # remove leading "/" to enable join to work.
outputDestination = os.path.join(outputDestinationMaster, newDir) # join this extra directory to output.
targetDirectory = os.path.join(outputDestination, file)
outputDestination = outputDestinationMaster
nzbtomedia.flatten(outputDestination)