iTunesとiPod以外のプレーヤでPodcasatを同期

iTunesでやれるかもしれないけどやり方がわからなかったので

# coding: sjis
import sys
import os
import shutil

def sync(podcast, dletter="e"):
	dst = dletter + ":\\" + podcast
	src = "c:\\My Documents\\My Music\iTunes\\iTunes Music\\Podcast\\"+podcast
	try:
		os.mkdir(dletter +":\\" +podcast)
	except WindowsError, e:
		pass 
	for entry in os.listdir(src):
		if not os.path.exists(dst + "\\" + entry):
			try:
				print "synchronize:",entry
				shutil.copy(src+"\\"+entry, dst)
			except:
				print "copy failed"
		else:
			print "exists:", entry
def main():
	if sys.argv.__len__() <2:
		print "Usage: 同期をとるポッドキャストの名前+"
		sys.exit()
	podcasts = sys.argv[1:]
	for podcast in podcasts:
		sync(podcast)

if __name__ == '__main__':
	main()
	

これを”sync.py”という名前で保存して、以下のバッチファイルで同期を取る。

python sync.py 同期をとるポッドキャストを列挙する
pause

自分の場合は

python sync.py "python411" "小島秀夫監督の「ヒデラジ」" "CNN News Update"
pause