Add possibility to start multiple instances of mopidy on the same computer #329

Closed
SoundTentacle opened this Issue Feb 7, 2013 · 5 comments

Comments

Projects
None yet
4 participants

It would be nice to be able to start multiple instances of mopidy.
Every instance get its own settings.py-file which you has to specify as start parameter

Owner

jodal commented Feb 7, 2013

I agree.

Being able to specify the config file is a part of #280.

For everyone who need this at the moment:
I've made a "quick and dirty" hack to use mopidy multiple times (this have to be done on every update of mopidy).
a first quick test was successful ...

OS: Linux Mint 14

edit "/usr/lib/pymodules/python2.7/mopidy/utils/path.py"

insert into the "import ..." - Section:
import optparse

insert before the line:

logger = logging.getLogger('mopidy.utils.path')

the following:

def is_gst_arg(argument):
    return argument.startswith('--gst') or argument == '--help-gst'

gstreamer_args = [arg for arg in sys.argv[1:] if is_gst_arg(arg)]
mopidy_args = [arg for arg in sys.argv[1:] if not is_gst_arg(arg)]
sys.argv[1:] = gstreamer_args

parser = optparse.OptionParser()
parser.add_option(
        '-c', '--config',
        dest='config_file',
        help='path of the settings.py file')
options = parser.parse_args(args=mopidy_args)[0]

replace the line

XDG_CONFIG_DIR = glib.get_user_config_dir().decode('utf-8')

with

if options.config_file:
        XDG_CONFIG_DIR = options.config_file.decode('utf-8')
else:
        XDG_CONFIG_DIR = glib.get_user_config_dir().decode('utf-8')

Now you can start mopidy with "-c PATH/TO/CONFIG/"
For every new mopidy instance you have to create a new directory and place your settings.py-file there.
In this case: "PATH/TO/CONFIG/mopidy/settings.py"
The port-configs have to be different

Owner

adamcik commented Apr 3, 2013

Develop now supports --config=/etc/mopidy/mopidy.conf:$XDG_CONFIG_DIF/mopidy/mopidy.conf as of PR #385.

adamcik closed this Apr 3, 2013

Owner

jodal commented Apr 3, 2013

Changed milestone from v1.0 to v0.14.

how do we launch multiple instances? it looks like you're saying i should do something on the command line. looking at https://docs.mopidy.com/en/latest/config/ it doesn't look like there's a relevant setting (e.g. port)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment