Ticket #2264: mythfrontrow.patch

File mythfrontrow.patch, 25.4 KB (added by mythtv@…, 14 years ago)

patch for mythplugins

  • configure

     
    1919phone="yes"
    2020browser="yes"
    2121controls="yes"
     22frontrow="no"
    2223flix="yes"
    2324
    2425cc="gcc"
     
    9798
    9899MythWeather related options:
    99100  --enable-mythweather     build the mythweather plugin [$weather]
     101
     102MythFrontrow related options:
     103  --enable-mythfrontrow     build the mythfrontrow plugin [$frontrow]
     104
    100105EOF
    101106exit 1
    102107fi
     
    165170  ;;
    166171  --disable-mythbrowser) browser="no"
    167172  ;;
    168   --enable-mythcontrols) controls="yes"
     173  --enable-mythfrontrow) frontrow="yes"
    169174  ;;
    170   --disable-mythcontrols) controls="no"
     175  --disable-mythfrontrow) frontrow="no"
    171176  ;;
    172177  --enable-mythflix) flix="yes"
    173178  ;;
     
    529534  echo "        MythControls  plugin will not be built"
    530535fi
    531536
     537if test "$frontrow" = "yes" ; then
     538  echo "        MythFrontrow  plugin will be built"
     539  echo "SUBDIRS += mythfrontrow" >> ./config.pro
     540else
     541  echo "        MythFrontrow  plugin will not be built"
     542fi
     543
    532544if test "$flix" = "yes" ; then
    533545  echo "        MythFlix      plugin will be built"
    534546  echo "SUBDIRS += mythflix" >> ./config.pro
  • mythfrontrow/mythfrontrow.pro

     
     1TEMPLATE = subdirs
     2
     3# Directories
     4SUBDIRS = mythfrontrow
  • mythfrontrow/mythfrontrow/mythfrontrow.pro

     
     1include ( ../../mythconfig.mak )
     2include ( ../../settings.pro )
     3
     4TEMPLATE = lib
     5CONFIG += plugin thread
     6TARGET = mythfrontrow
     7target.path = $${PREFIX}/lib/mythtv/plugins
     8INSTALLS += target
     9
     10INCLUDEPATH += /System/Library/Frameworks/Carbon.framework/Frameworks/OpenScripting.framework/Headers
     11
     12uifiles.path = $${PREFIX}/share/mythtv/themes/default
     13#uifiles.files = controls-ui.xml ../images/kb-button-on.png ../images/kb-button-off.png
     14installfiles.path = $${PREFIX}/share/mythtv
     15#installfiles.files = controls-ui.xml
     16
     17INSTALLS += uifiles
     18
     19# Input
     20HEADERS +=
     21SOURCES += main.cpp
     22
     23macx {
     24    QMAKE_LFLAGS += -flat_namespace -undefined suppress
     25    FWKS = Carbon
     26
     27    # The following trick is tidier, and shortens the command line, but it
     28    # depends on the shell expanding Csh-style braces. Luckily, Bash & Zsh do.
     29    FC = $$join(FWKS,",","{","}")
     30
     31    QMAKE_CXXFLAGS += -F/System/Library/Frameworks/$${FC}.framework/Frameworks
     32    LIBS           += -framework $$join(FWKS," -framework ")
     33
     34
     35    QMAKE_LFLAGS_SHLIB += -seg1addr 0xC6000000
     36}
  • mythfrontrow/mythfrontrow/main.cpp

     
     1/* -*- myth -*- */
     2/**
     3 * @file main.cpp
     4 * @author Micah F. Galizia <mfgalizi@csd.uwo.ca>
     5 * @brief This is the main file.
     6 *
     7 * Copyright (C) 2005 Micah Galizia
     8 *
     9 * This program is free software; you can redistribute it and/or
     10 * modify it under the terms of the GNU General Public License as
     11 * published by the Free Software Foundation; either version 2, or (at
     12 * your option) any later version.
     13 *
     14 * This program is distributed in the hope that it will be useful, but
     15 * WITHOUT ANY WARRANTY; without even the implied warranty of
     16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     17 * General Public License for more details.
     18 *
     19 * You should have received a copy of the GNU General Public License
     20 * along with this program; if not, write to the Free Software
     21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
     22 * 02111-1307, USA
     23 */
     24#ifndef MAIN_CPP
     25#define MAIN_CPP
     26
     27using namespace std;
     28
     29#include <mythtv/mythdialogs.h>
     30#include <mythtv/mythcontext.h>
     31#include <mythtv/AppleRemote.h>
     32
     33#include <iostream>
     34#include <AppleScript.h>
     35#include <OSA.h>
     36
     37const char* const script = "tell application \"System Events\"\n"
     38// All the google results include this line, but it causes problems if this
     39// script runs Front Row for the first time
     40//"  tell application \"Front Row\" to activate\n"
     41"  key code 53 using {command down}\n"
     42"  delay 0.5\n"
     43"  key code 53\n"
     44"end tell";
     45
     46int main(int argc, char** argv) {
     47}
     48
     49/**
     50 * @brief Initializes the plugin.
     51 * @param libversion The mythtv library version.
     52 * @return zero if all is well, otherwise, less than zero
     53 */
     54extern "C" int mythplugin_init(const char *libversion)
     55{
     56    if (!gContext->TestPopupVersion("mythfrontrow", libversion,
     57                                    MYTH_BINARY_VERSION)) return -1;
     58    else return 0;
     59}
     60
     61
     62
     63/**
     64 * @brief Runs the plugin.
     65 * @return zero if all is well, otherwise, less than zero
     66 */
     67extern "C" int mythplugin_run (void)
     68{
     69  // pre-relinquish the remote, so FrontRow can get it
     70  AppleRemote::instance().stopListening();
     71
     72  OSErr ec;
     73  ComponentInstance scriptcomp = OpenDefaultComponent (kOSAComponentType, typeAppleScript);
     74  if (scriptcomp == NULL) {
     75    std::cout << "Error getting applescript component" << std::endl;
     76    AppleRemote::instance().startListening();
     77    return(-1);
     78  }
     79
     80  AEDesc scriptdesc;
     81  ec = AECreateDesc (typeChar, script, strlen(script), &scriptdesc);
     82  if (ec != noErr) {
     83    std::cout << "error creating applescript desc" << std::endl;
     84    CloseComponent(scriptcomp);
     85    AppleRemote::instance().startListening();
     86    return(-1);
     87  }
     88  AEDesc resultdesc = { typeNull, NULL };
     89  ec = OSADoScript (scriptcomp, &scriptdesc, kOSANullScript, typeChar, kOSANullMode, &resultdesc);
     90  AEDisposeDesc ( &scriptdesc);
     91  switch (ec) {
     92    case noErr:
     93      //std::cout << "script ran successfully" << std::endl;
     94      break;
     95    case errOSAScriptError:
     96      std::cout << "applescript resulted in an error" << std::endl;
     97      break;
     98    default:
     99      std::cout << "applescript component manager error" << std::endl;
     100      break;
     101  }
     102  AEDisposeDesc(&resultdesc);
     103  CloseComponent(scriptcomp);
     104  // we will reopen the remote after frontrow deactivates by detecting that we
     105  // have been activated
     106  return 0;
     107}
     108
     109
     110
     111/**
     112 * @brief Configures the plugin.
     113 * @return zero.
     114 */
     115extern "C" int mythplugin_config (void) { return 0; }
     116
     117
     118
     119#endif /* MAIN_CPP */
  • mythfrontrow/AUTHORS

     
     1Kris Raney <mythtv@junk.kraney.com
  • mythfrontrow/COPYING

     
     1                    GNU GENERAL PUBLIC LICENSE
     2                       Version 2, June 1991
     3
     4 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
     5                       59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     6 Everyone is permitted to copy and distribute verbatim copies
     7 of this license document, but changing it is not allowed.
     8
     9                            Preamble
     10
     11  The licenses for most software are designed to take away your
     12freedom to share and change it.  By contrast, the GNU General Public
     13License is intended to guarantee your freedom to share and change free
     14software--to make sure the software is free for all its users.  This
     15General Public License applies to most of the Free Software
     16Foundation's software and to any other program whose authors commit to
     17using it.  (Some other Free Software Foundation software is covered by
     18the GNU Library General Public License instead.)  You can apply it to
     19your programs, too.
     20
     21  When we speak of free software, we are referring to freedom, not
     22price.  Our General Public Licenses are designed to make sure that you
     23have the freedom to distribute copies of free software (and charge for
     24this service if you wish), that you receive source code or can get it
     25if you want it, that you can change the software or use pieces of it
     26in new free programs; and that you know you can do these things.
     27
     28  To protect your rights, we need to make restrictions that forbid
     29anyone to deny you these rights or to ask you to surrender the rights.
     30These restrictions translate to certain responsibilities for you if you
     31distribute copies of the software, or if you modify it.
     32
     33  For example, if you distribute copies of such a program, whether
     34gratis or for a fee, you must give the recipients all the rights that
     35you have.  You must make sure that they, too, receive or can get the
     36source code.  And you must show them these terms so they know their
     37rights.
     38
     39  We protect your rights with two steps: (1) copyright the software, and
     40(2) offer you this license which gives you legal permission to copy,
     41distribute and/or modify the software.
     42
     43  Also, for each author's protection and ours, we want to make certain
     44that everyone understands that there is no warranty for this free
     45software.  If the software is modified by someone else and passed on, we
     46want its recipients to know that what they have is not the original, so
     47that any problems introduced by others will not reflect on the original
     48authors' reputations.
     49
     50  Finally, any free program is threatened constantly by software
     51patents.  We wish to avoid the danger that redistributors of a free
     52program will individually obtain patent licenses, in effect making the
     53program proprietary.  To prevent this, we have made it clear that any
     54patent must be licensed for everyone's free use or not licensed at all.
     55
     56  The precise terms and conditions for copying, distribution and
     57modification follow.
     58
    059
     60                    GNU GENERAL PUBLIC LICENSE
     61   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
     62
     63  0. This License applies to any program or other work which contains
     64a notice placed by the copyright holder saying it may be distributed
     65under the terms of this General Public License.  The "Program", below,
     66refers to any such program or work, and a "work based on the Program"
     67means either the Program or any derivative work under copyright law:
     68that is to say, a work containing the Program or a portion of it,
     69either verbatim or with modifications and/or translated into another
     70language.  (Hereinafter, translation is included without limitation in
     71the term "modification".)  Each licensee is addressed as "you".
     72
     73Activities other than copying, distribution and modification are not
     74covered by this License; they are outside its scope.  The act of
     75running the Program is not restricted, and the output from the Program
     76is covered only if its contents constitute a work based on the
     77Program (independent of having been made by running the Program).
     78Whether that is true depends on what the Program does.
     79
     80  1. You may copy and distribute verbatim copies of the Program's
     81source code as you receive it, in any medium, provided that you
     82conspicuously and appropriately publish on each copy an appropriate
     83copyright notice and disclaimer of warranty; keep intact all the
     84notices that refer to this License and to the absence of any warranty;
     85and give any other recipients of the Program a copy of this License
     86along with the Program.
     87
     88You may charge a fee for the physical act of transferring a copy, and
     89you may at your option offer warranty protection in exchange for a fee.
     90
     91  2. You may modify your copy or copies of the Program or any portion
     92of it, thus forming a work based on the Program, and copy and
     93distribute such modifications or work under the terms of Section 1
     94above, provided that you also meet all of these conditions:
     95
     96    a) You must cause the modified files to carry prominent notices
     97    stating that you changed the files and the date of any change.
     98
     99    b) You must cause any work that you distribute or publish, that in
     100    whole or in part contains or is derived from the Program or any
     101    part thereof, to be licensed as a whole at no charge to all third
     102    parties under the terms of this License.
     103
     104    c) If the modified program normally reads commands interactively
     105    when run, you must cause it, when started running for such
     106    interactive use in the most ordinary way, to print or display an
     107    announcement including an appropriate copyright notice and a
     108    notice that there is no warranty (or else, saying that you provide
     109    a warranty) and that users may redistribute the program under
     110    these conditions, and telling the user how to view a copy of this
     111    License.  (Exception: if the Program itself is interactive but
     112    does not normally print such an announcement, your work based on
     113    the Program is not required to print an announcement.)
     114
    1115
     116These requirements apply to the modified work as a whole.  If
     117identifiable sections of that work are not derived from the Program,
     118and can be reasonably considered independent and separate works in
     119themselves, then this License, and its terms, do not apply to those
     120sections when you distribute them as separate works.  But when you
     121distribute the same sections as part of a whole which is a work based
     122on the Program, the distribution of the whole must be on the terms of
     123this License, whose permissions for other licensees extend to the
     124entire whole, and thus to each and every part regardless of who wrote it.
     125
     126Thus, it is not the intent of this section to claim rights or contest
     127your rights to work written entirely by you; rather, the intent is to
     128exercise the right to control the distribution of derivative or
     129collective works based on the Program.
     130
     131In addition, mere aggregation of another work not based on the Program
     132with the Program (or with a work based on the Program) on a volume of
     133a storage or distribution medium does not bring the other work under
     134the scope of this License.
     135
     136  3. You may copy and distribute the Program (or a work based on it,
     137under Section 2) in object code or executable form under the terms of
     138Sections 1 and 2 above provided that you also do one of the following:
     139
     140    a) Accompany it with the complete corresponding machine-readable
     141    source code, which must be distributed under the terms of Sections
     142    1 and 2 above on a medium customarily used for software interchange; or,
     143
     144    b) Accompany it with a written offer, valid for at least three
     145    years, to give any third party, for a charge no more than your
     146    cost of physically performing source distribution, a complete
     147    machine-readable copy of the corresponding source code, to be
     148    distributed under the terms of Sections 1 and 2 above on a medium
     149    customarily used for software interchange; or,
     150
     151    c) Accompany it with the information you received as to the offer
     152    to distribute corresponding source code.  (This alternative is
     153    allowed only for noncommercial distribution and only if you
     154    received the program in object code or executable form with such
     155    an offer, in accord with Subsection b above.)
     156
     157The source code for a work means the preferred form of the work for
     158making modifications to it.  For an executable work, complete source
     159code means all the source code for all modules it contains, plus any
     160associated interface definition files, plus the scripts used to
     161control compilation and installation of the executable.  However, as a
     162special exception, the source code distributed need not include
     163anything that is normally distributed (in either source or binary
     164form) with the major components (compiler, kernel, and so on) of the
     165operating system on which the executable runs, unless that component
     166itself accompanies the executable.
     167
     168If distribution of executable or object code is made by offering
     169access to copy from a designated place, then offering equivalent
     170access to copy the source code from the same place counts as
     171distribution of the source code, even though third parties are not
     172compelled to copy the source along with the object code.
     173
    2174
     175  4. You may not copy, modify, sublicense, or distribute the Program
     176except as expressly provided under this License.  Any attempt
     177otherwise to copy, modify, sublicense or distribute the Program is
     178void, and will automatically terminate your rights under this License.
     179However, parties who have received copies, or rights, from you under
     180this License will not have their licenses terminated so long as such
     181parties remain in full compliance.
     182
     183  5. You are not required to accept this License, since you have not
     184signed it.  However, nothing else grants you permission to modify or
     185distribute the Program or its derivative works.  These actions are
     186prohibited by law if you do not accept this License.  Therefore, by
     187modifying or distributing the Program (or any work based on the
     188Program), you indicate your acceptance of this License to do so, and
     189all its terms and conditions for copying, distributing or modifying
     190the Program or works based on it.
     191
     192  6. Each time you redistribute the Program (or any work based on the
     193Program), the recipient automatically receives a license from the
     194original licensor to copy, distribute or modify the Program subject to
     195these terms and conditions.  You may not impose any further
     196restrictions on the recipients' exercise of the rights granted herein.
     197You are not responsible for enforcing compliance by third parties to
     198this License.
     199
     200  7. If, as a consequence of a court judgment or allegation of patent
     201infringement or for any other reason (not limited to patent issues),
     202conditions are imposed on you (whether by court order, agreement or
     203otherwise) that contradict the conditions of this License, they do not
     204excuse you from the conditions of this License.  If you cannot
     205distribute so as to satisfy simultaneously your obligations under this
     206License and any other pertinent obligations, then as a consequence you
     207may not distribute the Program at all.  For example, if a patent
     208license would not permit royalty-free redistribution of the Program by
     209all those who receive copies directly or indirectly through you, then
     210the only way you could satisfy both it and this License would be to
     211refrain entirely from distribution of the Program.
     212
     213If any portion of this section is held invalid or unenforceable under
     214any particular circumstance, the balance of the section is intended to
     215apply and the section as a whole is intended to apply in other
     216circumstances.
     217
     218It is not the purpose of this section to induce you to infringe any
     219patents or other property right claims or to contest validity of any
     220such claims; this section has the sole purpose of protecting the
     221integrity of the free software distribution system, which is
     222implemented by public license practices.  Many people have made
     223generous contributions to the wide range of software distributed
     224through that system in reliance on consistent application of that
     225system; it is up to the author/donor to decide if he or she is willing
     226to distribute software through any other system and a licensee cannot
     227impose that choice.
     228
     229This section is intended to make thoroughly clear what is believed to
     230be a consequence of the rest of this License.
     231
    3232
     233  8. If the distribution and/or use of the Program is restricted in
     234certain countries either by patents or by copyrighted interfaces, the
     235original copyright holder who places the Program under this License
     236may add an explicit geographical distribution limitation excluding
     237those countries, so that distribution is permitted only in or among
     238countries not thus excluded.  In such case, this License incorporates
     239the limitation as if written in the body of this License.
     240
     241  9. The Free Software Foundation may publish revised and/or new versions
     242of the General Public License from time to time.  Such new versions will
     243be similar in spirit to the present version, but may differ in detail to
     244address new problems or concerns.
     245
     246Each version is given a distinguishing version number.  If the Program
     247specifies a version number of this License which applies to it and "any
     248later version", you have the option of following the terms and conditions
     249either of that version or of any later version published by the Free
     250Software Foundation.  If the Program does not specify a version number of
     251this License, you may choose any version ever published by the Free Software
     252Foundation.
     253
     254  10. If you wish to incorporate parts of the Program into other free
     255programs whose distribution conditions are different, write to the author
     256to ask for permission.  For software which is copyrighted by the Free
     257Software Foundation, write to the Free Software Foundation; we sometimes
     258make exceptions for this.  Our decision will be guided by the two goals
     259of preserving the free status of all derivatives of our free software and
     260of promoting the sharing and reuse of software generally.
     261
     262                            NO WARRANTY
     263
     264  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
     265FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
     266OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
     267PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
     268OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     269MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
     270TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
     271PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
     272REPAIR OR CORRECTION.
     273
     274  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
     275WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
     276REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
     277INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
     278OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
     279TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
     280YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
     281PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
     282POSSIBILITY OF SUCH DAMAGES.
     283
     284                     END OF TERMS AND CONDITIONS
     285
    4286
     287            How to Apply These Terms to Your New Programs
     288
     289  If you develop a new program, and you want it to be of the greatest
     290possible use to the public, the best way to achieve this is to make it
     291free software which everyone can redistribute and change under these terms.
     292
     293  To do so, attach the following notices to the program.  It is safest
     294to attach them to the start of each source file to most effectively
     295convey the exclusion of warranty; and each file should have at least
     296the "copyright" line and a pointer to where the full notice is found.
     297
     298    <one line to give the program's name and a brief idea of what it does.>
     299    Copyright (C) <year>  <name of author>
     300
     301    This program is free software; you can redistribute it and/or modify
     302    it under the terms of the GNU General Public License as published by
     303    the Free Software Foundation; either version 2 of the License, or
     304    (at your option) any later version.
     305
     306    This program is distributed in the hope that it will be useful,
     307    but WITHOUT ANY WARRANTY; without even the implied warranty of
     308    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     309    GNU General Public License for more details.
     310
     311    You should have received a copy of the GNU General Public License
     312    along with this program; if not, write to the Free Software
     313    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     314
     315
     316Also add information on how to contact you by electronic and paper mail.
     317
     318If the program is interactive, make it output a short notice like this
     319when it starts in an interactive mode:
     320
     321    Gnomovision version 69, Copyright (C) year name of author
     322    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
     323    This is free software, and you are welcome to redistribute it
     324    under certain conditions; type `show c' for details.
     325
     326The hypothetical commands `show w' and `show c' should show the appropriate
     327parts of the General Public License.  Of course, the commands you use may
     328be called something other than `show w' and `show c'; they could even be
     329mouse-clicks or menu items--whatever suits your program.
     330
     331You should also get your employer (if you work as a programmer) or your
     332school, if any, to sign a "copyright disclaimer" for the program, if
     333necessary.  Here is a sample; alter the names:
     334
     335  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
     336  `Gnomovision' (which makes passes at compilers) written by James Hacker.
     337
     338  <signature of Ty Coon>, 1 April 1989
     339  Ty Coon, President of Vice
     340
  • mythfrontrow/README

    +This General Public License does not permit incorporating your program into
    +proprietary programs.  If your program is a subroutine library, you may
    +consider it more useful to permit linking proprietary applications with the
    +library.  If this is what you want to do, use the GNU Library General
    +Public License instead of this License.
     
     1MythFrontrow
     2Beta Version
     3
     4GENERAL
     5-------
     6
     7This is an early release of mythfrontrow.
     8
     9
     10BUILD/CONFIGURATION INSTRUCTIONS
     11--------------------------------
     12
     13Adjust your prefix in settings.pro, then execute:
     14
     15qmake mythfrontrow.pro
     16make
     17
     18
     19INSTALLATION INSTRUCTIONS
     20-------------------------
     21
     22Having built MythFrontrow, execute:
     23
     24make install.
     25
     26
     27I think that is all you need to do.