Develop and Download Open Source Software

Browse Subversion Repository

Diff of /NNDDv2/trunk/src/org/mineap/nndd/player/PlayerController.as

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 551 by mineap, Sat May 14 03:12:15 2011 UTC revision 565 by mineap, Thu May 19 12:10:58 2011 UTC
# Line 59  package org.mineap.nndd.player Line 59  package org.mineap.nndd.player
59          import org.mineap.nndd.player.comment.CommentManager;          import org.mineap.nndd.player.comment.CommentManager;
60          import org.mineap.nndd.player.comment.Comments;          import org.mineap.nndd.player.comment.Comments;
61          import org.mineap.nndd.player.model.PlayerTagString;          import org.mineap.nndd.player.model.PlayerTagString;
62            import org.mineap.nndd.user.UserManager;
63          import org.mineap.nndd.util.DateUtil;          import org.mineap.nndd.util.DateUtil;
64          import org.mineap.nndd.util.IchibaBuilder;          import org.mineap.nndd.util.IchibaBuilder;
65          import org.mineap.nndd.util.LibraryUtil;          import org.mineap.nndd.util.LibraryUtil;
# Line 76  package org.mineap.nndd.player Line 77  package org.mineap.nndd.player
77          import org.osmf.layout.ScaleMode;          import org.osmf.layout.ScaleMode;
78          import org.osmf.media.MediaPlayerState;          import org.osmf.media.MediaPlayerState;
79                    
80          import spark.components.VideoDisplay;          import spark.components.VideoDisplay;
81    
82          /**          /**
83           * ニコニコ動画からのダウンロードを処理およびその他のGUI関連処理を行う。           * ニコニコ動画からのダウンロードを処理およびその他のGUI関連処理を行う。
# Line 132  package org.mineap.nndd.player Line 133  package org.mineap.nndd.player
133                                    
134                  private var logManager:LogManager;                  private var logManager:LogManager;
135                                    
                 private var mailAddress:String;  
                 private var password:String;  
                   
136                  private var mc:MovieClip;                  private var mc:MovieClip;
137                  private var nicowariMC:MovieClip;                  private var nicowariMC:MovieClip;
138                  public var swfFrameRate:Number = 0;                  public var swfFrameRate:Number = 0;
# Line 220  package org.mineap.nndd.player Line 218  package org.mineap.nndd.player
218                   * FLVやMP4を再生するためのPlayerとSWFを再生するためのPlayerを管理し、<br>                   * FLVやMP4を再生するためのPlayerとSWFを再生するためのPlayerを管理し、<br>
219                   * 必要に応じて切り替えます。<br>                   * 必要に応じて切り替えます。<br>
220                   *                   *
                  * @param mailAddress  
                  * @param password  
                  * @param playListManager  
                  * @param videoPath  
                  * @param windowType  
                  * @param comments  
                  * @param autoPlay  
                  *  
221                   */                   */
222                  public function PlayerController(mailAddress:String,                  public function PlayerController()
                                                                                  password:String,  
                                                                                  playListManager:PlayListManager,  
                                                                                  videoPath:String = null,  
                                                                                  windowType:int = -1,  
                                                                                  comments:Comments = null,  
                                                                                  autoPlay:Boolean = false)  
223                  {                  {
224                          this.logManager = LogManager.instance;                          this.logManager = LogManager.instance;
                         this.mailAddress = mailAddress;  
                         this.password = password;  
225                          this.libraryManager = LibraryManagerBuilder.instance.libraryManager;                          this.libraryManager = LibraryManagerBuilder.instance.libraryManager;
226                          this.playListManager = playListManager;                          this.playListManager = PlayListManager.instance;
227                          this.videoPlayer = new VideoPlayer();                          this.videoPlayer = new VideoPlayer();
228                          this.videoInfoView = new VideoInfoView();                          this.videoInfoView = new VideoInfoView();
229                          this.videoInfoView.type = NativeWindowType.UTILITY;                          this.videoInfoView.type = NativeWindowType.UTILITY;
# Line 260  package org.mineap.nndd.player Line 242  package org.mineap.nndd.player
242                          }                          }
243                          this.commentTimer.addEventListener(TimerEvent.TIMER, commentTimerHandler);                          this.commentTimer.addEventListener(TimerEvent.TIMER, commentTimerHandler);
244                          this.commentManager = new CommentManager(videoPlayer, videoInfoView, this);                          this.commentManager = new CommentManager(videoPlayer, videoInfoView, this);
245                          if(videoPath != null && windowType != -1 && comments != null){  
                                 this.init(videoPath, windowType, comments, PathMaker.createThmbInfoPathByVideoPath(videoPath), autoPlay);  
                                 this.windowReady = true;  
                         }  
