1.1 --- a/gmyth/src/gmyth_scheduler.c Wed Oct 24 18:41:42 2007 +0100
1.2 +++ b/gmyth/src/gmyth_scheduler.c Wed Oct 24 20:01:02 2007 +0100
1.3 @@ -982,8 +982,7 @@
1.4
1.5 gboolean
1.6 gmyth_scheduler_stop_recording (GMythScheduler * scheduler,
1.7 - gint channel_id,
1.8 - time_t start)
1.9 + gint channel_id)
1.10 {
1.11 GMythProgramInfo *program;
1.12 GMythSocket *socket;
2.1 --- a/gmyth/src/gmyth_scheduler.h Wed Oct 24 18:41:42 2007 +0100
2.2 +++ b/gmyth/src/gmyth_scheduler.h Wed Oct 24 20:01:02 2007 +0100
2.3 @@ -175,8 +175,7 @@
2.4 gint gmyth_scheduler_delete_recorded (GMythScheduler * scheduler,
2.5 gint record_id);
2.6 gboolean gmyth_scheduler_stop_recording (GMythScheduler * scheduler,
2.7 - gint channel_id,
2.8 - time_t start);
2.9 + gint channel_id);
2.10 void gmyth_scheduler_recorded_info_get_preview(RecordedInfo * info,
2.11 GByteArray * data);
2.12
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/myth-dbus/COPYING Wed Oct 24 20:01:02 2007 +0100
3.3 @@ -0,0 +1,340 @@
3.4 + GNU GENERAL PUBLIC LICENSE
3.5 + Version 2, June 1991
3.6 +
3.7 + Copyright (C) 1989, 1991 Free Software Foundation, Inc.
3.8 + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
3.9 + Everyone is permitted to copy and distribute verbatim copies
3.10 + of this license document, but changing it is not allowed.
3.11 +
3.12 + Preamble
3.13 +
3.14 + The licenses for most software are designed to take away your
3.15 +freedom to share and change it. By contrast, the GNU General Public
3.16 +License is intended to guarantee your freedom to share and change free
3.17 +software--to make sure the software is free for all its users. This
3.18 +General Public License applies to most of the Free Software
3.19 +Foundation's software and to any other program whose authors commit to
3.20 +using it. (Some other Free Software Foundation software is covered by
3.21 +the GNU Library General Public License instead.) You can apply it to
3.22 +your programs, too.
3.23 +
3.24 + When we speak of free software, we are referring to freedom, not
3.25 +price. Our General Public Licenses are designed to make sure that you
3.26 +have the freedom to distribute copies of free software (and charge for
3.27 +this service if you wish), that you receive source code or can get it
3.28 +if you want it, that you can change the software or use pieces of it
3.29 +in new free programs; and that you know you can do these things.
3.30 +
3.31 + To protect your rights, we need to make restrictions that forbid
3.32 +anyone to deny you these rights or to ask you to surrender the rights.
3.33 +These restrictions translate to certain responsibilities for you if you
3.34 +distribute copies of the software, or if you modify it.
3.35 +
3.36 + For example, if you distribute copies of such a program, whether
3.37 +gratis or for a fee, you must give the recipients all the rights that
3.38 +you have. You must make sure that they, too, receive or can get the
3.39 +source code. And you must show them these terms so they know their
3.40 +rights.
3.41 +
3.42 + We protect your rights with two steps: (1) copyright the software, and
3.43 +(2) offer you this license which gives you legal permission to copy,
3.44 +distribute and/or modify the software.
3.45 +
3.46 + Also, for each author's protection and ours, we want to make certain
3.47 +that everyone understands that there is no warranty for this free
3.48 +software. If the software is modified by someone else and passed on, we
3.49 +want its recipients to know that what they have is not the original, so
3.50 +that any problems introduced by others will not reflect on the original
3.51 +authors' reputations.
3.52 +
3.53 + Finally, any free program is threatened constantly by software
3.54 +patents. We wish to avoid the danger that redistributors of a free
3.55 +program will individually obtain patent licenses, in effect making the
3.56 +program proprietary. To prevent this, we have made it clear that any
3.57 +patent must be licensed for everyone's free use or not licensed at all.
3.58 +
3.59 + The precise terms and conditions for copying, distribution and
3.60 +modification follow.
3.61 +
3.62 + GNU GENERAL PUBLIC LICENSE
3.63 + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
3.64 +
3.65 + 0. This License applies to any program or other work which contains
3.66 +a notice placed by the copyright holder saying it may be distributed
3.67 +under the terms of this General Public License. The "Program", below,
3.68 +refers to any such program or work, and a "work based on the Program"
3.69 +means either the Program or any derivative work under copyright law:
3.70 +that is to say, a work containing the Program or a portion of it,
3.71 +either verbatim or with modifications and/or translated into another
3.72 +language. (Hereinafter, translation is included without limitation in
3.73 +the term "modification".) Each licensee is addressed as "you".
3.74 +
3.75 +Activities other than copying, distribution and modification are not
3.76 +covered by this License; they are outside its scope. The act of
3.77 +running the Program is not restricted, and the output from the Program
3.78 +is covered only if its contents constitute a work based on the
3.79 +Program (independent of having been made by running the Program).
3.80 +Whether that is true depends on what the Program does.
3.81 +
3.82 + 1. You may copy and distribute verbatim copies of the Program's
3.83 +source code as you receive it, in any medium, provided that you
3.84 +conspicuously and appropriately publish on each copy an appropriate
3.85 +copyright notice and disclaimer of warranty; keep intact all the
3.86 +notices that refer to this License and to the absence of any warranty;
3.87 +and give any other recipients of the Program a copy of this License
3.88 +along with the Program.
3.89 +
3.90 +You may charge a fee for the physical act of transferring a copy, and
3.91 +you may at your option offer warranty protection in exchange for a fee.
3.92 +
3.93 + 2. You may modify your copy or copies of the Program or any portion
3.94 +of it, thus forming a work based on the Program, and copy and
3.95 +distribute such modifications or work under the terms of Section 1
3.96 +above, provided that you also meet all of these conditions:
3.97 +
3.98 + a) You must cause the modified files to carry prominent notices
3.99 + stating that you changed the files and the date of any change.
3.100 +
3.101 + b) You must cause any work that you distribute or publish, that in
3.102 + whole or in part contains or is derived from the Program or any
3.103 + part thereof, to be licensed as a whole at no charge to all third
3.104 + parties under the terms of this License.
3.105 +
3.106 + c) If the modified program normally reads commands interactively
3.107 + when run, you must cause it, when started running for such
3.108 + interactive use in the most ordinary way, to print or display an
3.109 + announcement including an appropriate copyright notice and a
3.110 + notice that there is no warranty (or else, saying that you provide
3.111 + a warranty) and that users may redistribute the program under
3.112 + these conditions, and telling the user how to view a copy of this
3.113 + License. (Exception: if the Program itself is interactive but
3.114 + does not normally print such an announcement, your work based on
3.115 + the Program is not required to print an announcement.)
3.116 +
3.117 +These requirements apply to the modified work as a whole. If
3.118 +identifiable sections of that work are not derived from the Program,
3.119 +and can be reasonably considered independent and separate works in
3.120 +themselves, then this License, and its terms, do not apply to those
3.121 +sections when you distribute them as separate works. But when you
3.122 +distribute the same sections as part of a whole which is a work based
3.123 +on the Program, the distribution of the whole must be on the terms of
3.124 +this License, whose permissions for other licensees extend to the
3.125 +entire whole, and thus to each and every part regardless of who wrote it.
3.126 +
3.127 +Thus, it is not the intent of this section to claim rights or contest
3.128 +your rights to work written entirely by you; rather, the intent is to
3.129 +exercise the right to control the distribution of derivative or
3.130 +collective works based on the Program.
3.131 +
3.132 +In addition, mere aggregation of another work not based on the Program
3.133 +with the Program (or with a work based on the Program) on a volume of
3.134 +a storage or distribution medium does not bring the other work under
3.135 +the scope of this License.
3.136 +
3.137 + 3. You may copy and distribute the Program (or a work based on it,
3.138 +under Section 2) in object code or executable form under the terms of
3.139 +Sections 1 and 2 above provided that you also do one of the following:
3.140 +
3.141 + a) Accompany it with the complete corresponding machine-readable
3.142 + source code, which must be distributed under the terms of Sections
3.143 + 1 and 2 above on a medium customarily used for software interchange; or,
3.144 +
3.145 + b) Accompany it with a written offer, valid for at least three
3.146 + years, to give any third party, for a charge no more than your
3.147 + cost of physically performing source distribution, a complete
3.148 + machine-readable copy of the corresponding source code, to be
3.149 + distributed under the terms of Sections 1 and 2 above on a medium
3.150 + customarily used for software interchange; or,
3.151 +
3.152 + c) Accompany it with the information you received as to the offer
3.153 + to distribute corresponding source code. (This alternative is
3.154 + allowed only for noncommercial distribution and only if you
3.155 + received the program in object code or executable form with such
3.156 + an offer, in accord with Subsection b above.)
3.157 +
3.158 +The source code for a work means the preferred form of the work for
3.159 +making modifications to it. For an executable work, complete source
3.160 +code means all the source code for all modules it contains, plus any
3.161 +associated interface definition files, plus the scripts used to
3.162 +control compilation and installation of the executable. However, as a
3.163 +special exception, the source code distributed need not include
3.164 +anything that is normally distributed (in either source or binary
3.165 +form) with the major components (compiler, kernel, and so on) of the
3.166 +operating system on which the executable runs, unless that component
3.167 +itself accompanies the executable.
3.168 +
3.169 +If distribution of executable or object code is made by offering
3.170 +access to copy from a designated place, then offering equivalent
3.171 +access to copy the source code from the same place counts as
3.172 +distribution of the source code, even though third parties are not
3.173 +compelled to copy the source along with the object code.
3.174 +
3.175 + 4. You may not copy, modify, sublicense, or distribute the Program
3.176 +except as expressly provided under this License. Any attempt
3.177 +otherwise to copy, modify, sublicense or distribute the Program is
3.178 +void, and will automatically terminate your rights under this License.
3.179 +However, parties who have received copies, or rights, from you under
3.180 +this License will not have their licenses terminated so long as such
3.181 +parties remain in full compliance.
3.182 +
3.183 + 5. You are not required to accept this License, since you have not
3.184 +signed it. However, nothing else grants you permission to modify or
3.185 +distribute the Program or its derivative works. These actions are
3.186 +prohibited by law if you do not accept this License. Therefore, by
3.187 +modifying or distributing the Program (or any work based on the
3.188 +Program), you indicate your acceptance of this License to do so, and
3.189 +all its terms and conditions for copying, distributing or modifying
3.190 +the Program or works based on it.
3.191 +
3.192 + 6. Each time you redistribute the Program (or any work based on the
3.193 +Program), the recipient automatically receives a license from the
3.194 +original licensor to copy, distribute or modify the Program subject to
3.195 +these terms and conditions. You may not impose any further
3.196 +restrictions on the recipients' exercise of the rights granted herein.
3.197 +You are not responsible for enforcing compliance by third parties to
3.198 +this License.
3.199 +
3.200 + 7. If, as a consequence of a court judgment or allegation of patent
3.201 +infringement or for any other reason (not limited to patent issues),
3.202 +conditions are imposed on you (whether by court order, agreement or
3.203 +otherwise) that contradict the conditions of this License, they do not
3.204 +excuse you from the conditions of this License. If you cannot
3.205 +distribute so as to satisfy simultaneously your obligations under this
3.206 +License and any other pertinent obligations, then as a consequence you
3.207 +may not distribute the Program at all. For example, if a patent
3.208 +license would not permit royalty-free redistribution of the Program by
3.209 +all those who receive copies directly or indirectly through you, then
3.210 +the only way you could satisfy both it and this License would be to
3.211 +refrain entirely from distribution of the Program.
3.212 +
3.213 +If any portion of this section is held invalid or unenforceable under
3.214 +any particular circumstance, the balance of the section is intended to
3.215 +apply and the section as a whole is intended to apply in other
3.216 +circumstances.
3.217 +
3.218 +It is not the purpose of this section to induce you to infringe any
3.219 +patents or other property right claims or to contest validity of any
3.220 +such claims; this section has the sole purpose of protecting the
3.221 +integrity of the free software distribution system, which is
3.222 +implemented by public license practices. Many people have made
3.223 +generous contributions to the wide range of software distributed
3.224 +through that system in reliance on consistent application of that
3.225 +system; it is up to the author/donor to decide if he or she is willing
3.226 +to distribute software through any other system and a licensee cannot
3.227 +impose that choice.
3.228 +
3.229 +This section is intended to make thoroughly clear what is believed to
3.230 +be a consequence of the rest of this License.
3.231 +
3.232 + 8. If the distribution and/or use of the Program is restricted in
3.233 +certain countries either by patents or by copyrighted interfaces, the
3.234 +original copyright holder who places the Program under this License
3.235 +may add an explicit geographical distribution limitation excluding
3.236 +those countries, so that distribution is permitted only in or among
3.237 +countries not thus excluded. In such case, this License incorporates
3.238 +the limitation as if written in the body of this License.
3.239 +
3.240 + 9. The Free Software Foundation may publish revised and/or new versions
3.241 +of the General Public License from time to time. Such new versions will
3.242 +be similar in spirit to the present version, but may differ in detail to
3.243 +address new problems or concerns.
3.244 +
3.245 +Each version is given a distinguishing version number. If the Program
3.246 +specifies a version number of this License which applies to it and "any
3.247 +later version", you have the option of following the terms and conditions
3.248 +either of that version or of any later version published by the Free
3.249 +Software Foundation. If the Program does not specify a version number of
3.250 +this License, you may choose any version ever published by the Free Software
3.251 +Foundation.
3.252 +
3.253 + 10. If you wish to incorporate parts of the Program into other free
3.254 +programs whose distribution conditions are different, write to the author
3.255 +to ask for permission. For software which is copyrighted by the Free
3.256 +Software Foundation, write to the Free Software Foundation; we sometimes
3.257 +make exceptions for this. Our decision will be guided by the two goals
3.258 +of preserving the free status of all derivatives of our free software and
3.259 +of promoting the sharing and reuse of software generally.
3.260 +
3.261 + NO WARRANTY
3.262 +
3.263 + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
3.264 +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
3.265 +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
3.266 +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
3.267 +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
3.268 +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
3.269 +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
3.270 +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
3.271 +REPAIR OR CORRECTION.
3.272 +
3.273 + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
3.274 +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
3.275 +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
3.276 +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
3.277 +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
3.278 +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
3.279 +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
3.280 +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
3.281 +POSSIBILITY OF SUCH DAMAGES.
3.282 +
3.283 + END OF TERMS AND CONDITIONS
3.284 +
3.285 + How to Apply These Terms to Your New Programs
3.286 +
3.287 + If you develop a new program, and you want it to be of the greatest
3.288 +possible use to the public, the best way to achieve this is to make it
3.289 +free software which everyone can redistribute and change under these terms.
3.290 +
3.291 + To do so, attach the following notices to the program. It is safest
3.292 +to attach them to the start of each source file to most effectively
3.293 +convey the exclusion of warranty; and each file should have at least
3.294 +the "copyright" line and a pointer to where the full notice is found.
3.295 +
3.296 + <one line to give the program's name and a brief idea of what it does.>
3.297 + Copyright (C) <year> <name of author>
3.298 +
3.299 + This program is free software; you can redistribute it and/or modify
3.300 + it under the terms of the GNU General Public License as published by
3.301 + the Free Software Foundation; either version 2 of the License, or
3.302 + (at your option) any later version.
3.303 +
3.304 + This program is distributed in the hope that it will be useful,
3.305 + but WITHOUT ANY WARRANTY; without even the implied warranty of
3.306 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.307 + GNU General Public License for more details.
3.308 +
3.309 + You should have received a copy of the GNU General Public License
3.310 + along with this program; if not, write to the Free Software
3.311 + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
3.312 +
3.313 +
3.314 +Also add information on how to contact you by electronic and paper mail.
3.315 +
3.316 +If the program is interactive, make it output a short notice like this
3.317 +when it starts in an interactive mode:
3.318 +
3.319 + Gnomovision version 69, Copyright (C) year name of author
3.320 + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
3.321 + This is free software, and you are welcome to redistribute it
3.322 + under certain conditions; type `show c' for details.
3.323 +
3.324 +The hypothetical commands `show w' and `show c' should show the appropriate
3.325 +parts of the General Public License. Of course, the commands you use may
3.326 +be called something other than `show w' and `show c'; they could even be
3.327 +mouse-clicks or menu items--whatever suits your program.
3.328 +
3.329 +You should also get your employer (if you work as a programmer) or your
3.330 +school, if any, to sign a "copyright disclaimer" for the program, if
3.331 +necessary. Here is a sample; alter the names:
3.332 +
3.333 + Yoyodyne, Inc., hereby disclaims all copyright interest in the program
3.334 + `Gnomovision' (which makes passes at compilers) written by James Hacker.
3.335 +
3.336 + <signature of Ty Coon>, 1 April 1989
3.337 + Ty Coon, President of Vice
3.338 +
3.339 +This General Public License does not permit incorporating your program into
3.340 +proprietary programs. If your program is a subroutine library, you may
3.341 +consider it more useful to permit linking proprietary applications with the
3.342 +library. If this is what you want to do, use the GNU Library General
3.343 +Public License instead of this License.
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/myth-dbus/INSTALL Wed Oct 24 20:01:02 2007 +0100
4.3 @@ -0,0 +1,236 @@
4.4 +Installation Instructions
4.5 +*************************
4.6 +
4.7 +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
4.8 +Software Foundation, Inc.
4.9 +
4.10 +This file is free documentation; the Free Software Foundation gives
4.11 +unlimited permission to copy, distribute and modify it.
4.12 +
4.13 +Basic Installation
4.14 +==================
4.15 +
4.16 +These are generic installation instructions.
4.17 +
4.18 + The `configure' shell script attempts to guess correct values for
4.19 +various system-dependent variables used during compilation. It uses
4.20 +those values to create a `Makefile' in each directory of the package.
4.21 +It may also create one or more `.h' files containing system-dependent
4.22 +definitions. Finally, it creates a shell script `config.status' that
4.23 +you can run in the future to recreate the current configuration, and a
4.24 +file `config.log' containing compiler output (useful mainly for
4.25 +debugging `configure').
4.26 +
4.27 + It can also use an optional file (typically called `config.cache'
4.28 +and enabled with `--cache-file=config.cache' or simply `-C') that saves
4.29 +the results of its tests to speed up reconfiguring. (Caching is
4.30 +disabled by default to prevent problems with accidental use of stale
4.31 +cache files.)
4.32 +
4.33 + If you need to do unusual things to compile the package, please try
4.34 +to figure out how `configure' could check whether to do them, and mail
4.35 +diffs or instructions to the address given in the `README' so they can
4.36 +be considered for the next release. If you are using the cache, and at
4.37 +some point `config.cache' contains results you don't want to keep, you
4.38 +may remove or edit it.
4.39 +
4.40 + The file `configure.ac' (or `configure.in') is used to create
4.41 +`configure' by a program called `autoconf'. You only need
4.42 +`configure.ac' if you want to change it or regenerate `configure' using
4.43 +a newer version of `autoconf'.
4.44 +
4.45 +The simplest way to compile this package is:
4.46 +
4.47 + 1. `cd' to the directory containing the package's source code and type
4.48 + `./configure' to configure the package for your system. If you're
4.49 + using `csh' on an old version of System V, you might need to type
4.50 + `sh ./configure' instead to prevent `csh' from trying to execute
4.51 + `configure' itself.
4.52 +
4.53 + Running `configure' takes awhile. While running, it prints some
4.54 + messages telling which features it is checking for.
4.55 +
4.56 + 2. Type `make' to compile the package.
4.57 +
4.58 + 3. Optionally, type `make check' to run any self-tests that come with
4.59 + the package.
4.60 +
4.61 + 4. Type `make install' to install the programs and any data files and
4.62 + documentation.
4.63 +
4.64 + 5. You can remove the program binaries and object files from the
4.65 + source code directory by typing `make clean'. To also remove the
4.66 + files that `configure' created (so you can compile the package for
4.67 + a different kind of computer), type `make distclean'. There is
4.68 + also a `make maintainer-clean' target, but that is intended mainly
4.69 + for the package's developers. If you use it, you may have to get
4.70 + all sorts of other programs in order to regenerate files that came
4.71 + with the distribution.
4.72 +
4.73 +Compilers and Options
4.74 +=====================
4.75 +
4.76 +Some systems require unusual options for compilation or linking that the
4.77 +`configure' script does not know about. Run `./configure --help' for
4.78 +details on some of the pertinent environment variables.
4.79 +
4.80 + You can give `configure' initial values for configuration parameters
4.81 +by setting variables in the command line or in the environment. Here
4.82 +is an example:
4.83 +
4.84 + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
4.85 +
4.86 + *Note Defining Variables::, for more details.
4.87 +
4.88 +Compiling For Multiple Architectures
4.89 +====================================
4.90 +
4.91 +You can compile the package for more than one kind of computer at the
4.92 +same time, by placing the object files for each architecture in their
4.93 +own directory. To do this, you must use a version of `make' that
4.94 +supports the `VPATH' variable, such as GNU `make'. `cd' to the
4.95 +directory where you want the object files and executables to go and run
4.96 +the `configure' script. `configure' automatically checks for the
4.97 +source code in the directory that `configure' is in and in `..'.
4.98 +
4.99 + If you have to use a `make' that does not support the `VPATH'
4.100 +variable, you have to compile the package for one architecture at a
4.101 +time in the source code directory. After you have installed the
4.102 +package for one architecture, use `make distclean' before reconfiguring
4.103 +for another architecture.
4.104 +
4.105 +Installation Names
4.106 +==================
4.107 +
4.108 +By default, `make install' installs the package's commands under
4.109 +`/usr/local/bin', include files under `/usr/local/include', etc. You
4.110 +can specify an installation prefix other than `/usr/local' by giving
4.111 +`configure' the option `--prefix=PREFIX'.
4.112 +
4.113 + You can specify separate installation prefixes for
4.114 +architecture-specific files and architecture-independent files. If you
4.115 +pass the option `--exec-prefix=PREFIX' to `configure', the package uses
4.116 +PREFIX as the prefix for installing programs and libraries.
4.117 +Documentation and other data files still use the regular prefix.
4.118 +
4.119 + In addition, if you use an unusual directory layout you can give
4.120 +options like `--bindir=DIR' to specify different values for particular
4.121 +kinds of files. Run `configure --help' for a list of the directories
4.122 +you can set and what kinds of files go in them.
4.123 +
4.124 + If the package supports it, you can cause programs to be installed
4.125 +with an extra prefix or suffix on their names by giving `configure' the
4.126 +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
4.127 +
4.128 +Optional Features
4.129 +=================
4.130 +
4.131 +Some packages pay attention to `--enable-FEATURE' options to
4.132 +`configure', where FEATURE indicates an optional part of the package.
4.133 +They may also pay attention to `--with-PACKAGE' options, where PACKAGE
4.134 +is something like `gnu-as' or `x' (for the X Window System). The
4.135 +`README' should mention any `--enable-' and `--with-' options that the
4.136 +package recognizes.
4.137 +
4.138 + For packages that use the X Window System, `configure' can usually
4.139 +find the X include and library files automatically, but if it doesn't,
4.140 +you can use the `configure' options `--x-includes=DIR' and
4.141 +`--x-libraries=DIR' to specify their locations.
4.142 +
4.143 +Specifying the System Type
4.144 +==========================
4.145 +
4.146 +There may be some features `configure' cannot figure out automatically,
4.147 +but needs to determine by the type of machine the package will run on.
4.148 +Usually, assuming the package is built to be run on the _same_
4.149 +architectures, `configure' can figure that out, but if it prints a
4.150 +message saying it cannot guess the machine type, give it the
4.151 +`--build=TYPE' option. TYPE can either be a short name for the system
4.152 +type, such as `sun4', or a canonical name which has the form:
4.153 +
4.154 + CPU-COMPANY-SYSTEM
4.155 +
4.156 +where SYSTEM can have one of these forms:
4.157 +
4.158 + OS KERNEL-OS
4.159 +
4.160 + See the file `config.sub' for the possible values of each field. If
4.161 +`config.sub' isn't included in this package, then this package doesn't
4.162 +need to know the machine type.
4.163 +
4.164 + If you are _building_ compiler tools for cross-compiling, you should
4.165 +use the option `--target=TYPE' to select the type of system they will
4.166 +produce code for.
4.167 +
4.168 + If you want to _use_ a cross compiler, that generates code for a
4.169 +platform different from the build platform, you should specify the
4.170 +"host" platform (i.e., that on which the generated programs will
4.171 +eventually be run) with `--host=TYPE'.
4.172 +
4.173 +Sharing Defaults
4.174 +================
4.175 +
4.176 +If you want to set default values for `configure' scripts to share, you
4.177 +can create a site shell script called `config.site' that gives default
4.178 +values for variables like `CC', `cache_file', and `prefix'.
4.179 +`configure' looks for `PREFIX/share/config.site' if it exists, then
4.180 +`PREFIX/etc/config.site' if it exists. Or, you can set the
4.181 +`CONFIG_SITE' environment variable to the location of the site script.
4.182 +A warning: not all `configure' scripts look for a site script.
4.183 +
4.184 +Defining Variables
4.185 +==================
4.186 +
4.187 +Variables not defined in a site shell script can be set in the
4.188 +environment passed to `configure'. However, some packages may run
4.189 +configure again during the build, and the customized values of these
4.190 +variables may be lost. In order to avoid this problem, you should set
4.191 +them in the `configure' command line, using `VAR=value'. For example:
4.192 +
4.193 + ./configure CC=/usr/local2/bin/gcc
4.194 +
4.195 +causes the specified `gcc' to be used as the C compiler (unless it is
4.196 +overridden in the site shell script). Here is a another example:
4.197 +
4.198 + /bin/bash ./configure CONFIG_SHELL=/bin/bash
4.199 +
4.200 +Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
4.201 +configuration-related scripts to be executed by `/bin/bash'.
4.202 +
4.203 +`configure' Invocation
4.204 +======================
4.205 +
4.206 +`configure' recognizes the following options to control how it operates.
4.207 +
4.208 +`--help'
4.209 +`-h'
4.210 + Print a summary of the options to `configure', and exit.
4.211 +
4.212 +`--version'
4.213 +`-V'
4.214 + Print the version of Autoconf used to generate the `configure'
4.215 + script, and exit.
4.216 +
4.217 +`--cache-file=FILE'
4.218 + Enable the cache: use and save the results of the tests in FILE,
4.219 + traditionally `config.cache'. FILE defaults to `/dev/null' to
4.220 + disable caching.
4.221 +
4.222 +`--config-cache'
4.223 +`-C'
4.224 + Alias for `--cache-file=config.cache'.
4.225 +
4.226 +`--quiet'
4.227 +`--silent'
4.228 +`-q'
4.229 + Do not print messages saying which checks are being made. To
4.230 + suppress all normal output, redirect it to `/dev/null' (any error
4.231 + messages will still be shown).
4.232 +
4.233 +`--srcdir=DIR'
4.234 + Look for the package's source code in directory DIR. Usually
4.235 + `configure' can determine that directory automatically.
4.236 +
4.237 +`configure' also accepts some other, not widely useful, options. Run
4.238 +`configure --help' for more details.
4.239 +
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/myth-dbus/Makefile.am Wed Oct 24 20:01:02 2007 +0100
5.3 @@ -0,0 +1,7 @@
5.4 +SUBDIRS = src data
5.5 +
5.6 +EXTRA_DIST = \
5.7 + ChangeLog
5.8 +
5.9 +DIST_SUBDIRS = \
5.10 + src data
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/myth-dbus/autogen.sh Wed Oct 24 20:01:02 2007 +0100
6.3 @@ -0,0 +1,19 @@
6.4 +#!/bin/sh
6.5 +# Run this to generate all the initial makefiles, etc.
6.6 +
6.7 +srcdir=`dirname $0`
6.8 +test -z "$srcdir" && srcdir=.
6.9 +
6.10 +PKG_NAME="gmythdbus"
6.11 +
6.12 +(test -f $srcdir/configure.ac) || {
6.13 + echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
6.14 + echo " top-level $PKG_NAME directory"
6.15 + exit 1
6.16 +}
6.17 +
6.18 +which gnome-autogen.sh || {
6.19 + echo "You need to install gnome-common from the GNOME CVS"
6.20 + exit 1
6.21 +}
6.22 +REQUIRED_AUTOMAKE_VERSION=1.9 USE_GNOME2_MACROS=1 . gnome-autogen.sh
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/myth-dbus/configure.ac Wed Oct 24 20:01:02 2007 +0100
7.3 @@ -0,0 +1,90 @@
7.4 +# -*- Autoconf -*-
7.5 +# Process this file with autoconf to produce a configure script.
7.6 +
7.7 +AC_PREREQ(2.50)
7.8 +
7.9 +AC_INIT([myth-dbus],[0.1])
7.10 +
7.11 +AC_CONFIG_MACRO_DIR([m4])
7.12 +AC_CONFIG_HEADER(config.h)
7.13 +
7.14 +dnl AM_MAINTAINER_MODE provides the option to enable maintainer mode
7.15 +AM_MAINTAINER_MODE
7.16 +dnl make aclocal work in maintainer mode
7.17 +AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
7.18 +
7.19 +AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
7.20 +
7.21 +# Checks for programs.
7.22 +# check for tools
7.23 +# Make sure CFLAGS is defined to stop AC_PROC_CC adding -g
7.24 +CFLAGS="$CFLAGS -Wall"
7.25 +AC_PROG_CC
7.26 +AC_PROG_LIBTOOL
7.27 +
7.28 +# Checks for libraries.
7.29 +
7.30 +# Checks for header files.
7.31 +AC_HEADER_STDC
7.32 +
7.33 +#Test if --disable-debug given
7.34 +AC_ARG_ENABLE(debug,
7.35 + AC_HELP_STRING([--disable-debug], [enable debugging mode]))
7.36 +if test x"$enable_debug" != xno; then
7.37 + CFLAGS="$CFLAGS -g -DMYTH_STREAM_USE_DEBUG"
7.38 +else
7.39 + CFLAGS="$CFLAGS -O2 -DG_DISABLE_CHECKS"
7.40 +fi
7.41 +
7.42 +
7.43 +AS_AC_EXPAND(DATADIR, $datadir)
7.44 +
7.45 +DBUS_SERVICES_DIR="$DATADIR/dbus-1/services"
7.46 +AC_SUBST(DBUS_SERVICES_DIR)
7.47 +AC_DEFINE_UNQUOTED(DBUS_SERVICES_DIR, "$DBUS_SERVICES_DIR", [Where services dir for DBUS is])
7.48 +
7.49 +
7.50 +# Checks required packages ####################################################
7.51 +###############################################################################
7.52 +
7.53 +AC_PATH_PROG(DBUSBINDINGTOOL, dbus-binding-tool, no)
7.54 +if test "x$DBUSBINDINGTOOL" = "xno"; then
7.55 + AC_MSG_ERROR([dbus-binding-tool not found in your PATH. Please correct this])
7.56 +fi
7.57 +AC_SUBST(DBUS_BINDING_TOOL)
7.58 +
7.59 +AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no)
7.60 +if test "x$HAVE_PKGCONFIG" = "xno"; then
7.61 + AC_MSG_ERROR(you need to have pkgconfig installed !)
7.62 +fi
7.63 +
7.64 +PKG_CHECK_MODULES(DBUS, dbus-glib-1, HAVE_DBUS=yes, HAVE_DBUS=no)
7.65 +if test "x$HAVE_DBUS" = "xno"; then
7.66 + AC_MSG_ERROR(you need dbus-glib-1-dev installed)
7.67 +fi
7.68 +AC_SUBST(DBUS_CFLAGS)
7.69 +AC_SUBST(DBUS_LIBS)
7.70 +
7.71 +PKG_CHECK_MODULES(GMYTH, gmyth, HAVE_GMYTH=yes, HAVE_GMYTH=no)
7.72 +if test "x$HAVE_GMYTH" = "xno"; then
7.73 + AC_MSG_ERROR(you need libgmyth-dev installed)
7.74 +fi
7.75 +AC_SUBST(GMYTH_CFLAGS)
7.76 +AC_SUBST(GMYTH_LIBS)
7.77 +
7.78 +AC_SUBST(CFLAGS)
7.79 +AC_SUBST(LDFLAGS)
7.80 +AC_SUBST(LIBS)
7.81 +
7.82 +AC_OUTPUT([
7.83 +Makefile
7.84 +src/Makefile
7.85 +data/Makefile
7.86 +data/br.org.indt.GMyth.service
7.87 +])
7.88 +
7.89 +if test "x$enable_debug" != "xno"; then
7.90 + AC_MSG_NOTICE([Debug: Enabled])
7.91 +else
7.92 + AC_MSG_NOTICE([Debug: Disabled])
7.93 +fi
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/myth-dbus/data/Makefile.am Wed Oct 24 20:01:02 2007 +0100
8.3 @@ -0,0 +1,3 @@
8.4 +# Dbus service file
8.5 +servicedir = $(DBUS_SERVICES_DIR)
8.6 +service_DATA = br.org.indt.GMyth.service
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/myth-dbus/data/br.org.indt.GMyth.service.in Wed Oct 24 20:01:02 2007 +0100
9.3 @@ -0,0 +1,3 @@
9.4 +[D-BUS Service]
9.5 +Name=br.org.indt.GMyth
9.6 +Exec=@prefix@/bin/gmythdbus
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/myth-dbus/m4/as-expand.m4 Wed Oct 24 20:01:02 2007 +0100
10.3 @@ -0,0 +1,40 @@
10.4 +dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR)
10.5 +dnl
10.6 +dnl example
10.7 +dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
10.8 +dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local
10.9 +
10.10 +AC_DEFUN([AS_AC_EXPAND],
10.11 +[
10.12 + EXP_VAR=[$1]
10.13 + FROM_VAR=[$2]
10.14 +
10.15 + dnl first expand prefix and exec_prefix if necessary
10.16 + prefix_save=$prefix
10.17 + exec_prefix_save=$exec_prefix
10.18 +
10.19 + dnl if no prefix given, then use /usr/local, the default prefix
10.20 + if test "x$prefix" = "xNONE"; then
10.21 + prefix=$ac_default_prefix
10.22 + fi
10.23 + dnl if no exec_prefix given, then use prefix
10.24 + if test "x$exec_prefix" = "xNONE"; then
10.25 + exec_prefix=$prefix
10.26 + fi
10.27 +
10.28 + full_var="$FROM_VAR"
10.29 + dnl loop until it doesn't change anymore
10.30 + while true; do
10.31 + new_full_var="`eval echo $full_var`"
10.32 + if test "x$new_full_var"="x$full_var"; then break; fi
10.33 + full_var=$new_full_var
10.34 + done
10.35 +
10.36 + dnl clean up
10.37 + full_var=$new_full_var
10.38 + AC_SUBST([$1], "$full_var")
10.39 +
10.40 + dnl restore prefix and exec_prefix
10.41 + prefix=$prefix_save
10.42 + exec_prefix=$exec_prefix_save
10.43 +])
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/myth-dbus/src/Makefile.am Wed Oct 24 20:01:02 2007 +0100
11.3 @@ -0,0 +1,24 @@
11.4 +bin_PROGRAMS = \
11.5 + gmythdbus
11.6 +
11.7 +gmythdbus_SOURCES = \
11.8 + gmyth-dbus-server.h \
11.9 + gmyth-dbus-server.c \
11.10 + main.c
11.11 +
11.12 +gmythdbus_LDADD = \
11.13 + $(DBUS_LIBS) \
11.14 + $(GMYTH_LIBS)
11.15 +
11.16 +AM_CPPFLAGS = \
11.17 + $(DBUS_CFLAGS) \
11.18 + $(GMYTH_CFLAGS)
11.19 +
11.20 +BUILT_SOURCES = \
11.21 + gmyth-dbus-server-glue.h
11.22 +
11.23 +gmyth-dbus-server-glue.h: gmyth-dbus-server.xml
11.24 + @DBUSBINDINGTOOL@ --mode=glib-server --prefix=gmyth_dbus_server --output=gmyth-dbus-server-glue.h gmyth-dbus-server.xml
11.25 +
11.26 +CLEANFILES = \
11.27 + $(BUILT_SOURCES)
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2 +++ b/myth-dbus/src/gmyth-dbus-common.h Wed Oct 24 20:01:02 2007 +0100
12.3 @@ -0,0 +1,55 @@
12.4 +#ifndef __GMYTH_DBUS_COMMON_H__
12.5 +#define __GMYTH_DBUS_COMMON_H__
12.6 +
12.7 +#define GMYTH_DBUS_SERVER_NAME "/br/org/indt/GMyth"
12.8 +#define GMYTH_DBUS_SERVER_PATH "/br/org/indt/GMyth"
12.9 +#define GMYTH_DBUS_SERVER_IFACE "br.org.indt.GMyth"
12.10 +
12.11 +#define GMYTH_DBUS_PROGRAM_G_TYPE \
12.12 + dbus_g_type_get_struct ("GValueArray", \
12.13 + G_TYPE_STRING, \
12.14 + G_TYPE_STRING, \
12.15 + G_TYPE_STRING, \
12.16 + G_TYPE_STRING, \
12.17 + G_TYPE_STRING, \
12.18 + G_TYPE_STRING, \
12.19 + G_TYPE_STRING, \
12.20 + G_TYPE_INVALID);
12.21 +
12.22 +#define GMYTH_DBUS_CHANNEL_G_TYPE \
12.23 + dbus_g_type_get_struct ("GValueArray", \
12.24 + G_TYPE_INT, \
12.25 + G_TYPE_STRING, \
12.26 + G_TYPE_STRING, \
12.27 + G_TYPE_STRING, \
12.28 + G_TYPE_INVALID);
12.29 +
12.30 +#define GMYTH_DBUS_RECORD_G_TYPE \
12.31 + dbus_g_type_get_struct ("GValueArray", \
12.32 + G_TYPE_UINT, \
12.33 + G_TYPE_UINT, \
12.34 + G_TYPE_UINT, \
12.35 + G_TYPE_STRING, \
12.36 + G_TYPE_STRING, \
12.37 + G_TYPE_STRING, \
12.38 + G_TYPE_STRING, \
12.39 + G_TYPE_STRING, \
12.40 + G_TYPE_UINT64, \
12.41 + G_TYPE_INVALID);
12.42 +
12.43 +#define GMYTH_DBUS_SCHEDULE_G_TYPE \
12.44 + dbus_g_type_get_struct ("GValueArray", \
12.45 + G_TYPE_UINT, \
12.46 + G_TYPE_UINT, \
12.47 + G_TYPE_UINT, \
12.48 + G_TYPE_STRING, \
12.49 + G_TYPE_STRING, \
12.50 + G_TYPE_STRING, \
12.51 + G_TYPE_STRING, \
12.52 + G_TYPE_STRING, \
12.53 + G_TYPE_STRING, \
12.54 + G_TYPE_UINT, \
12.55 + G_TYPE_INVALID);
12.56 +
12.57 +#endif
12.58 +
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13.2 +++ b/myth-dbus/src/gmyth-dbus-server.c Wed Oct 24 20:01:02 2007 +0100
13.3 @@ -0,0 +1,1005 @@
13.4 +/**
13.5 + * GMyth Library
13.6 + *
13.7 + * @file gmyth/gmyth_backend_info.c
13.8 + *
13.9 + * @brief <p> This component represents all the MythTV backend server
13.10 + * configuration information.
13.11 + *
13.12 + * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
13.13 + * @author Renato Filho <renato.filho@indt.org.br>
13.14 + *
13.15 + *
13.16 + * This program is free software; you can redistribute it and/or modify
13.17 + * it under the terms of the GNU Lesser General Public License as published by
13.18 + * the Free Software Foundation; either version 2 of the License, or
13.19 + * (at your option) any later version.
13.20 + *
13.21 + * This program is distributed in the hope that it will be useful,
13.22 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
13.23 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13.24 + * GNU General Public License for more details.
13.25 + *
13.26 + * You should have received a copy of the GNU Lesser General Public License
13.27 + * along with this program; if not, write to the Free Software
13.28 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
13.29 + */
13.30 +
13.31 +
13.32 +#ifdef HAVE_CONFIG_H
13.33 +#include "config.h"
13.34 +#endif
13.35 +
13.36 +
13.37 +#include <gmyth/gmyth.h>
13.38 +#include <dbus/dbus-glib-bindings.h>
13.39 +
13.40 +
13.41 +#include "gmyth-dbus-common.h"
13.42 +#include "gmyth-dbus-server.h"
13.43 +
13.44 +#define MYTH_DEFAULT_DB "mythconverg"
13.45 +
13.46 +
13.47 +typedef struct _GMythDbusServerPrivate GMythDbusServerPrivate;
13.48 +
13.49 +struct _GMythDbusServerPrivate
13.50 +{
13.51 + GMythBackendInfo *myth_backend;
13.52 + GMythEPG *myth_epg;
13.53 + GMythScheduler *myth_scheduler;
13.54 +};
13.55 +
13.56 +#define GMYTH_DBUS_SERVER_GET_PRIVATE(o) \
13.57 + (G_TYPE_INSTANCE_GET_PRIVATE ((o), GMYTH_DBUS_SERVER_TYPE, GMythDbusServerPrivate))
13.58 +
13.59 +static void gmyth_dbus_server_class_init (GMythDbusServerClass *klass);
13.60 +static void gmyth_dbus_server_init (GMythDbusServer *self);
13.61 +static void gmyth_dbus_server_dispose (GObject *object);
13.62 +static void gmyth_dbus_server_finalize (GObject *object);
13.63 +
13.64 +/* Dbus */
13.65 +static gboolean gmyth_dbus_server_connect (GObject *obj,
13.66 + const gchar *host,
13.67 + guint port,
13.68 + const gchar *user,
13.69 + const gchar *password,
13.70 + gboolean *result,
13.71 + GError **error);
13.72 +static gboolean gmyth_dbus_server_get_channel_list (GObject *obj,
13.73 + GPtrArray **channels,
13.74 + GError **error);
13.75 +static gboolean gmyth_dbus_server_get_channel_info (GObject *obj,
13.76 + gint channel_id,
13.77 + GValue **info,
13.78 + GError **error);
13.79 +static gboolean gmyth_dbus_server_file_exists (GObject *obj,
13.80 + const gchar *file_name,
13.81 + gboolean *exists,
13.82 + GError **error);
13.83 +static gboolean gmyth_dbus_server_get_recorded_list (GObject *obj,
13.84 + GPtrArray **channels,
13.85 + GError **error);
13.86 +static gboolean gmyth_dbus_server_get_recorded_info (GObject *obj,
13.87 + const gchar *basename,
13.88 + GValue **info,
13.89 + GError **error);
13.90 +static gboolean gmyth_dbus_server_get_program_list (GObject *obj,
13.91 + gint channel_id,
13.92 + const gchar *start_time,
13.93 + const gchar *end_time,
13.94 + GPtrArray **program_list);
13.95 +static gboolean gmyth_dbus_server_get_schedule_list (GObject *obj,
13.96 + GPtrArray **schedule_list);
13.97 +
13.98 +static gboolean gmyth_dbus_server_connected (GObject *obj,
13.99 + gboolean *status,
13.100 + GError **error);
13.101 +static gboolean gmyth_dbus_server_disconnect (GObject *obj,
13.102 + GError **error);
13.103 +static gboolean gmyth_dbus_server_get_server_info (GObject *obj,
13.104 + guint64 *total_space,
13.105 + guint64 *used_space,
13.106 + guint64 *free_space,
13.107 + GError **error);
13.108 +static gboolean gmyth_dbus_server_get_thumbnail (GObject *obj,
13.109 + const gchar *uri,
13.110 + GByteArray **image,
13.111 + GError **error);
13.112 +static gboolean gmyth_dbus_server_get_channel_icon (GObject *obj,
13.113 + guint channel_id,
13.114 + GByteArray **icon,
13.115 + GError **error);
13.116 +static gboolean gmyth_dbus_server_stop_recording (GObject *obj,
13.117 + guint channel_id,
13.118 + gboolean *result,
13.119 + GError **error);
13.120 +static gboolean gmyth_dbus_server_add_schedule (GObject *obj,
13.121 + guint channel_id,
13.122 + guint program_id,
13.123 + const gchar *start_time,
13.124 + const gchar *end_time,
13.125 + gboolean recurring,
13.126 + const gchar *description,
13.127 + guint *schedule_id,
13.128 + GError **error);
13.129 +static gboolean gmyth_dbus_server_add_exception (GObject *obj,
13.130 + guint schedule_id,
13.131 + guint channel_id,
13.132 + guint program_id,
13.133 + const gchar *start_time,
13.134 + const gchar *end_time,
13.135 + const gchar *description,
13.136 + GError **error);
13.137 +static gboolean gmyth_dbus_server_remove_schedule (GObject *obj,
13.138 + guint schedule_id,
13.139 + GError **error);
13.140 +
13.141 +
13.142 +#include "gmyth-dbus-server-glue.h"
13.143 +
13.144 +
13.145 +G_DEFINE_TYPE (GMythDbusServer, gmyth_dbus_server, G_TYPE_OBJECT);
13.146 +
13.147 +static void
13.148 +gmyth_dbus_server_class_init (GMythDbusServerClass *klass)
13.149 +{
13.150 + GObjectClass *object_class = G_OBJECT_CLASS (klass);
13.151 +
13.152 + g_type_class_add_private (klass, sizeof (GMythDbusServerPrivate));
13.153 +
13.154 + object_class->dispose = gmyth_dbus_server_dispose;
13.155 + object_class->finalize = gmyth_dbus_server_finalize;
13.156 +
13.157 + dbus_g_object_type_install_info (GMYTH_DBUS_SERVER_TYPE,
13.158 + &dbus_glib_gmyth_dbus_server_object_info);
13.159 +}
13.160 +
13.161 +static void
13.162 +gmyth_dbus_server_init (GMythDbusServer *self)
13.163 +{
13.164 +}
13.165 +
13.166 +static void
13.167 +gmyth_dbus_server_dispose (GObject *object)
13.168 +{
13.169 + G_OBJECT_CLASS (gmyth_dbus_server_parent_class)->dispose (object);
13.170 +}
13.171 +
13.172 +static void
13.173 +gmyth_dbus_server_finalize (GObject *object)
13.174 +{
13.175 + G_OBJECT_CLASS (gmyth_dbus_server_parent_class)->finalize (object);
13.176 +}
13.177 +
13.178 +static gboolean
13.179 +gmyth_dbus_server_connect_epg (GMythDbusServer *server)
13.180 +{
13.181 + GMythDbusServerPrivate *priv;
13.182 + priv = GMYTH_DBUS_SERVER_GET_PRIVATE (server);
13.183 +
13.184 + if (!priv->myth_epg)
13.185 + {
13.186 + priv->myth_epg = gmyth_epg_new();
13.187 + if (!gmyth_epg_connect (priv->myth_epg, priv->myth_backend))
13.188 + {
13.189 + g_object_unref (priv->myth_epg);
13.190 + priv->myth_epg = NULL;
13.191 + return FALSE;
13.192 + }
13.193 + }
13.194 +
13.195 + return TRUE;
13.196 +}
13.197 +
13.198 +static gboolean
13.199 +gmyth_dbus_server_connect_scheduler (GMythDbusServer *server)
13.200 +{
13.201 + GMythDbusServerPrivate *priv;
13.202 + priv = GMYTH_DBUS_SERVER_GET_PRIVATE (server);
13.203 +
13.204 + if (!priv->myth_scheduler)
13.205 + {
13.206 + priv->myth_scheduler = gmyth_scheduler_new ();
13.207 + if (!gmyth_scheduler_connect (priv->myth_scheduler,
13.208 + priv->myth_backend))
13.209 + {
13.210 + g_object_unref (priv->myth_scheduler);
13.211 + priv->myth_scheduler = NULL;
13.212 + return FALSE;
13.213 + }
13.214 + }
13.215 +
13.216 + return TRUE;
13.217 +}
13.218 +
13.219 +static gboolean
13.220 +gmyth_dbus_server_connect (GObject *obj,
13.221 + const gchar *host,
13.222 + guint port,
13.223 + const gchar *user,
13.224 + const gchar *password,
13.225 + gboolean *result,
13.226 + GError **error)
13.227 +{
13.228 + GMythDbusServerPrivate *priv;
13.229 + priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
13.230 +
13.231 + if (priv->myth_backend)
13.232 + return TRUE;
13.233 +
13.234 + priv->myth_backend = gmyth_backend_info_new_full (host,
13.235 + user,
13.236 + password,
13.237 + MYTH_DEFAULT_DB,
13.238 + port);
13.239 + *result = TRUE;
13.240 + return TRUE;
13.241 +}
13.242 +
13.243 +static gboolean
13.244 +gmyth_dbus_server_connected (GObject *obj,
13.245 + gboolean *status,
13.246 + GError **error)
13.247 +{
13.248 + GMythDbusServerPrivate *priv;
13.249 + priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
13.250 +
13.251 + if (priv->myth_backend)
13.252 + *status = TRUE;
13.253 + else
13.254 + *status = FALSE;
13.255 + return TRUE;
13.256 +}
13.257 +
13.258 +static gboolean
13.259 +gmyth_dbus_server_disconnect (GObject *obj,
13.260 + GError **error)
13.261 +{
13.262 + GMythDbusServerPrivate *priv;
13.263 + priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
13.264 +
13.265 + if (priv->myth_epg)
13.266 + {
13.267 + g_object_unref (priv->myth_epg);
13.268 + priv->myth_epg = NULL;
13.269 + }
13.270 +
13.271 +
13.272 + if (priv->myth_backend)
13.273 + {
13.274 + g_object_unref (priv->myth_backend);
13.275 + priv->myth_backend = NULL;
13.276 + }
13.277 +
13.278 + if (priv->myth_scheduler)
13.279 + {
13.280 + g_object_unref (priv->myth_scheduler);
13.281 + priv->myth_scheduler = NULL;
13.282 + }
13.283 +
13.284 +
13.285 + return TRUE;
13.286 +}
13.287 +
13.288 +static gboolean
13.289 +gmyth_dbus_server_get_server_info (GObject *obj,
13.290 + guint64 *total_space,
13.291 + guint64 *used_space,
13.292 + guint64 *free_space,
13.293 + GError **error)
13.294 +{
13.295 + GMythBackendDetails *details;
13.296 + GMythDbusServerPrivate *priv;
13.297 + gboolean ret = FALSE;
13.298 + GMythSocket *socket;
13.299 +
13.300 + priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
13.301 +
13.302 + g_return_val_if_fail (priv->myth_backend != NULL, FALSE);
13.303 +
13.304 + socket = gmyth_backend_info_get_connected_socket (priv->myth_backend);
13.305 +
13.306 + details = NULL;
13.307 + gmyth_util_get_backend_details (socket,
13.308 + &details);
13.309 + if (details)
13.310 + {
13.311 + *total_space = details->total_space;
13.312 + *used_space = details->used_space;
13.313 + *free_space = *total_space - *used_space;
13.314 + gmyth_util_backend_details_free (details);
13.315 +
13.316 + ret = TRUE;
13.317 + }
13.318 +
13.319 + g_object_unref (socket);
13.320 +
13.321 + return ret;
13.322 +}
13.323 +
13.324 +
13.325 +static void
13.326 +gmyth_dbus_server_parse_channel_info (GMythChannelInfo *info,
13.327 + GValue *val)
13.328 +{
13.329 + dbus_g_type_struct_set (val,
13.330 + 0, info->channel_ID,
13.331 + 1, info->channel_num->str,
13.332 + 2, info->channel_name->str,
13.333 + 3, info->channel_icon->str,
13.334 + G_MAXUINT);
13.335 +}
13.336 +
13.337 +static gboolean
13.338 +gmyth_dbus_server_get_channel_info (GObject *obj,
13.339 + gint channel_id,
13.340 + GValue **info,
13.341 + GError **error)
13.342 +{
13.343 + GType ch_type;
13.344 + GMythChannelInfo *ch_info;
13.345 + GMythDbusServerPrivate *priv;
13.346 +
13.347 + priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
13.348 +
13.349 + g_return_val_if_fail (priv->myth_backend != NULL, FALSE);
13.350 + g_return_val_if_fail (gmyth_dbus_server_connect_epg (GMYTH_DBUS_SERVER (obj)), FALSE);
13.351 +
13.352 + ch_type = GMYTH_DBUS_CHANNEL_G_TYPE;
13.353 +
13.354 + ch_info = gmyth_epg_get_channel_info (priv->myth_epg, channel_id);
13.355 + if (ch_info)
13.356 + {
13.357 + *info = g_new0 (GValue, 1);
13.358 + g_value_init (*info, ch_type);
13.359 + g_value_set_static_boxed (*info, dbus_g_type_specialized_construct (ch_type));
13.360 + gmyth_dbus_server_parse_channel_info (ch_info, *info);
13.361 + return TRUE;
13.362 + }
13.363 +
13.364 + return FALSE;
13.365 +}
13.366 +
13.367 +
13.368 +static gboolean
13.369 +gmyth_dbus_server_get_channel_list (GObject *obj,
13.370 + GPtrArray **channels,
13.371 + GError **error)
13.372 +{
13.373 + GList *lst;
13.374 + GList *walk;
13.375 + int len;
13.376 + GType ch_type;
13.377 + GMythDbusServerPrivate *priv;
13.378 + priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
13.379 +
13.380 + g_return_val_if_fail (priv->myth_backend != NULL, FALSE);
13.381 + g_return_val_if_fail (gmyth_dbus_server_connect_epg (GMYTH_DBUS_SERVER (obj)), FALSE);
13.382 +
13.383 +
13.384 + len = gmyth_epg_get_channel_list (priv->myth_epg, &lst);
13.385 +
13.386 + *channels = g_ptr_array_sized_new (len);
13.387 + ch_type = GMYTH_DBUS_CHANNEL_G_TYPE;
13.388 +
13.389 + for (walk = lst; walk != NULL; walk = walk->next)
13.390 + {
13.391 + GValue ch = { 0, };
13.392 + GMythChannelInfo *data;
13.393 +
13.394 + data = (GMythChannelInfo *) walk->data;
13.395 +
13.396 + g_value_init (&ch, ch_type);
13.397 + g_value_set_static_boxed (&ch, dbus_g_type_specialized_construct (ch_type));
13.398 + gmyth_dbus_server_parse_channel_info (data, &ch);
13.399 + g_ptr_array_add (*channels, g_value_get_boxed (&ch));
13.400 + }
13.401 +
13.402 + gmyth_free_channel_list (lst);
13.403 + return TRUE;
13.404 +}
13.405 +
13.406 +static gboolean
13.407 +gmyth_dbus_server_file_exists (GObject *obj,
13.408 + const gchar *file_name,
13.409 + gboolean *exists,
13.410 + GError **error)
13.411 +{
13.412 + GMythDbusServerPrivate *priv;
13.413 + priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
13.414 +
13.415 + g_return_val_if_fail (priv->myth_backend, FALSE);
13.416 +
13.417 + *exists = gmyth_util_file_exists (priv->myth_backend, file_name);
13.418 +
13.419 + return TRUE;
13.420 +}
13.421 +
13.422 +static gboolean
13.423 +gmyth_dbus_server_get_program_list (GObject *obj,
13.424 + gint program_id,
13.425 + const gchar *start_time,
13.426 + const gchar *end_time,
13.427 + GPtrArray **programs)
13.428 +{
13.429 + GList *list;
13.430 + GList *walk;
13.431 + gint len;
13.432 + GType program_type;
13.433 + GTimeVal start_time_val;
13.434 + GTimeVal end_time_val;
13.435 + GMythDbusServerPrivate *priv;
13.436 +
13.437 + priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
13.438 +
13.439 + g_return_val_if_fail (priv->myth_backend, FALSE);
13.440 + g_return_val_if_fail (gmyth_dbus_server_connect_epg (GMYTH_DBUS_SERVER (obj)), FALSE);
13.441 +
13.442 +
13.443 + g_time_val_from_iso8601 (start_time, &start_time_val);
13.444 + g_time_val_from_iso8601 (end_time, &end_time_val);
13.445 +
13.446 + len = gmyth_epg_get_program_list (priv->myth_epg,
13.447 + &list,
13.448 + program_id,
13.449 + &start_time_val,
13.450 + &end_time_val);
13.451 +
13.452 + *programs = g_ptr_array_sized_new (len);
13.453 + program_type = GMYTH_DBUS_PROGRAM_G_TYPE;
13.454 +
13.455 + for (walk = list; walk != NULL; walk = walk->next)
13.456 + {
13.457 + GValue program = { 0, };
13.458 + gchar *start_str;
13.459 + gchar *end_str;
13.460 + GMythProgramInfo *data;
13.461 +
13.462 + data = (GMythProgramInfo *) walk->data;
13.463 +
13.464 + g_value_init (&program, program_type);
13.465 + g_value_set_static_boxed (&program,
13.466 + dbus_g_type_specialized_construct (program_type));
13.467 +
13.468 + start_str = g_time_val_to_iso8601 (data->startts);
13.469 + end_str = g_time_val_to_iso8601 (data->endts);
13.470 +
13.471 + dbus_g_type_struct_set (&program,
13.472 + 0, data->chanid,
13.473 + 1, start_str,
13.474 + 2, end_str,
13.475 + 3, data->title->str,
13.476 + 4, data->subtitle->str,
13.477 + 5, data->description->str,
13.478 + 6, data->category->str,
13.479 + G_MAXUINT);
13.480 +
13.481 + g_ptr_array_add (*programs, g_value_get_boxed (&program));
13.482 + g_free (start_str);
13.483 + g_free (end_str);
13.484 + }
13.485 +
13.486 + gmyth_free_program_list (list);
13.487 +
13.488 + return TRUE;
13.489 +}
13.490 +
13.491 +static void
13.492 +gmyth_dbus_server_parse_recorded_info (RecordedInfo *info,
13.493 + GValue *val)
13.494 +{
13.495 + gchar *start_str;
13.496 + gchar *end_str;
13.497 +
13.498 + start_str = g_time_val_to_iso8601 (info->start_time);
13.499 + end_str = g_time_val_to_iso8601 (info->end_time);
13.500 + dbus_g_type_struct_set (val,
13.501 + 0, info->record_id,
13.502 + 1, info->program_id,
13.503 + 2, info->channel_id,
13.504 + 3, start_str,
13.505 + 4, end_str,
13.506 + 5, info->title->str,
13.507 + 6, info->subtitle->str,
13.508 + 7, info->description->str,
13.509 + 8, info->category->str,
13.510 + 9, info->basename->str,
13.511 + 10, info->filesize,
13.512 + G_MAXUINT);
13.513 +
13.514 + g_free (start_str);
13.515 + g_free (end_str);
13.516 +}
13.517 +
13.518 +static gboolean
13.519 +gmyth_dbus_server_get_recorded_info (GObject *obj,
13.520 + const gchar *basename,
13.521 + GValue **info,
13.522 + GError **error)
13.523 +{
13.524 + GType record_type;
13.525 + GMythDbusServerPrivate *priv;
13.526 + RecordedInfo *record_info;
13.527 +
13.528 + priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
13.529 +
13.530 + g_return_val_if_fail (priv->myth_backend, FALSE);
13.531 + g_return_val_if_fail (gmyth_dbus_server_connect_scheduler (GMYTH_DBUS_SERVER (obj)), FALSE);
13.532 +
13.533 + record_type = GMYTH_DBUS_RECORD_G_TYPE;
13.534 +
13.535 + record_info = gmyth_scheduler_get_recorded_info (priv->myth_scheduler,
13.536 + basename);
13.537 +
13.538 + if (record_info)
13.539 + {
13.540 + *info = g_new0 (GValue, 1);
13.541 + g_value_init (*info, record_type);
13.542 + g_value_set_static_boxed (*info,
13.543 + dbus_g_type_specialized_construct (record_type));
13.544 + gmyth_dbus_server_parse_recorded_info (record_info, *info);
13.545 +
13.546 + gmyth_recorded_info_free (record_info);
13.547 +
13.548 + return TRUE;
13.549 + }
13.550 +
13.551 + return FALSE;
13.552 +}
13.553 +
13.554 +
13.555 +static gboolean
13.556 +gmyth_dbus_server_get_recorded_list (GObject *obj,
13.557 + GPtrArray **records,
13.558 + GError **error)
13.559 +{
13.560 + GList *list;
13.561 + GList *walk;
13.562 + gint len;
13.563 + GType record_type;
13.564 + GMythDbusServerPrivate *priv;
13.565 +
13.566 + priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
13.567 +
13.568 + g_return_val_if_fail (priv->myth_backend, FALSE);
13.569 + g_return_val_if_fail (gmyth_dbus_server_connect_scheduler (GMYTH_DBUS_SERVER (obj)), FALSE);
13.570 +
13.571 +
13.572 + len = gmyth_scheduler_get_recorded_list (priv->myth_scheduler,
13.573 + &list);
13.574 +
13.575 + *records = g_ptr_array_sized_new (len);
13.576 + record_type = GMYTH_DBUS_RECORD_G_TYPE;
13.577 +
13.578 + for (walk = list; walk != NULL; walk = walk->next)
13.579 + {
13.580 + GValue record = { 0, };
13.581 + RecordedInfo *data;
13.582 +
13.583 + data = (RecordedInfo *) walk->data;
13.584 +
13.585 + g_value_init (&record, record_type);
13.586 + g_value_set_static_boxed (&record,
13.587 + dbus_g_type_specialized_construct (record_type));
13.588 + gmyth_dbus_server_parse_recorded_info (data, &record);
13.589 + g_ptr_array_add (*records, g_value_get_boxed (&record));
13.590 + }
13.591 +
13.592 + gmyth_recorded_info_list_free (list);
13.593 +
13.594 + return TRUE;
13.595 +
13.596 +}
13.597 +
13.598 +static gboolean
13.599 +gmyth_dbus_server_get_schedule_list (GObject *obj,
13.600 + GPtrArray **schedules)
13.601 +{
13.602 + GList *list;
13.603 + GList *walk;
13.604 + gint len;
13.605 + GType schedule_type;
13.606 + GMythDbusServerPrivate *priv;
13.607 +
13.608 + priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
13.609 +
13.610 + g_return_val_if_fail (priv->myth_backend, FALSE);
13.611 + g_return_val_if_fail (gmyth_dbus_server_connect_scheduler (GMYTH_DBUS_SERVER (obj)), FALSE);
13.612 +
13.613 +
13.614 + len = gmyth_scheduler_get_schedule_list (priv->myth_scheduler,
13.615 + &list);
13.616 +
13.617 + *schedules = g_ptr_array_sized_new (len);
13.618 + schedule_type = GMYTH_DBUS_SCHEDULE_G_TYPE;
13.619 +
13.620 + for (walk = list; walk != NULL; walk = walk->next)
13.621 + {
13.622 + GValue schedule = { 0, };
13.623 + ScheduleInfo *data;
13.624 + gchar *start_str_time;
13.625 + gchar *end_str_time;
13.626 +
13.627 + data = (ScheduleInfo *) walk->data;
13.628 +
13.629 + g_value_init (&schedule, schedule_type);
13.630 + g_value_set_static_boxed (&schedule,
13.631 + dbus_g_type_specialized_construct (schedule_type));
13.632 +
13.633 + start_str_time = g_time_val_to_iso8601 (data->start_time);
13.634 + end_str_time = g_time_val_to_iso8601 (data->end_time);
13.635 +
13.636 + dbus_g_type_struct_set (&schedule,
13.637 + 0, data->schedule_id,
13.638 + 1, data->program_id,
13.639 + 2, data->channel_id,
13.640 + 3, start_str_time,
13.641 + 4, end_str_time,
13.642 + 5, data->title->str,
13.643 + 6, data->subtitle->str,
13.644 + 7, data->description->str,
13.645 + 8, data->category->str,
13.646 + 9, data->type,
13.647 + G_MAXUINT);
13.648 +
13.649 + g_ptr_array_add (*schedules, g_value_get_boxed (&schedule));
13.650 +
13.651 + g_free (start_str_time);
13.652 + g_free (end_str_time);
13.653 + }
13.654 +
13.655 + gmyth_schedule_info_list_free (list);
13.656 +
13.657 + return TRUE;
13.658 +}
13.659 +
13.660 +
13.661 +static gboolean
13.662 +gmyth_dbus_server_get_thumbnail (GObject *obj,
13.663 + const gchar *uri,
13.664 + GByteArray **image,
13.665 + GError **error)
13.666 +{
13.667 + GMythFileTransfer *file_transfer;
13.668 + glong filesize;
13.669 + GMythFileReadResult result;
13.670 + GMythDbusServerPrivate *priv;
13.671 +
13.672 + priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
13.673 +
13.674 + g_return_val_if_fail (priv->myth_backend, FALSE);
13.675 +
13.676 + if (!gmyth_util_file_exists (priv->myth_backend, uri))
13.677 + goto fail;
13.678 +
13.679 + file_transfer = gmyth_file_transfer_new (priv->myth_backend);
13.680 +
13.681 + if (!gmyth_file_transfer_open (file_transfer, uri))
13.682 + goto fail;
13.683 +
13.684 + filesize = gmyth_file_transfer_get_filesize (file_transfer);
13.685 + if (filesize <= 0)
13.686 + goto fail;
13.687 +
13.688 + *image = g_byte_array_new ();
13.689 + result = gmyth_file_transfer_read (file_transfer, *image, filesize, FALSE);
13.690 + if (result == GMYTH_FILE_READ_ERROR)
13.691 + goto fail;
13.692 +
13.693 + gmyth_file_transfer_close (file_transfer);
13.694 + g_object_unref (file_transfer);
13.695 +
13.696 + if (filesize > (*image)->len)
13.697 + goto fail;
13.698 +
13.699 + return TRUE;
13.700 +
13.701 +fail:
13.702 + g_object_unref(file_transfer);
13.703 + return FALSE;
13.704 +}
13.705 +
13.706 +static gboolean
13.707 +gmyth_dbus_server_get_channel_icon (GObject *obj,
13.708 + guint channel_id,
13.709 + GByteArray **icon,
13.710 + GError **error)
13.711 +{
13.712 + GMythChannelInfo *channel = NULL;
13.713 + guint8 *icon_data;
13.714 + guint icon_length;
13.715 + GMythDbusServerPrivate *priv;
13.716 +
13.717 + priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
13.718 + g_return_val_if_fail (priv->myth_backend, FALSE);
13.719 +
13.720 + channel = gmyth_epg_get_channel_info (priv->myth_epg,
13.721 + (gint) channel_id);
13.722 +
13.723 + *icon = NULL;
13.724 +
13.725 + if (channel == NULL)
13.726 + return FALSE;
13.727 +
13.728 + if (!gmyth_epg_channel_has_icon(priv->myth_epg, channel))
13.729 + {
13.730 + gmyth_channel_info_free (channel);
13.731 + g_debug("Channel does not have icon available");
13.732 + return FALSE;
13.733 + }
13.734 +
13.735 + icon_data = NULL;
13.736 + icon_length = 0;
13.737 + if (!gmyth_epg_channel_get_icon (priv->myth_epg,
13.738 + channel,
13.739 + &icon_data,
13.740 + &icon_length))
13.741 + {
13.742 + gmyth_channel_info_free (channel);
13.743 + g_warning("Could not get channel icon for channel id = %u", channel_id);
13.744 + return FALSE;
13.745 + }
13.746 +
13.747 + *icon = g_byte_array_sized_new (icon_length);
13.748 + *icon = g_byte_array_append (*icon, icon_data, icon_length);
13.749 +
13.750 + g_free (icon_data);
13.751 + gmyth_channel_info_free(channel);
13.752 + return TRUE;
13.753 +}
13.754 +
13.755 +
13.756 +static gboolean
13.757 +gmyth_dbus_server_stop_recording (GObject *obj,
13.758 + guint channel_id,
13.759 + gboolean *result,
13.760 + GError **error)
13.761 +{
13.762 + gboolean ret = FALSE;
13.763 + GMythDbusServerPrivate *priv;
13.764 +
13.765 + priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
13.766 +
13.767 + g_return_val_if_fail (priv->myth_backend, FALSE);
13.768 + g_return_val_if_fail (gmyth_dbus_server_connect_scheduler (GMYTH_DBUS_SERVER (obj)), FALSE);
13.769 +
13.770 + ret = gmyth_scheduler_stop_recording (priv->myth_scheduler,
13.771 + channel_id);
13.772 +
13.773 + return ret;
13.774 +}
13.775 +
13.776 +static ScheduleInfo*
13.777 +gmyth_dbus_server_new_schedule_info (const gchar* description,
13.778 + guint channel_id,
13.779 + guint program_id,
13.780 + GTimeVal *start_vtime,
13.781 + GTimeVal *end_vtime)
13.782 +{
13.783 + ScheduleInfo *new_sched_info;
13.784 +
13.785 + new_sched_info = g_new0(ScheduleInfo, 1);
13.786 +
13.787 + /* record_id == -1 for generating a new id */
13.788 + new_sched_info->schedule_id = -1;
13.789 +
13.790 + new_sched_info->channel_id = channel_id;
13.791 + new_sched_info->program_id = program_id;
13.792 + new_sched_info->start_time = g_new0 (GTimeVal, 1);
13.793 + *new_sched_info->start_time = *start_vtime;
13.794 + new_sched_info->end_time = g_new0 (GTimeVal, 1);
13.795 + *new_sched_info->end_time = *end_vtime;
13.796 +
13.797 + /* TODO: there is no frequency field */
13.798 + /*new_sched_info->frequency = -1;*/
13.799 +
13.800 + if (description != NULL) {
13.801 + /* FIXME: description parameter is used as title and description */
13.802 + new_sched_info->title = g_string_new(description);
13.803 + new_sched_info->description = g_string_new(description);
13.804 + }
13.805 +
13.806 + return new_sched_info;
13.807 +}
13.808 +
13.809 +static gboolean
13.810 +gmyth_dbus_server_add_schedule (GObject *obj,
13.811 + guint channel_id,
13.812 + guint program_id,
13.813 + const gchar *start_time,
13.814 + const gchar *end_time,
13.815 + gboolean recurring,
13.816 + const gchar *description,
13.817 + guint *schedule_id,
13.818 + GError **error)
13.819 +{
13.820 + ScheduleInfo *sch_info;
13.821 + GTimeVal start_vtime;
13.822 + GTimeVal end_vtime;
13.823 + GMythDbusServerPrivate *priv;
13.824 +
13.825 + priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
13.826 +
13.827 + *schedule_id = 0;
13.828 +
13.829 + g_return_val_if_fail (priv->myth_backend, FALSE);
13.830 + g_return_val_if_fail (gmyth_dbus_server_connect_scheduler (GMYTH_DBUS_SERVER (obj)), FALSE);
13.831 +
13.832 +
13.833 + g_time_val_from_iso8601 (start_time, &start_vtime);
13.834 + g_time_val_from_iso8601 (end_time, &end_vtime);
13.835 + sch_info = gmyth_dbus_server_new_schedule_info (description,
13.836 + channel_id,
13.837 + program_id,
13.838 + &start_vtime,
13.839 + &end_vtime);
13.840 + if (sch_info != NULL) {
13.841 + GMythScheduleType type;
13.842 + GTimeVal t_now;
13.843 + gboolean has_record;
13.844 +
13.845 + type = (recurring ?
13.846 + GMYTH_SCHEDULE_ALL_OCCURRENCES :
13.847 + GMYTH_SCHEDULE_ONE_OCCURRENCE);
13.848 +
13.849 + g_get_current_time (&t_now);
13.850 +
13.851 + has_record = gmyth_scheduler_was_recorded_before (priv->myth_scheduler,
13.852 + channel_id,
13.853 + (time_t) start_vtime.tv_sec);
13.854 +
13.855 +
13.856 + if ((t_now.tv_sec >= start_vtime.tv_sec)
13.857 + && (t_now.tv_sec <= end_vtime.tv_sec) && has_record)
13.858 + {
13.859 + GMythSocket *socket;
13.860 + gboolean res = FALSE;
13.861 +
13.862 + socket = gmyth_backend_info_get_connected_socket (priv->myth_backend);
13.863 + res = gmyth_scheduler_reactivate_schedule(priv->myth_scheduler,
13.864 + channel_id,
13.865 + (time_t) start_vtime.tv_sec);
13.866 + if (res) {
13.867 + GMythStringList *slist = gmyth_string_list_new();
13.868 +
13.869 + gmyth_string_list_append_char_array(slist, "RESCHEDULE_RECORDINGS 0");
13.870 + gmyth_socket_sendreceive_stringlist(socket, slist);
13.871 + res = (gmyth_string_list_get_int(slist, 0) == 1);
13.872 + g_object_unref(slist);
13.873 + }
13.874 +
13.875 + g_object_unref(socket);
13.876 + return res;
13.877 + }
13.878 + else
13.879 + {
13.880 + if (!gmyth_scheduler_add_schedule_full (priv->myth_scheduler,
13.881 + sch_info,
13.882 + type))
13.883 + {
13.884 + g_warning("Could not add schedule entry");
13.885 + return FALSE;
13.886 + }
13.887 +
13.888 + (*schedule_id) = sch_info->schedule_id;
13.889 + gmyth_schedule_info_free (sch_info);
13.890 + return TRUE;
13.891 + }
13.892 + }
13.893 + return FALSE;
13.894 +}
13.895 +
13.896 +static gboolean
13.897 +gmyth_dbus_server_add_exception (GObject *obj,
13.898 + guint schedule_id,
13.899 + guint channel_id,
13.900 + guint program_id,
13.901 + const gchar *start_time,
13.902 + const gchar *end_time,
13.903 + const gchar *description,
13.904 + GError **error)
13.905 +{
13.906 + ScheduleInfo *sch_info;
13.907 + GTimeVal start_vtime;
13.908 + GTimeVal end_vtime;
13.909 + GMythDbusServerPrivate *priv;
13.910 +
13.911 + priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
13.912 +
13.913 + g_return_val_if_fail (priv->myth_backend, FALSE);
13.914 + g_return_val_if_fail (gmyth_dbus_server_connect_scheduler (GMYTH_DBUS_SERVER (obj)), FALSE);
13.915 +
13.916 + g_time_val_from_iso8601 (start_time, &start_vtime);
13.917 + g_time_val_from_iso8601 (end_time, &end_vtime);
13.918 +
13.919 + sch_info = gmyth_dbus_server_new_schedule_info (description,
13.920 + channel_id,
13.921 + program_id,
13.922 + &start_vtime,
13.923 + &end_vtime);
13.924 + if (sch_info != NULL)
13.925 + {
13.926 + if (!gmyth_scheduler_add_exception (priv->myth_scheduler,
13.927 + schedule_id,
13.928 + sch_info))
13.929 + {
13.930 + g_warning ("Could not add schedule exception");
13.931 + gmyth_schedule_info_free (sch_info);
13.932 + return FALSE;
13.933 + }
13.934 +
13.935 + gmyth_schedule_info_free (sch_info);
13.936 + return TRUE;
13.937 + }
13.938 + return FALSE;
13.939 +}
13.940 +
13.941 +static gboolean
13.942 +gmyth_dbus_server_remove_schedule (GObject *obj,
13.943 + guint schedule_id,
13.944 + GError **error)
13.945 +{
13.946 + GMythDbusServerPrivate *priv;
13.947 +
13.948 + priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
13.949 +
13.950 + g_return_val_if_fail (priv->myth_backend, FALSE);
13.951 + g_return_val_if_fail (gmyth_dbus_server_connect_scheduler (GMYTH_DBUS_SERVER (obj)), FALSE);
13.952 +
13.953 + return gmyth_scheduler_delete_schedule (priv->myth_scheduler, schedule_id);
13.954 +}
13.955 +
13.956 +GMythDbusServer*
13.957 +gmyth_dbus_server_start_dbus_service (void)
13.958 +{
13.959 + GError *error = NULL;
13.960 + DBusGProxy *proxy;
13.961 + DBusGConnection *bus;
13.962 + guint request_ret;
13.963 + GMythDbusServer *self;
13.964 +
13.965 + self = g_object_new (GMYTH_DBUS_SERVER_TYPE, NULL);
13.966 + g_return_val_if_fail (self, FALSE);
13.967 +
13.968 + /* TODO: should verify if this service was already started */
13.969 +
13.970 + /* connect to session bus */
13.971 + bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
13.972 + if (bus == NULL)
13.973 + {
13.974 + g_warning ("Could not connect to dbus: %s", error->message);
13.975 + g_error_free (error);
13.976 + goto fail;
13.977 + }
13.978 +
13.979 + /* register dbus object */
13.980 + dbus_g_connection_register_g_object (bus,
13.981 + GMYTH_DBUS_SERVER_PATH, G_OBJECT (self));
13.982 +
13.983 + proxy = dbus_g_proxy_new_for_name (bus, DBUS_SERVICE_DBUS,
13.984 + DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
13.985 +
13.986 + /* registering download manager service */
13.987 + if (!org_freedesktop_DBus_request_name (proxy, GMYTH_DBUS_SERVER_IFACE,
13.988 + 0, &request_ret, &error))
13.989 + {
13.990 + g_warning ("Unable to register dbus service: %d %s",
13.991 + error->code, error->message);
13.992 + g_error_free (error);
13.993 + goto fail;
13.994 + }
13.995 +
13.996 + if (request_ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)
13.997 + {
13.998 + g_warning ("Got result code %u from requesting name", request_ret);
13.999 + goto fail;
13.1000 + }
13.1001 +
13.1002 + return self;
13.1003 +
13.1004 +fail:
13.1005 + g_object_unref (self);
13.1006 + return NULL;
13.1007 +}
13.1008 +
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
14.2 +++ b/myth-dbus/src/gmyth-dbus-server.h Wed Oct 24 20:01:02 2007 +0100
14.3 @@ -0,0 +1,64 @@
14.4 +/**
14.5 + * GMyth Library
14.6 + *
14.7 + * @file gmyth/gmyth_backend_info.c
14.8 + *
14.9 + * @brief <p> This component represents all the MythTV backend server
14.10 + * configuration information.
14.11 + *
14.12 + * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
14.13 + * @author Renato Filho <renato.filho@indt.org.br>
14.14 + *
14.15 + *
14.16 + * This program is free software; you can redistribute it and/or modify
14.17 + * it under the terms of the GNU Lesser General Public License as published by
14.18 + * the Free Software Foundation; either version 2 of the License, or
14.19 + * (at your option) any later version.
14.20 + *
14.21 + * This program is distributed in the hope that it will be useful,
14.22 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
14.23 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14.24 + * GNU General Public License for more details.
14.25 + *
14.26 + * You should have received a copy of the GNU Lesser General Public License
14.27 + * along with this program; if not, write to the Free Software
14.28 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14.29 + */
14.30 +
14.31 +
14.32 +#ifndef __GMYTH_DBUS_SERVER_H__
14.33 +#define __GMYTH_DBUS_SERVER_H__
14.34 +
14.35 +#include <glib.h>
14.36 +#include <glib-object.h>
14.37 +
14.38 +G_BEGIN_DECLS
14.39 +
14.40 +#define GMYTH_DBUS_SERVER_TYPE (gmyth_dbus_server_get_type ())
14.41 +#define GMYTH_DBUS_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_DBUS_SERVER_TYPE, GMythDbusServer))
14.42 +#define GMYTH_DBUS_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_DBUS_SERVER_TYPE, GMythDbusServerClass))
14.43 +#define IS_GMYTH_DBUS_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMYTH_DBUS_SERVER_TYPE))
14.44 +#define IS_GMYTH_DBUS_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GMYTH_DBUS_SERVER_TYPE))
14.45 +#define GMYTH_DBUS_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_DBUS_SERVER_TYPE, GMythDbusServerClass))
14.46 +
14.47 +
14.48 +typedef struct _GMythDbusServer GMythDbusServer;
14.49 +typedef struct _GMythDbusServerClass GMythDbusServerClass;
14.50 +
14.51 +struct _GMythDbusServerClass
14.52 +{
14.53 + GObjectClass parent_class;
14.54 +};
14.55 +
14.56 +struct _GMythDbusServer
14.57 +{
14.58 + GObject parent;
14.59 +};
14.60 +
14.61 +GType gmyth_dbus_server_get_type (void);
14.62 +GMythDbusServer * gmyth_dbus_server_start_dbus_service (void);
14.63 +
14.64 +
14.65 +G_END_DECLS
14.66 +
14.67 +#endif
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
15.2 +++ b/myth-dbus/src/gmyth-dbus-server.xml Wed Oct 24 20:01:02 2007 +0100
15.3 @@ -0,0 +1,99 @@
15.4 +<?xml version="1.0" encoding="UTF-8" ?>
15.5 +
15.6 +<node name="/br/org/indt/GMyth">
15.7 + <interface name="br.org.indt.GMyth">
15.8 + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="gmyth_dbus_server"/>
15.9 +
15.10 + <method name="Connect">
15.11 + <arg type="s" name="host" direction="in" />
15.12 + <arg type="i" name="port" direction="in" />
15.13 + <arg type="s" name="user" direction="in" />
15.14 + <arg type="s" name="password" direction="in" />
15.15 + </method>
15.16 +
15.17 + <method name="Connected">
15.18 + <arg type="b" name="status" direction="out" />
15.19 + </method>
15.20 +
15.21 + <method name="Disconnect"/>
15.22 +
15.23 + <method name="GetServerInfo">
15.24 + <arg type="t" name="total_space" direction="out" />
15.25 + <arg type="t" name="used_space" direction="out" />
15.26 + <arg type="t" name="free_space" direction="out" />
15.27 + </method>
15.28 +
15.29 + <method name="GetChannelList">
15.30 + <arg type="a(isss)" name="channels" direction="out" />
15.31 + </method>
15.32 +
15.33 + <method name="GetChannelInfo">
15.34 + <arg type="i" name="channel_id" direction="in" />
15.35 + <arg type="(isss)" name="details" direction="out" />
15.36 + </method>
15.37 +
15.38 + <method name="GetProgramList">
15.39 + <arg type="i" name="channel" direction="in" />
15.40 + <arg type="s" name="start_time" direction="in" />
15.41 + <arg type="s" name="end_time" direction="in" />
15.42 + <arg type="a(sssssss)" name="program_list" direction="out" />
15.43 + </method>
15.44 +
15.45 + <method name="GetRecordedList">
15.46 + <arg type="a(uuussssst)" name="records" direction="out" />
15.47 + </method>
15.48 +
15.49 + <method name="GetRecordedInfo">
15.50 + <arg type="s" name="basename" direction="in" />
15.51 + <arg type="(uuussssst)" name="details" direction="out" />
15.52 + </method>
15.53 +
15.54 + <method name="GetScheduleList">
15.55 + <arg type="a(uuussssu)" name="schedules" direction="out" />
15.56 + </method>
15.57 +
15.58 + <method name="FileExists">
15.59 + <arg type="s" name="file_name" direction="in" />
15.60 + <arg type="b" name="exists" direction="out" />
15.61 + </method>
15.62 +
15.63 + <method name="GetThumbnail">
15.64 + <arg type="s" name="file_name" direction="in" />
15.65 + <arg type="ay" name="image" direction="out" />
15.66 + </method>
15.67 +
15.68 + <method name="GetChannelIcon">
15.69 + <arg type="i" name="channel_id" direction="in" />
15.70 + <arg type="ay" name="icon" direction="out" />
15.71 + </method>
15.72 +
15.73 + <method name="StopRecording">
15.74 + <arg type="u" name="channel_id" direction="in" />
15.75 + <arg type="b" name="result" direction="out" />
15.76 + </method>
15.77 +
15.78 + <method name="AddSchedule">
15.79 + <arg type="u" name="channel_id" direction="in" />
15.80 + <arg type="u" name="program_id" direction="in" />
15.81 + <arg type="s" name="start_time" direction="in" />
15.82 + <arg type="s" name="end_time" direction="in" />
15.83 + <arg type="b" name="recurring" direction="in" />
15.84 + <arg type="s" name="description" direction="in" />
15.85 + <arg type="u" name="schedule_id" direction="out" />
15.86 + </method>
15.87 +
15.88 + <method name="AddException">
15.89 + <arg type="u" name="schedule_id" direction="in" />
15.90 + <arg type="u" name="program_id" direction="in" />
15.91 + <arg type="u" name="channel_id" direction="in" />
15.92 + <arg type="s" name="start_time" direction="in" />
15.93 + <arg type="s" name="end_time" direction="in" />
15.94 + <arg type="s" name="description" direction="in" />
15.95 + </method>
15.96 +
15.97 + <method name="RemoveSchedule">
15.98 + <arg type="u" name="schedule_id" direction="in" />
15.99 + </method>
15.100 +
15.101 + </interface>
15.102 +</node>
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
16.2 +++ b/myth-dbus/src/main.c Wed Oct 24 20:01:02 2007 +0100
16.3 @@ -0,0 +1,17 @@
16.4 +#include "gmyth-dbus-server.h"
16.5 +
16.6 +int main (int argc, char* argv[])
16.7 +{
16.8 + GMainLoop *loop;
16.9 + GMythDbusServer *srv;
16.10 +
16.11 + g_type_init ();
16.12 +
16.13 + loop = g_main_loop_new (NULL, FALSE);
16.14 + srv = gmyth_dbus_server_start_dbus_service ();
16.15 +
16.16 + if (srv)
16.17 + g_main_loop_run (loop);
16.18 +
16.19 + return 0;
16.20 +}
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
17.2 +++ b/myth-dbus/tests/channel-list.py Wed Oct 24 20:01:02 2007 +0100
17.3 @@ -0,0 +1,12 @@
17.4 +import dbus
17.5 +bus = dbus.SessionBus()
17.6 +
17.7 +proxy = bus.get_object ('br.org.indt.GMyth', '/br/org/indt/GMyth')
17.8 +iface = dbus.Interface (proxy, dbus_interface='br.org.indt.GMyth')
17.9 +iface.Connect ('192.168.2.222', 6543, 'mythtv', 'mythtv')
17.10 +print iface.Connected ()
17.11 +print iface.GetChannelList ()
17.12 +print "--------------------------------------------------------"
17.13 +print iface.GetRecordedList ()
17.14 +#print iface.FileExists ("teste.nuv")
17.15 +#print iface.GetProgramList (1003, ')