ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/MusicLibraryCoverUpdater.py
Revision: 747
Committed: Mon Apr 19 20:11:55 2021 UTC (4 years, 11 months ago) by nino.borges
Original Path: Python/NinoCode/Active_prgs/MusicUtilities
File size: 1605 byte(s)
Log Message:
Moving my various music related programs to a music utilities folder.

File Contents

# Content
1 """
2
3 MusicLibraryCoverUpdater
4
5 Created by
6 Emanuel Borges
7 01.19.2019
8
9 A simple program that will look through my music library for missing covers
10 and situations where there is only a cover file and not a folder file, which
11 sonos and older players need to display artwork.
12
13 """
14
15 import os, shutil
16
17 if __name__ == '__main__':
18 startingDir = "/Volumes/A019/Music_Collection/Music"
19 #specialFolders = ['Compilations']
20 skipList = ['.DS_Store']
21 for artistDir in os.listdir(startingDir):
22 #if artistDir in specialFolders:
23 # pass
24 if artistDir in skipList:
25 pass
26 else:
27 artistFullPath = os.path.join(startingDir,artistDir)
28 for albumnDir in os.listdir(artistFullPath):
29 if albumnDir in skipList:
30 pass
31 else:
32 albumnFullPath = os.path.join(artistFullPath,albumnDir)
33 songMatrix = {}
34 for f in os.listdir(albumnFullPath):
35 songMatrix[os.path.splitext(f)[0]] = os.path.splitext(f)[1]
36 if 'cover' in songMatrix.keys():
37 if 'folder' in songMatrix.keys():
38 pass
39 else:
40 print "folder file missing for %s. Copying..."%albumnDir
41 shutil.copyfile(os.path.join(albumnFullPath, 'cover' + songMatrix['cover']),os.path.join(albumnFullPath, 'folder' + songMatrix['cover']))
42 else:
43 print "cover art is missing for %s"% albumnDir