Created
February 6, 2013 16:12
Revisions
-
wridgers created this gist
Feb 6, 2013 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,40 @@ #!/usr/bin/python import os, time, sys now = time.time() errorFiles = open('errors.txt', 'w') playlist01days = open('Last 1 day.m3u', 'w') playlist07days = open('Last 7 days.m3u', 'w') playlist14days = open('Last 14 days.m3u', 'w') playlist28days = open('Last 28 days.m3u', 'w') for root, dirs, files in os.walk(os.getcwd()): for filename in files: if filename.endswith(('.mp3', '.flac', '.ogg')): try: path = os.path.join(root, filename) created = os.path.getctime(path); if (created > now - 60 * 60 * 24): playlist01days.write(path + '\n') if (created > now - 7 * 60 * 60 * 24): playlist07days.write(path + '\n') if (created > now - 14 * 60 * 60 * 24): playlist14days.write(path + '\n') if (created > now - 28 * 60 * 60 * 24): playlist28days.write(path + '\n') except: errorFiles.write(path + '\n') errorFiles.close() playlist01days.close() playlist07days.close() playlist14days.close() playlist28days.close()