Пример #1
0
 public void StopPlaytaskRead() {
   if (playTask != null) {
     mlibvlc.nativeSetStopCurReadTask(playTask.getppUrl(), 1);
     try {
       Thread.sleep(500);
     } catch (Exception e) {
       // TODO: handle exception
       e.printStackTrace();
     }
   }
 }
Пример #2
0
 // 查询MovieURL 为inppfilmUrl,moveinfo
 public String getDownLoadInfoFromresultsInfos(String inppfilmUrl) {
   try {
     if (inppfilmUrl.startsWith("ppfilm")) {
       return mlibvlc.nativeGeneralHashID(inppfilmUrl);
     }
   } catch (Exception e) {
     // TODO: handle exception
     e.printStackTrace();
   }
   return null;
 }
Пример #3
0
 /**
  * Destroy this libVLC instance
  *
  * @note You must call it before exiting
  */
 public void destroy() {
   try {
     //			task.cancel();
     stopDownTasks();
     mlibvlc.nativeExitp2pSystem();
     mIsInitialized = false;
   } catch (Exception e) {
     // TODO: handle exception
     e.printStackTrace();
   }
 }
Пример #4
0
 // 文件合并
 @SuppressWarnings("resource")
 public synchronized boolean GetFileMerge(final DownLoadInfo downInfo) {
   String parent = HtmlUtils.getFileDir(downInfo);
   final List<String> list = new ArrayList<String>();
   File file = new File(parent);
   if (!file.exists()) return true;
   // 检索要合并的文件名,不合格的剔除
   File[] childFiles =
       file.listFiles(
           new FileFilter() {
             public boolean accept(File pathname) {
               return pathname.getName().startsWith(downInfo.getDownName())
                   && !pathname.getName().endsWith(".ts");
             }
           });
   if (childFiles != null) {
     // 文件片段多于一个才需要合并
     String filePath = null;
     for (File file1 : childFiles) {
       filePath = file1.getAbsolutePath();
       list.add(filePath);
     }
     if (list.size() == 1) {
       DBHelperDao.getDBHelperDaoInstace().updataMovieStoreLocal(downInfo.getDownUrl(), filePath);
     } else {
       DBHelperDao.getDBHelperDaoInstace()
           .updataMovieStoreState(downInfo.getDownUrl(), DownTask.TASK_FileMerge);
       downInfo.setDownState(DownTask.TASK_FileMerge);
       String mp4filepath = null;
       if (filePath.endsWith(".flv")) {
         mp4filepath =
             parent
                 + "/"
                 + downInfo.getDownName()
                 + String.format("%03d", downInfo.getDownPosition())
                 + ".flv";
       } else {
         mp4filepath =
             parent
                 + "/"
                 + downInfo.getDownName()
                 + String.format("%03d", downInfo.getDownPosition())
                 + ".mp4";
       }
       final String[] filearray = list.toArray(new String[list.size()]);
       Arrays.sort(filearray); // 排序
       try {
         mlibvlc.nativeFileMerge(mp4filepath, filearray, false);
         // GetFileMergeStart(list, mp4filepath);
         // 合并完文件在更新数据库信息
         FileInputStream stream = new FileInputStream(mp4filepath);
         if (stream != null) {
           long size = stream.available();
           downInfo.setDownTotalSize(size);
           downInfo.setDownLocal(downInfo.getDownUrl());
           DBHelperDao.getDBHelperDaoInstace().updataMovieStoreSize(downInfo.getDownUrl(), size);
           DBHelperDao.getDBHelperDaoInstace()
               .updataMovieStoreLocal(downInfo.getDownUrl(), mp4filepath);
           downInfo.setDownState(DownTask.TASK_FINISHED);
           DBHelperDao.getDBHelperDaoInstace()
               .updataMovieStoreState(downInfo.getDownUrl(), DownTask.TASK_FINISHED);
           // 合并完成 删除源文件
           new Thread(
                   new Runnable() {
                     @Override
                     public void run() {
                       // TODO Auto-generated method stub
                       for (String fileName : list) {
                         FileUtils.deleteFile(fileName);
                       }
                     }
                   })
               .start();
         }
       } catch (Exception e) {
         // TODO: handle exception
         e.printStackTrace();
         return false;
       }
     }
   }
   return true;
 }
Пример #5
0
 public int DeleteFileCacheFromPPfilme(String filmHashID, String filecacheDir) {
   return mlibvlc.nativeDeleteFileCacheFromPPfilme(filmHashID, filecacheDir);
 };
Пример #6
0
 public int DeleteDownload(String filmuri, boolean bComplete) {
   int DeleteStatus = mlibvlc.nativeDelete(filmuri, bComplete);
   return DeleteStatus;
 }
Пример #7
0
 public int ResumeDownload(String filmuri) {
   int ResumeStatus = mlibvlc.nativeResume(filmuri);
   return ResumeStatus;
 }
Пример #8
0
 public int PauseDownload(String filmuri) {
   int pausestatus = mlibvlc.nativePause(filmuri);
   return pausestatus;
 }
Пример #9
0
 public String GetCurDownloadInfo(String pcsz_filmuri) {
   String DownloadInfo = mlibvlc.nativeGetDownloadInfo(pcsz_filmuri);
   return DownloadInfo;
 }
Пример #10
0
 public int GetCurFileSize(String filmuri) {
   int CurFileSize = mlibvlc.nativeGetCurFileSize(filmuri);
   return CurFileSize;
 }
Пример #11
0
 public String GetFileLoadPath(String filmHashID) {
   String Loadpath = mlibvlc.nativeGetFileLoadPath(filmHashID);
   return Loadpath;
 }
Пример #12
0
 public String GetLocalFileName(String filmHashID) {
   String LocalFileName = mlibvlc.nativeGetLocalFileName(filmHashID);
   return LocalFileName;
 }
Пример #13
0
 public String GeneralPlayerTask(String filmHashID, String SavePath) {
   String ppfilmurl = mlibvlc.nativeGeneralPlayerTask(filmHashID, SavePath);
   return ppfilmurl;
 }