File indexing completed on 2025-02-23 04:28:48
0001 /**************************************************************************************** 0002 * Copyright (c) 2008 Casey Link <unnamedrambler@gmail.com> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify it under * 0005 * the terms of the GNU General Public License as published by the Free Software * 0006 * Foundation; either version 2 of the License, or (at your option) any later * 0007 * version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0010 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0011 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0012 * * 0013 * You should have received a copy of the GNU General Public License along with * 0014 * this program. If not, see <http://www.gnu.org/licenses/>. * 0015 ****************************************************************************************/ 0016 0017 #ifndef DEFINE_HARMONY 0018 #define DEFINE_HARMONY 0019 #endif 0020 #include "Mp3tunesHarmonyDaemon.h" 0021 #include "AmarokClient.h" 0022 0023 #include <QApplication> 0024 #include <QCommandLineParser> 0025 #include <QDebug> 0026 0027 #include <KAboutData> 0028 #include <KLocalizedString> 0029 0030 int main( int argc, char *argv[] ) 0031 { 0032 QCoreApplication app( argc, argv ); 0033 const KAboutData about( "amarokmp3tunesharmonydaemon", 0034 "amarok", 0035 "0.1", 0036 i18n( "Amarok's MP3tunes Harmony Daemon" ), 0037 KAboutLicense::GPL, 0038 i18n( "(C) 2008, Casey Link" ), 0039 i18n( "Handles AutoSync for the MP3tunes service in Amarok." ), 0040 i18n( "IRC:\nserver: irc.libera.chat / channels: #amarok, #amarok-de, #amarok-es, #amarok-fr\n\nFeedback:\namarok@kde.org" ), 0041 I18N_NOOP( "http://amarok.kde.org" ) ); 0042 KAboutData::setApplicationData( about ); 0043 0044 QCommandLineParser parser; 0045 parser.setApplicationDescription( about.shortDescription() ); 0046 parser.addHelpOption(); 0047 parser.addVersionOption(); 0048 parser.addOption( { "identifier", i18n( "The identifier the daemon should use." ) } ); 0049 parser.addOption( { "email", i18n( "The email to be used for authentication." ) } ); 0050 parser.addOption( { "pin", i18n( "The pin to be used for authentication." ) } ); 0051 parser.process( app ); 0052 0053 QString ident = parser.value( "identifier" ); 0054 QString email = parser.value( "email" ); 0055 QString pin = parser.value( "pin" ); 0056 0057 if( ident.isEmpty() ) 0058 return -1; 0059 0060 if( email.isEmpty() && pin.isEmpty() ) 0061 theDaemon = new Mp3tunesHarmonyDaemon( ident, argc, argv ); 0062 else 0063 theDaemon = new Mp3tunesHarmonyDaemon( ident, email, pin, argc, argv ); 0064 0065 Mp3tunesAmarokClient *client = new Mp3tunesAmarokClient(); 0066 theDaemon->setClient( client ); 0067 qDebug() << "Starting main event loop"; 0068 return QCoreApplication::exec(); 0069 } 0070 0071 0072 0073 0074