#!/usr/bin/python3
"""
Your favorite Audio Cutter.
Author : Bilal Elmoussaoui (bil.elmoussaoui@gmail.com)
Artist : Alfredo Hernández
Website : https://github.com/bil-elmoussaoui/Audio-Cutter
This file is part of AudioCutter.
AudioCutter 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.
AudioCutter 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 AudioCutter. If not, see <http://www.gnu.org/licenses/>.
"""

import gettext
import locale
import sys
from os import path

sys.path.insert(1, '/usr/lib/python3.7/site-packages')
sys.path.append(path.join("/usr/lib64", 'AudioCutter/python'))

from gi import require_version
require_version("GES", "1.0")
from gi.repository import Gio, GES, Gst

if __name__ == "__main__":

    locale.bindtextdomain('audiocutter', '/usr/share/locale')
    locale.textdomain('audiocutter')
    gettext.bindtextdomain('audiocutter', '/usr/share/locale')
    gettext.textdomain('audiocutter')

    resource = Gio.resource_load(path.join('/usr/share/com.github.bilelmoussaoui.AudioCutter',
                                           'com.github.bilelmoussaoui.AudioCutter.gresource'))
    Gio.Resource._register(resource)

    Gst.init(sys.argv)
    res, sys.argv = GES.init_check(sys.argv)

    from AudioCutter.application import Application
    try:
        app = Application()
        exit_status = app.run(sys.argv)
        sys.exit(exit_status)
    except KeyboardInterrupt:
        exit()
