paulgorman.org

< ^ txt

Tue Jul 28 09:17:29 EDT 2015 Slept well. Another ninety degree day. Goals: Work: - Buy new file server Done. - Build pfSense gateway for HZ Installed drives and NICs. Downloading pfSense... and dd'ing image to usb stick... ...and it won't boot with the Intel NIC's installed. Harumph. I ordered several RTL8168 NIC's. - Follow up on Yardi license In progress. Emailed Yardi, and seeing if check was cashed. My walk was pretty damn hot, but having music was nice. Before being able to mount the sd card: sudo apt-get install exfat-fuse exfat-utils Finished musicminder script to convert FLACs to OGG for portable music player. #!/usr/bin/env python # musicminder mirrors your music library as OGG/MP3's for your portable player. # See README.md for details. import os from subprocess import call from string import split #---------------------------------------------------------------------------# # This is the settings section. # You should edit the values in this section for your setup. # The defaults are reasonable, but you must set the musicHome and outputPath. #---------------------------------------------------------------------------# # Absolute path to your music library, like: # musicHome = /home/me/Music musicHome = '/home/paulgorman/Music' # Absolute path to write output music files, like: # outputPath = /home/me/mp3 outputPath = '/home/paulgorman/ogg' # Output format. Either 'libvorbis' or 'libmp3lame'. codec = 'libvorbis' # Output extension. Either 'oga' or 'mp3'. outputFileExtension = 'ogg' # Set compression/quality 0 through 9. # Zero is low compression and high quality. # Nine is high compression and poor quality. # 0-4 should sound fairly transparent/good. # This is used for the ffmpeg -q:a argument value. # https://trac.ffmpeg.org/wiki/Encode/MP3 lossLevel = '4' # Overwrite existing mp3 output files? # Either "y" or "n". # Usually "n" unless you want to redo encoding of all MP3's. overwrite = 'n' # File extensions to copy only (no re-encode): copyOnlyFiles = ('aac', 'm4a', 'mp3', 'ogg', 'oga', 'opus') # File extensions to re-encode: reencodeFiles = ('aiff', 'flac', 'wav') # File extensions not listed above will be ignored. #---------------------------------------------------------------------------# # END of setup section. # You shouldn't need to edit anything below. #---------------------------------------------------------------------------# debug = False def convertFile(inFile, outFile): encodeCmd = 'ffmpeg -loglevel quiet -' + overwrite + ' -i ' + '"' \ + inFile + '"' + ' -codec:a '+ codec + ' -q:a ' \ + lossLevel + ' ' + '"' + outFile + '"' if (debug): print(encodeCmd) else: call(encodeCmd, shell=True) for dirName, subdirList, fileList in os.walk(musicHome): for inputFile in fileList: inputExt = split(inputFile, '.')[-1] outputFile = os.path.splitext(inputFile)[0] + '.' + outputFileExtension thisOutputDir = os.path.join(outputPath, dirName[len(musicHome) + 1:len(dirName)]) fullPathInputFile = os.path.join(dirName, inputFile) fullPathOutputFile = os.path.join(thisOutputDir, outputFile) if not (os.path.isdir(thisOutputDir)): if (debug): print(thisOutputDir) else: os.makedirs(thisOutputDir) if (inputExt in copyOnlyFiles): copyCmd = 'cp ' if (overwrite == 'n'): copyCmd = copyCmd + '-n ' copyCmd = copyCmd + '"' + fullPathInputFile + '" "' \ + fullPathOutputFile + '"' if (debug): print copyCmd else: call(copyCmd, shell=True) break if (inputExt in reencodeFiles): convertFile(fullPathInputFile, fullPathOutputFile)

< ^ txt