April 30, 2008 at 7:09 pm
· Filed under Python, Random Things
Here’s a little script I created to copy all of the covers from my mp3 folders over to my flac folders. It also came in handy a few days ago when I accidentally deleted all of the covers that were present on my Sansa.
#! /usr/bin/env python
import os
import sys
import shutil
import string
for root, dir, files in os.walk(sys.argv[1]):
if len(dir) == 0:
copy_from = sys.argv[2] + '/' + root.replace(sys.argv[1],'').translate(
string.maketrans(':<>\|*?','_______'))
try:
for file in os.listdir(copy_from):
if file == '.directory' or file.endswith(('.jpg','.jpeg','.png','.gif','.bmp')):
copy_file = copy_from + '/' + file
shutil.copy(copy_file, root)
except OSError: pass
Permalink
April 30, 2008 at 2:01 pm
· Filed under Python, msync
Lately I’ve been working on a new project to sync music with my Sansa e260. Unsatisfied with manually moving files on and off of the tiny flash drive, I began work on an application to manage playlists and sync them for me. I’ve gotten it to the point where it scans my music collection, allows me to create playlists, and syncs those playlists with any directory I specify. In the future, I plan on implementing removable device recognition and cover attachment and resizing. It also currently only functions as a command-line client, but there are plans to develop a GUI frontend for it once the base library is stable enough.
Anyway, the project page is available behind the link on the right (or right here).
Permalink