2013-04-27 09:54:57 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2019-04-13 13:00:22 +00:00
|
|
|
##########################################################################
|
|
|
|
# OpenLP - Open Source Lyrics Projection #
|
|
|
|
# ---------------------------------------------------------------------- #
|
2020-12-30 21:42:49 +00:00
|
|
|
# Copyright (c) 2008-2021 OpenLP Developers #
|
2019-04-13 13:00:22 +00:00
|
|
|
# ---------------------------------------------------------------------- #
|
|
|
|
# This program is free software: you can redistribute it and/or modify #
|
|
|
|
# it under the terms of the GNU General Public License as published by #
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or #
|
|
|
|
# (at your option) any later version. #
|
|
|
|
# #
|
|
|
|
# This program is distributed in the hope that it will be useful, #
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
|
|
|
# GNU General Public License for more details. #
|
|
|
|
# #
|
|
|
|
# You should have received a copy of the GNU General Public License #
|
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
|
|
|
|
##########################################################################
|
2013-04-27 09:54:57 +00:00
|
|
|
"""
|
|
|
|
The :mod:`osdinteraction` provides miscellaneous functions for interacting with
|
|
|
|
OSD files.
|
|
|
|
"""
|
2013-08-25 18:31:15 +00:00
|
|
|
import json
|
2017-12-28 08:22:55 +00:00
|
|
|
import os
|
2013-04-27 09:54:57 +00:00
|
|
|
|
|
|
|
from tests.utils.constants import TEST_RESOURCES_PATH
|
|
|
|
|
|
|
|
|
|
|
|
def read_service_from_file(file_name):
|
|
|
|
"""
|
|
|
|
Reads an OSD file and returns the first service item found therein.
|
|
|
|
@param file_name: File name of an OSD file residing in the tests/resources folder.
|
|
|
|
@return: The service contained in the file.
|
|
|
|
"""
|
2014-12-06 21:05:45 +00:00
|
|
|
service_file = os.path.join(TEST_RESOURCES_PATH, 'service', file_name)
|
2013-08-31 18:17:38 +00:00
|
|
|
with open(service_file, 'r') as open_file:
|
2013-08-25 18:31:15 +00:00
|
|
|
service = json.load(open_file)
|
2013-04-27 09:54:57 +00:00
|
|
|
return service
|