246                          this.playerHistoryManager = new PlayerHistoryManager();                          this.playerHistoryManager = new PlayerHistoryManager();
247                                                    
248                  }                  }
# Line 485  package org.mineap.nndd.player Line 464  package org.mineap.nndd.player
464                                                                    
465                                  if(this._videoID != null && PathMaker.getVideoID(videoPath) == LibraryUtil.getVideoKey(videoPath)){                                  if(this._videoID != null && PathMaker.getVideoID(videoPath) == LibraryUtil.getVideoKey(videoPath)){
466                                                                                    
467                                          if((mailAddress != null && password != null) && (mailAddress != "" && password != null && password != "")){                                          if((UserManager.instance.user != null && UserManager.instance.password != null) && (UserManager.instance.user != "" && UserManager.instance.password != null && UserManager.instance.password != "")){
468                                                                                                    
469                                                  /* ログイン済みの場合は更新を試みる */                                                  /* ログイン済みの場合は更新を試みる */
470                                                                                                    
# Line 530  package org.mineap.nndd.player Line 509  package org.mineap.nndd.player
509                                                                    
510                                  if(this._videoID != null && this._videoID != ""){                                  if(this._videoID != null && this._videoID != ""){
511                                                                                    
512                                          if(this.mailAddress != null && this.mailAddress != "" &&                                          if(UserManager.instance.user != null && UserManager.instance.user != "" &&
513                                                          this.password != null && this.password != ""){                                                          UserManager.instance.password != null && UserManager.instance.password != ""){
514                                                                                                    
515                                                  myListGroupUpdate(PathMaker.getVideoID(this._videoID));                                                  myListGroupUpdate(PathMaker.getVideoID(this._videoID));
516                                                                                                    
# Line 929  package org.mineap.nndd.player Line 908  package org.mineap.nndd.player
908                          });                          });
909                                                    
910                          if(this.videoInfoView.isRenewOtherCommentWithCommentEachPlay){                          if(this.videoInfoView.isRenewOtherCommentWithCommentEachPlay){
911                                  renewDownloadManager.renewForOtherVideo(this.mailAddress,                                  renewDownloadManager.renewForOtherVideo(UserManager.instance.user,
912                                          this.password, PathMaker.getVideoID(videoId), videoName,                                          UserManager.instance.password, PathMaker.getVideoID(videoId), videoName,
913                                          new File(videoPath.substring(0, videoPath.lastIndexOf("/")+1)),                                          new File(videoPath.substring(0, videoPath.lastIndexOf("/")+1)),
914                                          videoInfoView.isAppendComment, null, (FlexGlobals.topLevelApplication as NNDD).getSaveCommentMaxCount());                                          videoInfoView.isAppendComment, null, (FlexGlobals.topLevelApplication as NNDD).getSaveCommentMaxCount());
915                          }else{                          }else{
916                                  renewDownloadManager.renewForCommentOnly(this.mailAddress,                                  renewDownloadManager.renewForCommentOnly(UserManager.instance.user,
917                                          this.password, PathMaker.getVideoID(videoId), videoName,                                          UserManager.instance.password, PathMaker.getVideoID(videoId), videoName,
918                                          new File(videoPath.substring(0, videoPath.lastIndexOf("/")+1)),                                          new File(videoPath.substring(0, videoPath.lastIndexOf("/")+1)),
919                                          videoInfoView.isAppendComment, null, (FlexGlobals.topLevelApplication as NNDD).getSaveCommentMaxCount());                                          videoInfoView.isAppendComment, null, (FlexGlobals.topLevelApplication as NNDD).getSaveCommentMaxCount());
920                          }                          }
# Line 1014  package org.mineap.nndd.player Line 993  package org.mineap.nndd.player
993                                  }                                  }
994                                                                    
995                                  // 過去コメント取得時のコメント更新は一律で追記。                                  // 過去コメント取得時のコメント更新は一律で追記。
996                                  renewDownloadManagerForOldComment.renewForCommentOnly(this.mailAddress,                                  renewDownloadManagerForOldComment.renewForCommentOnly(UserManager.instance.user,
997                                          this.password, videoId, videoName, videoPath, true,                                          UserManager.instance.password, videoId, videoName, videoPath, true,
998                                          date, maxCount);                                          date, maxCount);
999                                                                    
1000                          }                          }
# Line 2673  package org.mineap.nndd.player Line 2652  package org.mineap.nndd.player
2652                                                    
2653                          if(!isStreaming){ //ストリーミング再生では無い場合は、ローカル以外にもニコ動から取得したデータを設定する                          if(!isStreaming){ //ストリーミング再生では無い場合は、ローカル以外にもニコ動から取得したデータを設定する
2654                                                                    
2655                                  if(videoID != null && (mailAddress != null && password != null) && (mailAddress != "" && password != "") ){                                  if(videoID != null && (UserManager.instance.user != null && UserManager.instance.password != null) && (UserManager.instance.user != "" && UserManager.instance.password != "") ){
2656                                                                                    
2657                                          //初期化                                          //初期化
2658                                          videoInfoView.ichibaNicoProvider.addItem({                                          videoInfoView.ichibaNicoProvider.addItem({
# Line 2764  package org.mineap.nndd.player Line 2743  package org.mineap.nndd.player
2743                                  }                                  }
2744                          }                          }
2745                                                    
2746                          if(videoID != null && (mailAddress != null && password != null) && (mailAddress != "" && password != "") ){                          if(videoID != null && (UserManager.instance.user != null && UserManager.instance.password != null) && (UserManager.instance.user != "" && UserManager.instance.password != "") ){
2747                                  retryCount = 0;                                  retryCount = 0;
2748                                  setNicoVideoPageInfo(PathMaker.getVideoID(videoID), 0, isStreaming);    //ストリーミングのとき説明文のみ取得                                  setNicoVideoPageInfo(PathMaker.getVideoID(videoID), 0, isStreaming);    //ストリーミングのとき説明文のみ取得
2749                          }                          }
# Line 3057  package org.mineap.nndd.player Line 3036  package org.mineap.nndd.player
3036                                          logManager.addLog("動画ページ詳細情報の取得に失敗:" + _videoID + ":" + event.text);                                          logManager.addLog("動画ページ詳細情報の取得に失敗:" + _videoID + ":" + event.text);
3037                                          trace("動画ページ詳細情報の取得に失敗:" + _videoID + ":" + event.text);                                          trace("動画ページ詳細情報の取得に失敗:" + _videoID + ":" + event.text);
3038                                  });                                  });
3039                                  watchVideoPage.watch(mailAddress, password, PathMaker.getVideoID(videoId), onlyOwnerText);                                  watchVideoPage.watch(UserManager.instance.user, UserManager.instance.password, PathMaker.getVideoID(videoId), onlyOwnerText);
3040                          }                          }
3041                  }                  }
3042                                    
# Line 3582  package org.mineap.nndd.player Line 3561  package org.mineap.nndd.player
3561                                          commentManager.addPostComment(new NNDDComment(Number(post.attribute("vpos")), String(post.text()), String(post.attribute("mail")), String(post.attribute("user_id")), Number(post.attribute("no")), String(post.attribute("thread")), true));                                          commentManager.addPostComment(new NNDDComment(Number(post.attribute("vpos")), String(post.text()), String(post.attribute("mail")), String(post.attribute("user_id")), Number(post.attribute("no")), String(post.attribute("thread")), true));
3562                                          logManager.addLog("***コメント投稿失敗***");                                          logManager.addLog("***コメント投稿失敗***");
3563                                  });                                  });
3564                                  a2n.postMessage(Access2Nico.TOP_PAGE_URL, Access2Nico.LOGIN_URL, this.mailAddress, this.password, postMessage, command, videoID, commentTimerVpos/10);                                  a2n.postMessage(Access2Nico.TOP_PAGE_URL, Access2Nico.LOGIN_URL, UserManager.instance.user, UserManager.instance.password, postMessage, command, videoID, commentTimerVpos/10);
3565                                                                    
3566                          }else{                          }else{
3567                                  //動画IDがついてないのでPostできなかった                                  //動画IDがついてないのでPostできなかった
# Line 3798  package org.mineap.nndd.player Line 3777  package org.mineap.nndd.player
3777                                          /* ストリーミング再生(接続先動画サーバがまだわかっていない時) */                                          /* ストリーミング再生(接続先動画サーバがまだわかっていない時) */
3778                                                                                    
3779                                          logManager.addLog("***ストリーミング再生の準備***");                                          logManager.addLog("***ストリーミング再生の準備***");
3780                                          if(mailAddress == "" || password == ""){                                          if(UserManager.instance.user == "" || UserManager.instance.password == ""){
3781                                                  Alert.show("ニコニコ動画にログインしてください。", Message.M_ERROR);                                                  Alert.show("ニコニコ動画にログインしてください。", Message.M_ERROR);
3782                                                  logManager.addLog("ニコニコ動画にログインしてください。");                                                  logManager.addLog("ニコニコ動画にログインしてください。");
3783                                                  FlexGlobals.topLevelApplication.activate();                                                  FlexGlobals.topLevelApplication.activate();
# Line 3886  package org.mineap.nndd.player Line 3865  package org.mineap.nndd.player
3865                                                  nnddDownloaderForStreaming.addEventListener(NNDDDownloader.WATCH_FAIL, getFailListener);                                                  nnddDownloaderForStreaming.addEventListener(NNDDDownloader.WATCH_FAIL, getFailListener);
3866                                                  nnddDownloaderForStreaming.addEventListener(NNDDDownloader.DOWNLOAD_PROCESS_ERROR, streamingPlayFailListener);                                                  nnddDownloaderForStreaming.addEventListener(NNDDDownloader.DOWNLOAD_PROCESS_ERROR, streamingPlayFailListener);
3867                                                  nnddDownloaderForStreaming.addEventListener(NNDDDownloader.DOWNLOAD_PROCESS_CANCELD, streamingPlayFailListener);                                                  nnddDownloaderForStreaming.addEventListener(NNDDDownloader.DOWNLOAD_PROCESS_CANCELD, streamingPlayFailListener);
3868                                                  nnddDownloaderForStreaming.requestDownloadForStreaming(this.mailAddress, this.password, PathMaker.getVideoID(url), tempDir, videoInfoView.isAlwaysEconomyForStreaming);                                                  nnddDownloaderForStreaming.requestDownloadForStreaming(UserManager.instance.user, UserManager.instance.password, PathMaker.getVideoID(url), tempDir, videoInfoView.isAlwaysEconomyForStreaming);
3869                                                                                                    
3870                                          }catch(e:Error){                                          }catch(e:Error){
3871                                                  videoPlayer.label_downloadStatus.text = "";                                                  videoPlayer.label_downloadStatus.text = "";
# Line 4244  package org.mineap.nndd.player Line 4223  package org.mineap.nndd.player
4223                          var videoId:String = PathMaker.getVideoID(videoTitle);                          var videoId:String = PathMaker.getVideoID(videoTitle);
4224                                                    
4225                          if(!PlayerMylistAddr.instance.isAdding){                          if(!PlayerMylistAddr.instance.isAdding){
4226                                  PlayerMylistAddr.instance.addMyList(this.mailAddress, this.password, myListId, videoId, videoTitle);                                  PlayerMylistAddr.instance.addMyList(UserManager.instance.user, UserManager.instance.password, myListId, videoId, videoTitle);
4227                          }else{                          }else{
4228                                  PlayerMylistAddr.instance.close();                                  PlayerMylistAddr.instance.close();
4229                          }                          }

Legend:
Removed from v.551  
changed lines
  Added in v.565

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26