/*****************************************************************************
*
* Impletement about AllanYan's getting ftp resources from nju campus
*
* (C) Copyleft 2007, AllanYan from Nanjing University, P.R.China
* Author : S.C.Yan Last Modified @ 2007.07.27
*
* Public Interface : no
*
* Abstract : about AllanYan's getting some ftp resources from nju campus
*
*****************************************************************************/
#include <nju.h>
#include <NJUer.h>
#include <ftp.h>
// possible candidates
#include "yxf760321.h"
#include "XiaKai.h"
#include "ZhouWei.h"
#include "YeSuLi.h"
#include "zch312.h"
#include "AllanYan.h"
#include "misc.h"
// using Unix-style C++
#ifndef UNIX_STYLE_CPP
#define UNIX_STYLE_CPP yes
#endif
using namespace std;
namespace AllanYan
{
/**
* get_American_Seasons : get American Season by giving name and season no.
* @param tvplay_name : the pointor to the char season name
* @param season : the season No, in format of short integer
* @param njuer : reference to some NJUer to perform the action
* @param mdisk : reference to some MobileDevice for the resource to download into
* @return true when login is successful, or false when not
*/
bool get_American_Seasons(char const *tvplay_name,
short season,
NJUer &njuer,
MobileDevice &mdisk)
{
if(njuer.login("ftp://media.nju.edu.cn"))
{
if(njuer.check_dev_state(mdisk) && /
njuer.find_where_American_Seasons_is())
{
njuer.get_American_Seasons(tvplay_name,season);
}
return true;
}
return false;
}
/**
* get_Oscar_best_movies : get Oscar best movies by providing the No.
* @param begin_no : the beginning No. of the Oscar best movie to be downloaded
* @param end_no : the ending No. of the Oscar best movie to be downloaded
* @param njuer : reference to some NJUer to perform the action
* @param mdisk : reference to some MobileDevice for the resource to download into
* @return true on no error, or false when any exception happends
*/
bool get_Oscar_best_movies(short begin_no,
short end_no,
NJUer &njuer,
MobileDevice &mdisk)
{
if(njuer.login("ftp://****:*********@rise.nju.edu.cn"))
{
if(njuer.check_dev_state(mdisk) && /
njuer.find_where_Oscar_best_movies_is())
{
for(short oscar_no=1;oscar_no<78;oscar_no++)
{
if(njuer.check_dev_state(mdisk))
{
njuer.get_Oscar_best_movies(oscar_no);
}
else return true;
}
}
}
return true;
}
/**
* get_KaraOK_files : invoke njuer to download KaraOK files into the mobile device
* @param njuer : reference to some NJUer to perform the action
* @param mdisk : reference to some MobileDevice for the resource to download into
* @return true on no error, or false when any exception happends
*/
bool get_KaraOK_files(NJUer &njuer,MobileDevice &mdisk)
{
if(njuer.login("ftp://cos.nju.edu.cn/Music"))
{
if(njuer.check_dev_state(mdisk) && /
njuer.find_where_KaraOK_files_is())
{
njuer.get_KaraOK_files("*.zip");
njuer.get_KaraOK_files("*.rar");
njuer.get_KaraOK_files("*.mp3");
}
}
return true;
}
// process entry
int main (int argc, char* argv[])
{
bool ret = false;
try
{
// get singlton instance from possible candidate
char const * freind = AllanYan::get_freind_from_memory(); // "mirth"
NJUer &njuer = (NJUer &)*NJUer::get_njuer_from_LilyBBS_by_id(freind);
MobileDevice &mdisk = (MobileDevice &)*AllanYan::get_mdev_instance();
AllanYan::send_mdev_to(njuer,AllanYan::get_spare_time());
// get things --- the importants of all
ret = get_American_Seasons("Heroes",1,njuer,mdisk) || /
get_American_Seasons("X Files",1,njuer,mdisk) || /
get_Oscar_best_movies(1,77,njuer,mdisk) || /
get_KaraOK_files(njuer,mdisk);
// short msg to allanyan's cellphone when things got done
njuer.send_sms_to(AllanYan::get_instance(),"downloads finished.");
AllanYan::get_mdev_back();
// the rewards back to njuer
if(ret)
{
AllanYan::send_bg_invitation(njuer,"a meal");
AllanYan::say_to(njuer,"a great many thanks.");
}
else
{
njuer.da_pp(njuer.get_foot(),njuer.pp,"kick your ass");
if(njuer.still_feel_good())
{
AllanYan::send_bg_invitation(njuer,"a icecream");
AllanYan::say_to(njuer,"a great many fts.");
}
}
}
catch(exception ex)
{
cout << "Ooops~~Oh-o~~!" << endl;
}
return ret ? 0:1;
}
}
*
* Impletement about AllanYan's getting ftp resources from nju campus
*
* (C) Copyleft 2007, AllanYan from Nanjing University, P.R.China
* Author : S.C.Yan Last Modified @ 2007.07.27
*
* Public Interface : no
*
* Abstract : about AllanYan's getting some ftp resources from nju campus
*
*****************************************************************************/
#include <nju.h>
#include <NJUer.h>
#include <ftp.h>
// possible candidates
#include "yxf760321.h"
#include "XiaKai.h"
#include "ZhouWei.h"
#include "YeSuLi.h"
#include "zch312.h"
#include "AllanYan.h"
#include "misc.h"
// using Unix-style C++
#ifndef UNIX_STYLE_CPP
#define UNIX_STYLE_CPP yes
#endif
using namespace std;
namespace AllanYan
{
/**
* get_American_Seasons : get American Season by giving name and season no.
* @param tvplay_name : the pointor to the char season name
* @param season : the season No, in format of short integer
* @param njuer : reference to some NJUer to perform the action
* @param mdisk : reference to some MobileDevice for the resource to download into
* @return true when login is successful, or false when not
*/
bool get_American_Seasons(char const *tvplay_name,
short season,
NJUer &njuer,
MobileDevice &mdisk)
{
if(njuer.login("ftp://media.nju.edu.cn"))
{
if(njuer.check_dev_state(mdisk) && /
njuer.find_where_American_Seasons_is())
{
njuer.get_American_Seasons(tvplay_name,season);
}
return true;
}
return false;
}
/**
* get_Oscar_best_movies : get Oscar best movies by providing the No.
* @param begin_no : the beginning No. of the Oscar best movie to be downloaded
* @param end_no : the ending No. of the Oscar best movie to be downloaded
* @param njuer : reference to some NJUer to perform the action
* @param mdisk : reference to some MobileDevice for the resource to download into
* @return true on no error, or false when any exception happends
*/
bool get_Oscar_best_movies(short begin_no,
short end_no,
NJUer &njuer,
MobileDevice &mdisk)
{
if(njuer.login("ftp://****:*********@rise.nju.edu.cn"))
{
if(njuer.check_dev_state(mdisk) && /
njuer.find_where_Oscar_best_movies_is())
{
for(short oscar_no=1;oscar_no<78;oscar_no++)
{
if(njuer.check_dev_state(mdisk))
{
njuer.get_Oscar_best_movies(oscar_no);
}
else return true;
}
}
}
return true;
}
/**
* get_KaraOK_files : invoke njuer to download KaraOK files into the mobile device
* @param njuer : reference to some NJUer to perform the action
* @param mdisk : reference to some MobileDevice for the resource to download into
* @return true on no error, or false when any exception happends
*/
bool get_KaraOK_files(NJUer &njuer,MobileDevice &mdisk)
{
if(njuer.login("ftp://cos.nju.edu.cn/Music"))
{
if(njuer.check_dev_state(mdisk) && /
njuer.find_where_KaraOK_files_is())
{
njuer.get_KaraOK_files("*.zip");
njuer.get_KaraOK_files("*.rar");
njuer.get_KaraOK_files("*.mp3");
}
}
return true;
}
// process entry
int main (int argc, char* argv[])
{
bool ret = false;
try
{
// get singlton instance from possible candidate
char const * freind = AllanYan::get_freind_from_memory(); // "mirth"
NJUer &njuer = (NJUer &)*NJUer::get_njuer_from_LilyBBS_by_id(freind);
MobileDevice &mdisk = (MobileDevice &)*AllanYan::get_mdev_instance();
AllanYan::send_mdev_to(njuer,AllanYan::get_spare_time());
// get things --- the importants of all
ret = get_American_Seasons("Heroes",1,njuer,mdisk) || /
get_American_Seasons("X Files",1,njuer,mdisk) || /
get_Oscar_best_movies(1,77,njuer,mdisk) || /
get_KaraOK_files(njuer,mdisk);
// short msg to allanyan's cellphone when things got done
njuer.send_sms_to(AllanYan::get_instance(),"downloads finished.");
AllanYan::get_mdev_back();
// the rewards back to njuer
if(ret)
{
AllanYan::send_bg_invitation(njuer,"a meal");
AllanYan::say_to(njuer,"a great many thanks.");
}
else
{
njuer.da_pp(njuer.get_foot(),njuer.pp,"kick your ass");
if(njuer.still_feel_good())
{
AllanYan::send_bg_invitation(njuer,"a icecream");
AllanYan::say_to(njuer,"a great many fts.");
}
}
}
catch(exception ex)
{
cout << "Ooops~~Oh-o~~!" << endl;
}
return ret ? 0:1;
}
}