# Path: munin/easy.py
# class EasySession(Session):
#     @staticmethod
#     def from_name(name='EasySession'):
#         return Session.from_name(name)
# 
#     def __init__(self, name='EasySession', disabled_attrs=None):
# 
#         mask = {
#             'artist': pairup(
#                 ArtistNormalizeProvider(compress=True),
#                 None,
#                 0.5,
#             ),
#             'album': pairup(
#                 AlbumNormalizeProvider(compress=True),
#                 None,
#                 0.5,
#             ),
#             'title': pairup(
#                 TitleNormalizeProvider(compress=False) | StemProvider(),
#                 LevenshteinDistance(),
#                 1,
#             ),
#             'date': pairup(
#                 DateProvider(),
#                 DateDistance(),
#                 2
#             ),
#             'bpm': pairup(
#                 BPMCachedProvider(),
#                 BPMDistance(),
#                 3
#             ),
#             'lyrics': pairup(
#                 KeywordsProvider(),
#                 KeywordsDistance(),
#                 3
#             ),
#             'rating': pairup(
#                 None,
#                 RatingDistance(),
#                 2
#             ),
#             'genre': pairup(
#                 GenreTreeProvider(),
#                 GenreTreeAvgDistance(),
#                 4
#             ),
#             'moodbar': pairup(
#                 MoodbarAudioFileProvider(),
#                 MoodbarDistance(),
#                 5
#             )
#         }
# 
#         if not check_for_moodbar():
#             logging.warning('Disabling moodbar attr, no binary found in PATH.')
#             del mask['moodbar']
# 
#         if not check_for_bpmtools():
#             logging.warning("Disabling bpm attr, no binary found in PATH.")
#             del mask['bpm']
# 
#         for disabled_attr in disabled_attrs or []:
#             try:
#                 del mask[disabled_attr]
#             except KeyError:
#                 pass
# 
#         Session.__init__(self, name, mask)


import time
import json
import logging
import dbus
import dbus.service
from munin.easy import EasySession
from dbus.mainloop.glib import DBusGMainLoop
from gi.repository import GLib
MUNIN_INTERFACE = 'org.libmunin.Session'

# Stdlib:
LOGGER = logging.getLogger(__name__)

# Internal:


# External


class MuninRemoteServer(dbus.service.Object):
    def __init__(self):
        # DBUS data:
        bus = dbus.SessionBus()
        bus_name = dbus.service.BusName(MUNIN_BUS_NAME, bus=bus)
        dbus.service.Object.__init__(self, bus_name, '/org/libmunin')

    @dbus.service.method(MUNIN_BUS_NAME)
    def create(self, name):
        pass

    @dbus.service.method(MUNIN_BUS_NAME)
    def load(self, path):
        pass


class DBUSRemoteSession(dbus.service.Object):
    def __init__(self):
        # Application data:

# Path: munin/easy.py
# class EasySession(Session):
#     @staticmethod
#     def from_name(name='EasySession'):
#         return Session.from_name(name)
# 
#     def __init__(self, name='EasySession', disabled_attrs=None):
# 
#         mask = {
#             'artist': pairup(
#                 ArtistNormalizeProvider(compress=True),
#                 None,
#                 0.5,
#             ),
#             'album': pairup(
#                 AlbumNormalizeProvider(compress=True),
#                 None,
#                 0.5,
#             ),
#             'title': pairup(
#                 TitleNormalizeProvider(compress=False) | StemProvider(),
#                 LevenshteinDistance(),
#                 1,
#             ),
#             'date': pairup(
#                 DateProvider(),
#                 DateDistance(),
#                 2
#             ),
#             'bpm': pairup(
#                 BPMCachedProvider(),
#                 BPMDistance(),
#                 3
#             ),
#             'lyrics': pairup(
#                 KeywordsProvider(),
#                 KeywordsDistance(),
#                 3
#             ),
#             'rating': pairup(
#                 None,
#                 RatingDistance(),
#                 2
#             ),
#             'genre': pairup(
#                 GenreTreeProvider(),
#                 GenreTreeAvgDistance(),
#                 4
#             ),
#             'moodbar': pairup(
#                 MoodbarAudioFileProvider(),
#                 MoodbarDistance(),
#                 5
#             )
#         }
# 
#         if not check_for_moodbar():
#             logging.warning('Disabling moodbar attr, no binary found in PATH.')
#             del mask['moodbar']
# 
#         if not check_for_bpmtools():
#             logging.warning("Disabling bpm attr, no binary found in PATH.")
#             del mask['bpm']
# 
#         for disabled_attr in disabled_attrs or []:
#             try:
#                 del mask[disabled_attr]
#             except KeyError:
#                 pass
# 
#         Session.__init__(self, name, mask)


# Path: munin/dbus_service.py
import time
import json
import logging
import dbus
import dbus.service
from munin.easy import EasySession
from dbus.mainloop.glib import DBusGMainLoop
from gi.repository import GLib

MUNIN_INTERFACE = 'org.libmunin.Session'

# Stdlib:
LOGGER = logging.getLogger(__name__)

# Internal:


# External


class MuninRemoteServer(dbus.service.Object):
    def __init__(self):
        # DBUS data:
        bus = dbus.SessionBus()
        bus_name = dbus.service.BusName(MUNIN_BUS_NAME, bus=bus)
        dbus.service.Object.__init__(self, bus_name, '/org/libmunin')

    @dbus.service.method(MUNIN_BUS_NAME)
    def create(self, name):
        pass

    @dbus.service.method(MUNIN_BUS_NAME)
    def load(self, path):
        pass


class DBUSRemoteSession(dbus.service.Object):
    def __init__(self):
        # Application data:

        self._session = EasySession()