from glob import iglob
from mutagen.easyid3 import EasyID3
from os import path
import sys

from lib229 import open_file_to_write
from lib229 import parse_args


# List of possible ID3 tags to record.
allowed_tags = ['artist', 'genre', 'title']


# Parse options.
(tags, ofile_name, ifile_paths) = parse_args(__doc__, allowed_tags)
if ifile_paths is None:
    print "No input files specified so there's nothing to do. Exiting."
    sys.exit()
# Set up output file for writing.
ofile = open_file_to_write(path.abspath(ofile_name))
if ofile is None:
    print 'Unable to open output file.'
    sys.exit()
ofile.write('filename')
for i in xrange(len(tags)):
    ofile.write('|%s' % tags[i])
ofile.write('\n')

# Iterate over input files, writing their filename and tags.
for ifile_path in ifile_paths:
示例#2
0

from glob import iglob
from os import path
import re
import sys

from lib229 import open_file_to_write
from lib229 import parse_args


ALLOWED_EXTENSIONS = ['.jpg', '.png']


# Parse options.
(tags, ofile_name, ifile_paths) = parse_args(__doc__)
if ifile_paths is None:
    print "No input files specified so there's nothing to do. Exiting."
    sys.exit()
# Set up output file for writing.
ofile = open_file_to_write(path.abspath(ofile_name))
if ofile is None:
    print 'Unable to open output file.'
    sys.exit()
ofile.write('path|image_genre\n')

# Iterate over input files, writing their filename and genre.
for ifile_path in ifile_paths:
    for ifile_name in iglob(ifile_path):
        # Ignore directories
        if not path.isfile(ifile_name):
    if you don't want to waste time you should specify what tags you want).
"""

from glob import iglob
from mutagen.easyid3 import EasyID3
from os import path
import sys

from lib229 import open_file_to_write
from lib229 import parse_args

# List of possible ID3 tags to record.
allowed_tags = ['artist', 'genre', 'title']

# Parse options.
(tags, ofile_name, ifile_paths) = parse_args(__doc__, allowed_tags)
if ifile_paths is None:
    print "No input files specified so there's nothing to do. Exiting."
    sys.exit()
# Set up output file for writing.
ofile = open_file_to_write(path.abspath(ofile_name))
if ofile is None:
    print 'Unable to open output file.'
    sys.exit()
ofile.write('filename')
for i in xrange(len(tags)):
    ofile.write('|%s' % tags[i])
ofile.write('\n')

# Iterate over input files, writing their filename and tags.
for ifile_path in ifile_paths: