1# Copyright (c) 2014-2021 Cedric Bellegarde <cedric.bellegarde@adishatz.org>
2# This program is free software: you can redistribute it and/or modify
3# it under the terms of the GNU General Public License as published by
4# the Free Software Foundation, either version 3 of the License, or
5# (at your option) any later version.
6# This program is distributed in the hope that it will be useful,
7# but WITHOUT ANY WARRANTY; without even the implied warranty of
8# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9# GNU General Public License for more details.
10# You should have received a copy of the GNU General Public License
11# along with this program. If not, see <http://www.gnu.org/licenses/>.
12
13# This is global object initialised at lollypop start
14# member init order is important!
15
16from gi.repository import Gio, GLib
17
18
19App = Gio.Application.get_default
20
21LASTFM_API_KEY = "7a9619a850ccf7377c46cf233c51e3c6"
22LASTFM_API_SECRET = "9254319364d73bec6c59ace485a95c98"
23
24DISCOGS_API_KEY = "vcKgyONtKsaQZLvpUfOU"
25DISCOGS_API_SECRET = "SmWphfGWALsmDnoyhPuQlDDQEIvFJuPM"
26
27GOOGLE_API_ID = "015987506728554693370:waw3yqru59a"
28
29MARGIN_BIG = 30
30MARGIN = 15
31MARGIN_MEDIUM = 10
32MARGIN_SMALL = 5
33
34LOLLYPOP_DATA_PATH = GLib.get_user_data_dir() + "/lollypop"
35# All cache goes here
36CACHE_PATH = GLib.get_user_cache_dir() + "/lollypop"
37# Stores for albums
38ALBUMS_PATH = LOLLYPOP_DATA_PATH + "/albums"
39ALBUMS_WEB_PATH = LOLLYPOP_DATA_PATH + "/albums_web"
40# Stores for artists
41ARTISTS_PATH = LOLLYPOP_DATA_PATH + "/artists"
42# Store for lyrics
43LYRICS_PATH = LOLLYPOP_DATA_PATH + "/lyrics"
44
45
46class TimeStamp:
47    ONE_YEAR = 31536000
48    TWO_YEAR = 63072000
49    THREE_YEAR = 94608000
50
51
52class FileType:
53    UNKNOWN = 0
54    AUDIO = 1
55    PLS = 2
56    OTHER = 3
57
58
59class Repeat:
60    NONE = 0
61    AUTO_SIMILAR = 1
62    AUTO_RANDOM = 2
63    TRACK = 3
64    ALL = 4
65
66
67class LovedFlags:
68    NONE = 1 << 0
69    LOVED = 1 << 1
70    SKIPPED = 1 << 2
71
72
73class GstPlayFlags:
74    GST_PLAY_FLAG_VIDEO = 1 << 0  # We want video output
75    GST_PLAY_FLAG_AUDIO = 1 << 1  # We want audio output
76    GST_PLAY_FLAG_TEXT = 1 << 3   # We want subtitle output
77
78
79class StorageType:
80    NONE = 1 << 0
81    COLLECTION = 1 << 1
82    EPHEMERAL = 1 << 2
83    SAVED = 1 << 3
84    SPOTIFY_NEW_RELEASES = 1 << 4
85    SPOTIFY_SIMILARS = 1 << 5
86    EXTERNAL = 1 << 6
87    SEARCH = 1 << 7
88    DEEZER_CHARTS = 1 << 8
89    ALL = 1 << 1 | 1 << 2 | 1 << 3 | 1 << 4 | 1 << 5 | 1 << 6 | 1 << 7 | 1 << 8
90
91
92class ArtBehaviour:
93    NONE = 1 << 0
94    ROUNDED = 1 << 1
95    ROUNDED_BORDER = 1 << 2
96    BLUR = 1 << 3
97    BLUR_HARD = 1 << 4
98    BLUR_MAX = 1 << 5
99    FALLBACK = 1 << 6
100    DARKER = 1 << 7
101    LIGHTER = 1 << 8
102    CROP = 1 << 9
103    CROP_SQUARE = 1 << 10
104    CACHE = 1 << 11
105    NO_CACHE = 1 << 12
106
107
108class ViewType:
109    DEFAULT = 1 << 0
110    TWO_COLUMNS = 1 << 1
111    SINGLE_COLUMN = 1 << 2
112    DND = 1 << 3
113    SEARCH = 1 << 4
114    PLAYLISTS = 1 << 5
115    ALBUM = 1 << 6
116    SMALL = 1 << 7
117    QUEUE = 1 << 8
118    SCROLLED = 1 << 9
119    OVERLAY = 1 << 10
120    FULLSCREEN = 1 << 11
121    PLAYBACK = 1 << 12
122    BANNER = 1 << 13
123    ARTIST = 1 << 14
124    TOOLBAR = 1 << 15
125
126
127NetworkAccessACL = {
128    "DATA": 1 << 1,
129    "LASTFM": 1 << 2,
130    "SPOTIFY": 1 << 3,
131    "YOUTUBE": 1 << 4,
132    "GOOGLE": 1 << 5,
133    "STARTPAGE": 1 << 6,
134    "WIKIPEDIA": 1 << 7,
135    "JAMENDO": 1 << 8,
136    "MUSICBRAINZ": 1 << 9,
137    "ITUNES": 1 << 10,
138    "DEEZER": 1 << 11,
139    "WIKIA": 1 << 12,
140    "GENIUS": 1 << 13,
141    "AUDIODB": 1 << 14,
142    "FANARTTV": 1 << 15,
143    "DUCKDUCKGO": 1 << 16,
144    "LIBREFM": 1 << 17,
145    "METROLYRICS": 1 << 18,
146    "BING": 1 << 19,
147}
148
149
150class StoreExtention:
151    JPG = 0
152    PNG = 1
153
154
155class LoadingState:
156    NONE = 0
157    RUNNING = 1
158    ABORTED = 2
159    FINISHED = 3
160
161
162class IndicatorType:
163    NONE = 1 << 0
164    PLAY = 1 << 1
165    LOVED = 1 << 2
166    SKIPPED = 1 << 3
167    LOADING = 1 << 4
168
169
170class ArtSize:
171    SMALL = 50     # Depends on cover-size in gsettings
172    MEDIUM = 100
173    BANNER = 150   # Depends on cover-size in gsettings
174    BIG = 200      # Depends on cover-size in gsettings
175    MINIPLAYER = 300
176    FULLSCREEN = 400
177    MPRIS = 900
178
179
180class ScanType:
181    EXTERNAL = 0
182    NEW_FILES = 1
183    FULL = 2
184
185
186class ScanUpdate:
187    ADDED = 0
188    REMOVED = 1
189    MODIFIED = 2
190
191
192class SelectionListMask:
193    NONE = 1 << 0
194    SIDEBAR = 1 << 1
195    FASTSCROLL = 1 << 2
196    ARTISTS = 1 << 3
197    GENRES = 1 << 4
198    PLAYLISTS = 1 << 5
199    COMPILATIONS = 1 << 6
200    LABEL = 1 << 7
201    ELLIPSIZE = 1 << 8
202
203
204class Notifications:
205    NONE = 0
206    ALL = 1
207    MPRIS = 2
208
209
210class PowerManagement:
211    NONE = 0             # Use OS defaults
212    IDLE = 1             # Inhibit screensaver
213    SUSPEND = 2          # Inhibit suspend
214    BOTH = 3             # Inhibit screensaver and suspend
215
216
217class ReplayGain:
218    NONE = 0
219    TRACK = 1
220    ALBUM = 1
221
222
223class Size:
224    MINI = 250
225    PHONE = 360  # Librem Phone
226    SMALL = 500
227    MEDIUM = 720
228    NORMAL = 850
229    BIG = 1000
230
231
232class OrderBy:
233    ARTIST_YEAR = 0
234    ARTIST_TITLE = 1
235    TITLE = 2
236    YEAR_DESC = 3
237    POPULARITY = 4
238    YEAR_ASC = 5
239
240
241# Order is important
242class Type:
243    NONE = -1
244    SUGGESTIONS = -2
245    POPULARS = -3
246    RANDOMS = -4
247    RECENTS = -5
248    LOVED = -6
249    LITTLE = -7
250    SKIPPED = -8
251    # WEB is stored in DB, can't be changed
252    WEB = -9
253    # Stored in DB, can't be changed
254    COMPILATIONS = -10
255    ARTISTS = -11
256    ARTISTS_LIST = -12
257    GENRES = -13
258    GENRES_LIST = -14
259    YEARS = -15
260    PLAYLISTS = -16
261    SMART = -19
262    EQUALIZER = -20
263    DEVICE_ALBUMS = -27
264    DEVICE_PLAYLISTS = -28
265    ALBUM = -29
266    ALL = -99
267    SEPARATOR = -100
268    CURRENT = -101
269    INFO = -102
270    SEARCH = -103
271    LYRICS = -104
272
273
274LATIN1_ENCODING = b"\x00"
275"""Byte code for latin1"""
276UTF_16_ENCODING = b"\x01"
277"""Byte code for UTF-16"""
278UTF_16BE_ENCODING = b"\x02"
279"""Byte code for UTF-16 (big endian)"""
280UTF_8_ENCODING = b"\x03"
281"""Byte code for UTF-8 (Not supported in ID3 versions < 2.4)"""
282
283
284SPOTIFY_CLIENT_ID = "0b144843878a46b2b12e0958c342c3ac"
285SPOTIFY_SECRET = "265ab8e057684f1b9e69e0c58f4881c1"
286AUDIODB_CLIENT_ID = "195003"
287FANARTTV_ID = "1cb10bc910c8d4fc34e0c78ac4e8ef46"
288