Adult Script Pro Community Forums

The forum is here for legacy reasons. No new posts will be created. User registration is disabled! If you have any questions, please email us or check https://www.adultscriptpro.com for more details!

You are not logged in.

#1 2012-09-13 01:15:30

Nuevolab
Member
Registered: 2012-08-01
Posts: 189

Thumbs generator and external server...

Today I was installing my progresbar thumbs plugin for Nuevoplayer on some older ASP script with multi-server use.
I found that it doesn't support standard thumbs regenerate function, next found that "server" helper's function doesn't support video "download" option required to regenerate thumbs.
I understand it, and it was not difficult to add such options to older script version.

But then I found 2 issues.

1.
When helper's download funtion run I found that it can't download video if source is like "/flv/xxx.flv"
But it works when source is like "flv/xxx.flv"
I'm not sure if this is a bug or it works different on different servers...
I checked what is FTP root, it doesn't have slash at the end.
Anyway I used:  ltrim($file,"/");  function, so there's no slash at the beginning and everything works fine.

2.
I also noticed that when file is downloaded from other server for thumbs or my progressbar slides action,
later downloaded file is not removed from default server.
So in admin's video component manage file after thumbs generate proccess I added: 

if($downloaded==true && $server_id!=0) { unlink($src); }

Dowloaded video is removed then as it's not needed any more.
I think this is code that should be there in thumbs extract function.

Last edited by Nuevolab (2012-09-13 03:45:38)

Offline

#2 2012-09-13 12:08:10

symtab
Administrator
Registered: 2010-08-23
Posts: 7,501
Website

Re: Thumbs generator and external server...

You added support for video downloads when using multi-server and the video is on a separate server?


Adult Scripts: Adult Script Pro - Adult Search Script
Adult Advertising/Traffic: Plug Rush - EXOClick - PopAds

Offline

#3 2012-09-13 14:04:02

Nuevolab
Member
Registered: 2012-08-01
Posts: 189

Re: Thumbs generator and external server...

symtab wrote:

You added support for video downloads when using multi-server and the video is on a separate server?

Yeap, exactly.
In newer version of the ASP, script in video helper's server.php file you have a function:
public static function download($server, $file, $dst)
It downloads video from other server back to default server: if (ftp_get($conn_id, $dst, $file, FTP_BINARY))
Originally this is used to regenrate thumbs in the ASP script. So I also used it to generate slides for my Progressbar thumbs plugin.
Maybe it's not perfect solution, but works.

But there is no such function in older ASP script version I worked on, so I just added it. It's OK, no problem with it.
- $dst is destination path on current server where downloaded file is to be stored,
- $file is extension+name of the file to download
- $server['ftp_root'] is location connected through ftp.
So when ftp root is: "public_html/media/videos", example $file is "/flv/xxx.flv"
And this doesn't download file. But downloads it when $file is "flv/xxx.flv"
That's why before ftp_get function is called I used: ltrim($file,"/");

ALso in file "admin/modules/video/components/manage.php" in newer ASP version you have a function to regenrate thumbs:
private function generate_thumbs($video_id)
In case when video hosted on other server, it is downloaded first and stored on default server:
                      if (VHelper_video_server::download($server, '/'.$ext.'/'.$video_id.'.'.$ext, $src)) {
                          $downloaded = TRUE;
                      }
SO I think that in such case, once thumbs generated vdeo should be removed, eg.
if ($thumbs !== 0) {
    if($downloaded && $server_id != '0') unlink($src);

Last edited by Nuevolab (2012-09-13 14:11:31)

Offline

Board footer

Powered by FluxBB