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