Added os.rename to move the files to their new location, instead of printing the old and new location

This commit is contained in:
2017-03-05 16:40:29 +01:00
parent 748dfa5c5f
commit 36cf0e7dcf

View File

@@ -3,7 +3,7 @@
# @Author: KevinMidboe # @Author: KevinMidboe
# @Date: 2017-03-05 13:52:45 # @Date: 2017-03-05 13:52:45
# @Last Modified by: KevinMidboe # @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 import sqlite3, json, os
from re import sub from re import sub
@@ -80,14 +80,16 @@ def moveFiles(episode):
newMediaitems = newnameMediaitems(episode['media_items']) newMediaitems = newnameMediaitems(episode['media_items'])
for item in newMediaitems: for item in newMediaitems:
print(showDir + episode['original'] + '/' + item[0]) old_location = showDir + episode['original'] + '/' + item[0]
print(showDir + seasonFormat + episodeFormat + item[1] + '\n') new_location = showDir + seasonFormat + episodeFormat + item[1]
os.rename(old_location, new_location)
if episode['subtitles']: if episode['subtitles']:
newSubtitles = newnameSubtitles(episode['subtitles']) newSubtitles = newnameSubtitles(episode['subtitles'])
for item in newSubtitles: for item in newSubtitles:
print(showDir + episode['original'] + '/' + item[0]) old_location = showDir + episode['original'] + '/' + item[0]
print(showDir + seasonFormat + episodeFormat + item[1] + '\n') new_location = showDir + seasonFormat + episodeFormat + item[1]
os.rename(old_location, new_location)
updateMovedStatus(episode) updateMovedStatus(episode)