Switch to unified view

a/rdpl2stream/lib/common.py b/rdpl2stream/lib/common.py
1
# -*- coding: utf-8 -*-
1
# -*- coding: utf-8 -*-
2
2
3
import os
3
APPVERSION="0.14"
4
import i18n
5
from xdg.BaseDirectory import xdg_data_home
6
7
try:
8
    from defs import *
9
except:
10
    APPVERSION = "0.7.3"
11
    datadir = "/usr/share"
12
13
# Application info
14
APPNAME = "Radio Tray"
15
APPDIRNAME = APPNAME.lower().replace(" ","")
16
17
COPYRIGHT_YEAR = '2009 - 2011'
18
COPYRIGHTS = "%s - Copyright (c) %s\n" \
19
             "Carlos Ribeiro <carlosmribeiro1@gmail.com>" % (APPNAME, COPYRIGHT_YEAR)
20
WEBSITE = "http://radiotray.sourceforge.net/"
21
AUTHORS = [
22
    _('Developers:'),
23
    "Carlos Ribeiro <carlosmribeiro1@gmail.com>",
24
    _('Contributors:'),
25
    'Og Maciel <ogmaciel@gnome.com>',
26
    'Ed Bruck <ed.bruck1@gmail.com>',
27
    'Behrooz Shabani <behrooz@rock.com>',
28
    'Valdur Kana <valdur55@gmail.com>',
29
]
30
31
ARTISTS = []
32
LICENSE = """Radio Tray
33
Copyright (C) %s - Carlos Ribeiro <carlosmribeiro1@gmail.com>.
34
35
Radio Tray is free software: you can redistribute it and/or modify
36
it under the terms of the GNU General Public License as published by
37
the Free Software Foundation, either version 3 of the License, or
38
(at your option) any later version.
39
40
Radio Tray is distributed in the hope that it will be useful,
41
but WITHOUT ANY WARRANTY; without even the implied warranty of
42
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
43
GNU General Public License for more details.
44
45
You should have received a copy of the GNU General Public License
46
along with Radio Tray.  If not, see <http://www.gnu.org/licenses/>.
47
""" % COPYRIGHT_YEAR
48
49
# Media path
50
if os.path.exists(os.path.abspath('../data/images/')):
51
    IMAGE_PATH = os.path.abspath('../data/images/')
52
else:
53
    IMAGE_PATH = '%s/%s/images' % (datadir, APPDIRNAME)
54
55
# Images
56
APP_ICON = os.path.join(IMAGE_PATH, 'radiotray.png')
57
APP_ICON_ON = os.path.join(IMAGE_PATH, 'radiotray_on.png')
58
APP_ICON_OFF = os.path.join(IMAGE_PATH, 'radiotray_off.png')
59
APP_ICON_CONNECT = os.path.join(IMAGE_PATH, 'radiotray_connecting.gif')
60
APP_INDICATOR_ICON_ON = "radiotray_on"
61
APP_INDICATOR_ICON_OFF = "radiotray_off"
62
APP_INDICATOR_ICON_CONNECT = "radiotray_connecting"
63
# Config info
64
CFG_NAME = 'bookmarks.xml'
65
OPTIONS_CFG_NAME = 'config.xml'
66
USER_CFG_PATH =  os.path.join(xdg_data_home, APPDIRNAME)
67
OLD_USER_CFG_PATH = os.environ['HOME'] + "/.radiotray/"
68
69
REL_CFG_DIR = os.path.abspath('../data/')
70
if os.path.exists(os.path.join(REL_CFG_DIR, CFG_NAME)):
71
    DEFAULT_CFG_PATH = REL_CFG_DIR
72
else:
73
    DEFAULT_CFG_PATH = '%s/%s/' % (datadir, APPDIRNAME)
74
75
DEFAULT_RADIO_LIST = os.path.join(DEFAULT_CFG_PATH, CFG_NAME)
76
DEFAULT_CONFIG_FILE = os.path.join(DEFAULT_CFG_PATH, OPTIONS_CFG_NAME)
77
78
# Plugins
79
SYSTEM_PLUGIN_PATH = os.path.join(DEFAULT_CFG_PATH, 'plugins')
80
USER_PLUGIN_PATH = os.path.join(USER_CFG_PATH, 'plugins')
81
82
#Logfile
83
LOGFILE = os.path.join(USER_CFG_PATH,'radiotray.log')
84
85
#temporary icon file
86
ICON_FILE = os.path.join(USER_CFG_PATH,'icon')
87
88
# user-agent
4
# user-agent
89
try:
5
try:
90
    import platform
6
    import platform
91
    USER_AGENT = "%s/%s (%s %s; %s/%s (%s))" % ("RadioTray", APPVERSION, platform.system(), platform.machine(),
7
    USER_AGENT = "%s/%s (%s %s; %s/%s (%s))" % ("Upmpdcli", APPVERSION, platform.system(), platform.machine(),
92
                                                platform.linux_distribution()[0], platform.linux_distribution()[1],
8
                                                platform.linux_distribution()[0], platform.linux_distribution()[1],
93
                                                platform.linux_distribution()[2])
9
                                                platform.linux_distribution()[2])
94
except:
10
except:
95
    USER_AGENT = "RadioTray/" + APPVERSION
11
    USER_AGENT = "Upmpdcli/" + APPVERSION