# Path: trackma/tracker/tracker.py
# class TrackerBase(object):
#     def __init__(self, messenger, tracker_list, config, watch_dirs, redirections=None):
#     def set_message_handler(self, message_handler):
#     def disable(self):
#     def update_list(self, tracker_list):
#     def connect_signal(self, signal, callback):
#     def observe(self, config, watch_dirs):
#     def get_status(self):
#     def _emit_signal(self, signal, *args):
#     def _update_show(self, state, show_tuple):
#                 def action(): return self._emit_signal('update', show, episode)
#                 def action(): return self._emit_signal('unrecognised', show, episode)
#     def _ignore_current(self):
#     def _update_state(self, state):
#     def pause_timer(self):
#     def resume_timer(self):
#     def update_show_if_needed(self, state, show_tuple):
#     def _get_playing_show(self, filename):


import time
import os
import requests
from trackma.tracker import tracker
            elif self.status_log[-1] == CLAIMED and self.status_log[-2] == CLAIMED:
                self.msg.warn(
                    self.name, "Claimed Jellyfin, login in the settings and restart trackma.")
            elif self.status_log[-1] == NOT_RUNNING and self.status_log[-2] == NOT_RUNNING:
                self.msg.warn(self.name, "Jellyfin is not running.")

            del self.status_log[0]

            # Wait for the interval before running check again
            time.sleep(config['tracker_interval'])

    def _get_sessions_info(self):
        session_url = self.host_port+"/Sessions?api_key={}".format(self.api_key)

        info = {
            "status": NOT_RUNNING,
            "state": PAUSED,
            "file_name": None,
            "view_offset": None
        }

        try:
            response = requests.get(session_url)
            response_json = response.json()
        except requests.exceptions.ConnectionError:
            return info

        for session in response_json:
            if not 'UserName' in session:
                continue

# Path: trackma/tracker/tracker.py
# class TrackerBase(object):
#     def __init__(self, messenger, tracker_list, config, watch_dirs, redirections=None):
#     def set_message_handler(self, message_handler):
#     def disable(self):
#     def update_list(self, tracker_list):
#     def connect_signal(self, signal, callback):
#     def observe(self, config, watch_dirs):
#     def get_status(self):
#     def _emit_signal(self, signal, *args):
#     def _update_show(self, state, show_tuple):
#                 def action(): return self._emit_signal('update', show, episode)
#                 def action(): return self._emit_signal('unrecognised', show, episode)
#     def _ignore_current(self):
#     def _update_state(self, state):
#     def pause_timer(self):
#     def resume_timer(self):
#     def update_show_if_needed(self, state, show_tuple):
#     def _get_playing_show(self, filename):


# Path: trackma/tracker/jellyfin.py
import time
import os
import requests
from trackma.tracker import tracker

            elif self.status_log[-1] == CLAIMED and self.status_log[-2] == CLAIMED:
                self.msg.warn(
                    self.name, "Claimed Jellyfin, login in the settings and restart trackma.")
            elif self.status_log[-1] == NOT_RUNNING and self.status_log[-2] == NOT_RUNNING:
                self.msg.warn(self.name, "Jellyfin is not running.")

            del self.status_log[0]

            # Wait for the interval before running check again
            time.sleep(config['tracker_interval'])

    def _get_sessions_info(self):
        session_url = self.host_port+"/Sessions?api_key={}".format(self.api_key)

        info = {
            "status": NOT_RUNNING,
            "state": PAUSED,
            "file_name": None,
            "view_offset": None
        }

        try:
            response = requests.get(session_url)
            response_json = response.json()
        except requests.exceptions.ConnectionError:
            return info

        for session in response_json:
            if not 'UserName' in session:
                continue

            if session['UserName'] != self.username: