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