Move (un)pickle_connection from mopidy.{utils => process}. Utils should be as small as possible.
This commit is contained in:
parent
55b5645ba8
commit
5f16538f7e
@ -8,7 +8,8 @@ import sys
|
||||
|
||||
from mopidy import get_mpd_protocol_version, settings
|
||||
from mopidy.frontends.mpd.protocol import ENCODING, LINE_TERMINATOR
|
||||
from mopidy.utils import indent, pickle_connection
|
||||
from mopidy.process import pickle_connection
|
||||
from mopidy.utils import indent
|
||||
|
||||
logger = logging.getLogger('mopidy.frontends.mpd.server')
|
||||
|
||||
|
||||
@ -1,12 +1,23 @@
|
||||
import logging
|
||||
import multiprocessing
|
||||
from multiprocessing.reduction import reduce_connection
|
||||
import pickle
|
||||
import sys
|
||||
|
||||
from mopidy import settings, SettingsError
|
||||
from mopidy.utils import get_class, unpickle_connection
|
||||
from mopidy.utils import get_class
|
||||
|
||||
logger = logging.getLogger('mopidy.process')
|
||||
|
||||
def pickle_connection(connection):
|
||||
return pickle.dumps(reduce_connection(connection))
|
||||
|
||||
def unpickle_connection(pickled_connection):
|
||||
# From http://stackoverflow.com/questions/1446004
|
||||
(func, args) = pickle.loads(pickled_connection)
|
||||
return func(*args)
|
||||
|
||||
|
||||
class BaseProcess(multiprocessing.Process):
|
||||
def run(self):
|
||||
try:
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
import logging
|
||||
from multiprocessing.reduction import reduce_connection
|
||||
import os
|
||||
import pickle
|
||||
import sys
|
||||
import urllib
|
||||
|
||||
@ -54,14 +52,6 @@ def indent(string, places=4, linebreak='\n'):
|
||||
result += linebreak + ' ' * places + line
|
||||
return result
|
||||
|
||||
def pickle_connection(connection):
|
||||
return pickle.dumps(reduce_connection(connection))
|
||||
|
||||
def unpickle_connection(pickled_connection):
|
||||
# From http://stackoverflow.com/questions/1446004
|
||||
(func, args) = pickle.loads(pickled_connection)
|
||||
return func(*args)
|
||||
|
||||
def parse_m3u(file_path):
|
||||
"""
|
||||
Convert M3U file list of uris
|
||||
|
||||
Loading…
Reference in New Issue
Block a user