Created the big move home function which will create the parent folders and move all videos and subtitles.

This commit is contained in:
2018-09-23 21:36:03 +02:00
parent b40f0f91ef
commit 03902eeecb

View File

@@ -301,6 +301,20 @@ def pickforgirlscouts(video):
return False
def moveHome(video):
dir = os.path.dirname(video.home)
if not os.path.exists(dir):
logger.info('Creating directory {}'.format(dir))
os.makedirs(dir)
logger.info("Moving video file from: '{}' to: '{}'".format(video.name, video.home))
shutil.move(video.name, video.home)
for sub in video.subtitles:
sub_home = subtitle_path(sub)
logger.info("Moving subtitle file from: '{}' to: '{}'".format(sub, sub_home))
shutil.move(sub, sub_home)
def main():
path = '/mnt/mainframe/'
@@ -324,7 +338,7 @@ def main():
))
for video in scout:
print('{} lives: {}'.format(video, video.home))
moveHome(video)
if __name__ == '__main__':
main()