Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
SoundTentacle opened this issue Feb 7, 2013 · 5 comments
Labels
C-enhancement Category: A PR with an enhancement or an issue with an enhancement proposal
Milestone

Comments

@SoundTentacle
Copy link

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

@jodal
Copy link
Member

jodal commented Feb 7, 2013

I agree.

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

@SoundTentacle
Copy link
Author

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

@adamcik
Copy link
Member

adamcik commented Apr 3, 2013

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

@adamcik adamcik closed this as completed Apr 3, 2013
@jodal
Copy link
Member

jodal commented Apr 3, 2013

Changed milestone from v1.0 to v0.14.

@hcientist
Copy link

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
Labels
C-enhancement Category: A PR with an enhancement or an issue with an enhancement proposal
Projects
None yet
Development

No branches or pull requests

4 participants