[PY3] change imports so they are py3-compatible
This commit is contained in:
parent
b25dd923ad
commit
101d5e04c6
8 changed files with 16 additions and 16 deletions
|
@ -1,7 +1,7 @@
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
import argparse
|
import argparse
|
||||||
from entrypoints_utils import get_one_entrypoint
|
from .entrypoints_utils import get_one_entrypoint
|
||||||
import json
|
import json
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
log = getLogger('audiogen')
|
log = getLogger('audiogen')
|
||||||
|
|
|
@ -4,7 +4,7 @@ import random
|
||||||
|
|
||||||
from mpd import MPDClient
|
from mpd import MPDClient
|
||||||
|
|
||||||
from config import get_conf
|
from .config import get_conf
|
||||||
|
|
||||||
|
|
||||||
def generate_by_artist(spec):
|
def generate_by_artist(spec):
|
||||||
|
@ -19,6 +19,6 @@ def generate_by_artist(spec):
|
||||||
log.debug("got %d artists" % len(artists))
|
log.debug("got %d artists" % len(artists))
|
||||||
if not artists:
|
if not artists:
|
||||||
raise ValueError("no artists in your mpd database")
|
raise ValueError("no artists in your mpd database")
|
||||||
for _ in xrange(spec['howmany']):
|
for _ in range(spec['howmany']):
|
||||||
artist = random.choice(artists)
|
artist = random.choice(artists)
|
||||||
yield random.choice(c.find('artist', artist))['file']
|
yield random.choice(c.find('artist', artist))['file']
|
||||||
|
|
|
@ -19,7 +19,7 @@ import logging
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from config import get_conf
|
from .config import get_conf
|
||||||
log = logging.getLogger('audioscript')
|
log = logging.getLogger('audioscript')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,9 @@ import gevent
|
||||||
from gevent.queue import Queue
|
from gevent.queue import Queue
|
||||||
from tinydb import TinyDB
|
from tinydb import TinyDB
|
||||||
|
|
||||||
from eventutils import ParentedLet
|
from .eventutils import ParentedLet
|
||||||
from timegen import timegenerate
|
from .timegen import timegenerate
|
||||||
from audiogen import audiogenerate
|
from .audiogen import audiogenerate
|
||||||
|
|
||||||
|
|
||||||
class EventModel(object):
|
class EventModel(object):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
log = getLogger('timeform')
|
log = getLogger('timeform')
|
||||||
from entrypoints_utils import get_one_entrypoint
|
from .entrypoints_utils import get_one_entrypoint
|
||||||
|
|
||||||
|
|
||||||
def get_timeform(kind):
|
def get_timeform(kind):
|
||||||
|
|
|
@ -5,8 +5,8 @@ import gevent
|
||||||
from gevent.queue import Queue
|
from gevent.queue import Queue
|
||||||
from mpd import MPDClient, ConnectionError, CommandError
|
from mpd import MPDClient, ConnectionError, CommandError
|
||||||
|
|
||||||
from eventutils import ParentedLet, Timer
|
from .eventutils import ParentedLet, Timer
|
||||||
from audiogen import audiogenerate
|
from .audiogen import audiogenerate
|
||||||
|
|
||||||
|
|
||||||
def get_mpd_client(conf):
|
def get_mpd_client(conf):
|
||||||
|
@ -69,7 +69,7 @@ class Player(gevent.Greenlet):
|
||||||
def add(greenlet):
|
def add(greenlet):
|
||||||
uris = greenlet.value
|
uris = greenlet.value
|
||||||
for uri in uris:
|
for uri in uris:
|
||||||
assert type(uri) is unicode, type(uri)
|
assert type(uri) is str, type(uri)
|
||||||
mpd_client.add(uri.strip())
|
mpd_client.add(uri.strip())
|
||||||
picker.link_value(add)
|
picker.link_value(add)
|
||||||
picker.start()
|
picker.start()
|
||||||
|
@ -80,7 +80,7 @@ class Player(gevent.Greenlet):
|
||||||
assert 'uris' in songs
|
assert 'uris' in songs
|
||||||
spec = songs['audiospec']
|
spec = songs['audiospec']
|
||||||
for uri in songs['uris']:
|
for uri in songs['uris']:
|
||||||
assert type(uri) is unicode
|
assert type(uri) is str
|
||||||
self.log.info('Adding {} to playlist (from {}={})'.
|
self.log.info('Adding {} to playlist (from {}={})'.
|
||||||
format(uri, songs['aid'], spec))
|
format(uri, songs['aid'], spec))
|
||||||
insert_pos = 0 if len(mpd_client.playlistid()) == 0 else \
|
insert_pos = 0 if len(mpd_client.playlistid()) == 0 else \
|
||||||
|
|
|
@ -20,7 +20,7 @@ def range_parentlet():
|
||||||
self.howmany = howmany
|
self.howmany = howmany
|
||||||
|
|
||||||
def do_business(self):
|
def do_business(self):
|
||||||
for i in xrange(self.howmany):
|
for i in range(self.howmany):
|
||||||
yield('range', i)
|
yield('range', i)
|
||||||
return RangeLet
|
return RangeLet
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,12 @@ main module to read and get informations about alarms
|
||||||
'''
|
'''
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
|
from datetime import datetime
|
||||||
import argparse
|
import argparse
|
||||||
from entrypoints_utils import get_one_entrypoint
|
|
||||||
import json
|
import json
|
||||||
|
from .entrypoints_utils import get_one_entrypoint
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
log = getLogger('timegen')
|
log = getLogger('timegen')
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
|
|
||||||
def get_timegenerator(kind):
|
def get_timegenerator(kind):
|
||||||
|
@ -52,7 +52,7 @@ def timegenerate(spec, now=None, howmany=1):
|
||||||
if now is not None:
|
if now is not None:
|
||||||
if type(now) is not datetime:
|
if type(now) is not datetime:
|
||||||
now = datetime.fromtimestamp(now)
|
now = datetime.fromtimestamp(now)
|
||||||
for _ in xrange(howmany):
|
for _ in range(howmany):
|
||||||
now = generator.next_ring(current_time=now)
|
now = generator.next_ring(current_time=now)
|
||||||
yield now
|
yield now
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue