From 36cf0e7dcfc5727e28c5d76e7cba6eb4bb0c0ba8 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Sun, 5 Mar 2017 16:40:29 +0100 Subject: [PATCH] Added os.rename to move the files to their new location, instead of printing the old and new location --- folderCreator.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/folderCreator.py b/folderCreator.py index 6b0abfe..ae81536 100755 --- a/folderCreator.py +++ b/folderCreator.py @@ -3,7 +3,7 @@ # @Author: KevinMidboe # @Date: 2017-03-05 13:52:45 # @Last Modified by: KevinMidboe -# @Last Modified time: 2017-03-05 15:53:04 +# @Last Modified time: 2017-03-05 16:39:27 import sqlite3, json, os from re import sub @@ -80,14 +80,16 @@ def moveFiles(episode): newMediaitems = newnameMediaitems(episode['media_items']) for item in newMediaitems: - print(showDir + episode['original'] + '/' + item[0]) - print(showDir + seasonFormat + episodeFormat + item[1] + '\n') + old_location = showDir + episode['original'] + '/' + item[0] + new_location = showDir + seasonFormat + episodeFormat + item[1] + os.rename(old_location, new_location) if episode['subtitles']: newSubtitles = newnameSubtitles(episode['subtitles']) for item in newSubtitles: - print(showDir + episode['original'] + '/' + item[0]) - print(showDir + seasonFormat + episodeFormat + item[1] + '\n') + old_location = showDir + episode['original'] + '/' + item[0] + new_location = showDir + seasonFormat + episodeFormat + item[1] + os.rename(old_location, new_location) updateMovedStatus(episode)