3 * Copyright (C) 2005-2013 Team XBMC
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with XBMC; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
22 #include "threads/CriticalSection.h"
23 #include "threads/Thread.h"
25 typedef struct cmyth_ringbuf *cmyth_ringbuf_t;
26 typedef struct cmyth_conn *cmyth_conn_t;
27 typedef struct cmyth_recorder *cmyth_recorder_t;
28 typedef struct cmyth_proginfo *cmyth_proginfo_t;
29 typedef struct cmyth_proglist *cmyth_proglist_t;
30 typedef struct cmyth_file *cmyth_file_t;
31 typedef struct cmyth_database *cmyth_database_t;
32 typedef struct cmyth_timestamp *cmyth_timestamp_t;
46 static CMythSession* AquireSession(const CURL& url);
47 static void ReleaseSession(CMythSession*);
48 static void CheckIdle();
49 static void LogCMyth(int level, char *msg);
54 virtual ~IEventListener() {};
55 virtual void OnEvent(int event, const std::string& data)=0;
58 bool SetListener(IEventListener *listener);
59 cmyth_conn_t GetControl();
60 cmyth_database_t GetDatabase();
61 DllLibCMyth* GetLibrary();
62 cmyth_proglist_t GetAllRecordedPrograms();
63 void ResetAllRecordedPrograms();
65 void SetFileItemMetaData(CFileItem &item, cmyth_proginfo_t program);
67 CDateTime GetValue(cmyth_timestamp_t t);
68 CStdString GetValue(char* str);
71 CMythSession(const CURL& url);
74 virtual void Process();
76 bool CanSupport(const CURL& url);
79 void SetSeasonAndEpisode(const cmyth_proginfo_t &program, int *season, int *epsiode);
81 IEventListener* m_listener;
82 cmyth_conn_t m_control;
84 cmyth_database_t m_database;
85 CStdString m_hostname;
86 CStdString m_username;
87 CStdString m_password;
90 CCriticalSection m_section;
91 unsigned int m_timestamp;
92 cmyth_proglist_t m_all_recorded; // Cache of all_recorded programs.
94 static CCriticalSection m_section_session;
95 static std::vector<CMythSession*> m_sessions;