コード例 #1
0
ファイル: itunescopy.py プロジェクト: tylerball/dotfiles
 def imported(self, task, session):
     (options, args) = default_commands[default_commands.index(import_cmd)].parser.parse_args()
     auto = self.config['auto'].get()
     if auto or options.copyitunes:
         if not options.nocopyitunes:
             for item in task.imported_items():
                 self.copy(item)
コード例 #2
0
ファイル: itunescopy.py プロジェクト: tylerball/dotfiles
"""
copies items to itunes library
"""
import os
import sys
import argparse
import shutil
from beets import config, ui, util, logging
from beets.plugins import BeetsPlugin
from beets.ui import print_, Subcommand
from beets.ui.commands import import_cmd, default_commands
from beetsplug import convert

default_commands[default_commands.index(import_cmd)].parser.add_option(
    '-u', '--itunes', help='copy to itunes', default=False, dest='copyitunes',
    action='store_true'
)

default_commands[default_commands.index(import_cmd)].parser.add_option(
    '-U', '--noitunes', help='don\'t copy to itunes', default=False, dest='nocopyitunes',
    action='store_true'
)

class iTunesPlugin(BeetsPlugin):
    def __init__(self):
        super(iTunesPlugin, self).__init__()
        self.dest_dir = util.bytestring_path(os.path.abspath(os.path.expanduser(
            config['itunescopy']['dest'].get(unicode)
        )))
        self.convert = convert.ConvertPlugin()
        self.convert_cmd = convert.get_format('mp3')[0]