2014-10-22 16:15:23 +00:00
|
|
|
#!/usr/bin/env python
|
2013-09-05 15:17:25 +00:00
|
|
|
# coding: utf-8
|
|
|
|
|
2014-03-02 17:31:32 +00:00
|
|
|
# This file is part of Supysonic.
|
|
|
|
# Supysonic is a Python implementation of the Subsonic server API.
|
|
|
|
#
|
2017-12-08 21:02:12 +00:00
|
|
|
# Copyright (C) 2017 Alban 'spl0k' Féron
|
2014-03-02 17:31:32 +00:00
|
|
|
#
|
2017-12-08 21:02:12 +00:00
|
|
|
# Distributed under terms of the GNU AGPLv3 license.
|
2014-03-02 17:31:32 +00:00
|
|
|
|
2017-12-08 21:02:12 +00:00
|
|
|
import sys
|
2013-09-05 15:17:25 +00:00
|
|
|
|
2017-12-08 21:02:12 +00:00
|
|
|
from supysonic.cli import SupysonicCLI
|
2017-11-27 21:30:13 +00:00
|
|
|
from supysonic.config import IniConfig
|
2017-12-17 22:25:34 +00:00
|
|
|
from supysonic.db import get_database, release_database
|
2013-09-07 10:58:28 +00:00
|
|
|
|
2013-09-05 15:17:25 +00:00
|
|
|
if __name__ == "__main__":
|
2017-11-27 21:30:13 +00:00
|
|
|
config = IniConfig.from_common_locations()
|
2017-12-17 22:25:34 +00:00
|
|
|
db = get_database(config.BASE['database_uri'])
|
2017-11-27 21:30:13 +00:00
|
|
|
|
2017-12-08 21:02:12 +00:00
|
|
|
cli = SupysonicCLI(config)
|
2017-11-27 21:30:13 +00:00
|
|
|
if len(sys.argv) > 1:
|
|
|
|
cli.onecmd(' '.join(sys.argv[1:]))
|
|
|
|
else:
|
|
|
|
cli.cmdloop()
|
2013-09-05 15:17:25 +00:00
|
|
|
|
2017-12-17 22:25:34 +00:00
|
|
|
release_database(db)
|
|
|
|
|