ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/MusicLibraryCoverUpdater.py
Revision: 655
Committed: Thu Dec 12 21:06:09 2019 UTC (6 years, 3 months ago) by nino.borges
Content type: text/x-python
File size: 1605 byte(s)
Log Message:
Simple program taht will help me fix broken music covers

File Contents

# User Rev Content
1 nino.borges 655 """
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