34 lines
1.1 KiB
Python
Executable file
34 lines
1.1 KiB
Python
Executable file
#!/usr/bin/python
|
|
# -*- coding: utf-8 -*-
|
|
# vi:si:et:sw=4:sts=4:ts=4
|
|
|
|
import os
|
|
import sys
|
|
from optparse import OptionParser
|
|
|
|
root = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')
|
|
if os.path.exists(os.path.join(root, 'oxcd')):
|
|
sys.path.insert(0, root)
|
|
|
|
import oxcd
|
|
import oxcd.itunes
|
|
import oxcd.rhythmbox
|
|
|
|
if __name__ == '__main__':
|
|
parser = OptionParser()
|
|
parser.add_option('-p', '--port', dest='port', help='port', default=2681)
|
|
parser.add_option('-i', '--itunes', dest='itunes', help='iTunes xml', default=oxcd.itunes.path())
|
|
parser.add_option('-r', '--rhythmbox', dest='rhythmbox', help='Rhythmbox xml', default=oxcd.rhythmbox.path())
|
|
(opts, args) = parser.parse_args()
|
|
|
|
print (opts.port, )
|
|
print not filter(None, (opts.itunes, opts.rhythmbox))
|
|
|
|
if None in (opts.port, ) or not filter(None, (opts.itunes, opts.rhythmbox)):
|
|
parser.print_help()
|
|
sys.exit()
|
|
if opts.itunes:
|
|
backend = oxcd.itunes.iTunes(opts.itunes)
|
|
elif opts.rhythmbox:
|
|
backend = oxcd.rhythmbox.Rhythmbox(opts.rhythmbox)
|
|
oxcd.main(opts.port, backend)
|