XFileSharing Pro - How to move divx player to download2.html

Message
Author
th3hotcake
Posts: 51
Joined: Apr 07, 2009 7:24 pm

How to move divx player to download2.html

#1 Postby th3hotcake » Jun 29, 2009 4:57 am

DivX player only works on download1.html. If I take this code any move it to download2.html it doesn't do anything. I've looked through all the coding and can't figure out what to do.

Code: Select all

<TMPL_IF video_code>
<table cellpadding=0 cellspacing=0 style="margin:5px;border:1px solid #555;"><tr><td>
<TMPL_VAR video_code>
</td></tr></table>
</div>
</TMPL_IF>
I need to do this so free users won't be able to watch videos non-stop.

Thanks

User avatar
PilgrimX182
Posts: 2186
Joined: Mar 22, 2006 1:39 pm

#2 Postby PilgrimX182 » Jun 29, 2009 2:13 pm

This is not that quick hack, email [email protected] for custom quote.

th3hotcake
Posts: 51
Joined: Apr 07, 2009 7:24 pm

#3 Postby th3hotcake » Jun 29, 2009 2:30 pm

That would not be a problem at all, except I have already paid $50. It seems like the video files should be played only after the free user generates the link so they can't just leech from your site all day without any restrictions. Does that make sense?

I know it has to do with this code. If you understand, I would hope you reconsider. The divx mod is almost useless if free users can watch without restrictions.

Code: Select all

$file->{video_code}=qq[document.write('<object id="ie_vid" classid="clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616" width="$file->{vid_width}" height="$file->{vid_height}" codebase="http://go.divx.com/plugin/DivXBrowserPlugin.cab">
<param name="custommode" value="Stage6" />
<param name="wmode" value="transparent" />
<param name="previewImage" value="$file->{video_img_url}" />
<param name="allowContextMenu" value="false">
<param name="bannerEnabled" value="false" />
<param name="previewMessage" value="Play" />
<param name="autoPlay" value="false" />
<param name="src" value="$file->{direct_link}" />
<embed id="np_vid" type="video/divx" src="$file->{direct_link}" custommode="Stage6" wmode="transparent" width="512" height="288" previewImage="$file->{video_img_url}" autoPlay="false" bannerEnabled="false" previewImage="$file->{direct_img}" allowContextMenu="false" previewMessage="Play" pluginspage="http://go.divx.com/plugin/download/"></embed>
</object>');];

      $file->{video_code} = &encodeJS($file->{video_code});
Best regards

User avatar
PilgrimX182
Posts: 2186
Joined: Mar 22, 2006 1:39 pm

#4 Postby PilgrimX182 » Jul 01, 2009 6:08 am

In index.cgi: from sub Download1 cut this part:

Code: Select all

   if($ses->iPlg('v') && $c->{m_v} && $file->{file_spec}=~/^V/)
   {
      my @fields=qw(vid vid_length vid_width vid_height vid_bitrate vid_audio_bitrate vid_audio_rate vid_codec vid_audio_codec vid_fps);
      my @vinfo = split(/\|/,$file->{file_spec});
      $file->{$fields[$_]}=$vinfo[$_] for (0..$#fields);
      $file->{vid_codec}=~s/ffo//i;
      $file->{vid_codec}=~s/ff//i;
      $file->{vid_codec}=uc $file->{vid_codec};
      $file->{vid_audio_codec}=~s/faad/AAC/i;
      $file->{vid_audio_codec}=~s/ff//i;
      $file->{vid_audio_codec}=uc $file->{vid_audio_codec};
      $file->{vid_fps}=~s/\.000//;
      $file->{vid_length2} = sprintf("%02d:%02d:%02d",int($file->{vid_length}/3600),int($file->{vid_length}/60)%3600,$file->{vid_length}%60);
      my $dx = sprintf("%05d",($file->{file_real_id}||$file->{file_id})/$c->{files_per_folder});
      $file->{srv_htdocs_url}=~/(.+)\/.+$/;
      $file->{video_img_url}="$1/i/$dx/$file->{file_real}.jpg";
      if($file->{vid_codec}=~/(divx|xvid)/i)
      {
         my $res = $ses->api($file->{srv_cgi_url},
                          {
                           op           => 'gen_link',
                           file_id      => $file->{file_real_id}||$file->{file_id},
                           file_code    => $file->{file_real},
                           file_name    => $file->{file_name},
                           fs_key       => $file->{srv_key},
                           ip           => $ses->getIP });
      my ($ddcode) = $res=~/^OK:(.+)$/;
      $file->{direct_link} = "$file->{srv_htdocs_url}/$ddcode/$file->{file_name}";

$file->{video_code}=qq[document.write('<object id="ie_vid" classid="clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616" width="$file->{vid_width}" height="$file->{vid_height}" codebase="http://go.divx.com/plugin/DivXBrowserPlugin.cab">
<param name="custommode" value="Stage6" />
<param name="wmode" value="transparent" />
<param name="previewImage" value="$file->{video_img_url}" />
<param name="allowContextMenu" value="false">
<param name="bannerEnabled" value="false" />
<param name="previewMessage" value="Play" />
<param name="autoPlay" value="false" />
<param name="src" value="$file->{direct_link}" />
<embed id="np_vid" type="video/divx" src="$file->{direct_link}" custommode="Stage6" wmode="transparent" width="$file->{vid_width}" height="$file->{vid_height}" previewImage="$file->{video_img_url}" autoPlay="false" bannerEnabled="false" previewImage="$file->{direct_img}" allowContextMenu="false" previewMessage="Play" pluginspage="http://go.divx.com/plugin/download/"></embed>
</object>');];

      $file->{video_code} = &encodeJS($file->{video_code});
      }
   }
and paste it ABOVE this line in sub Download2:

Code: Select all

$ses->PrintTemplate("download2.html",
Then cut this code from download1.html:

Code: Select all

<TMPL_IF video_code>
<table cellpadding=0 cellspacing=0 style="margin:5px;border:1px solid #555;"><tr><td>
<TMPL_VAR video_code>
</td></tr></table>
</div>
</TMPL_IF>
and paste in required place in download2.html

But if you have XFSPro1.5 without custom mods then better wait 40 mins - I'm gonna add this feature to current release.

th3hotcake
Posts: 51
Joined: Apr 07, 2009 7:24 pm

#5 Postby th3hotcake » Jul 01, 2009 6:31 am

Thank you so much. I'll try this tomorrow morning.

User avatar
PilgrimX182
Posts: 2186
Joined: Mar 22, 2006 1:39 pm

#6 Postby PilgrimX182 » Jul 01, 2009 6:56 am

Allright, added this to production. Made even better: so you can choose in settings to show on Download1 or Download2 page. If Download2 page selected for player, then we still show video info and snapshot on Download1 page.

Get the latest ZIP from client area and update index.cgi, download1.html, download2.html, admin_settings.html.

th3hotcake
Posts: 51
Joined: Apr 07, 2009 7:24 pm

#7 Postby th3hotcake » Jul 01, 2009 11:38 am

Epic! Will try this after I get back from work. Thanks again.

th3hotcake
Posts: 51
Joined: Apr 07, 2009 7:24 pm

#8 Postby th3hotcake » Jul 01, 2009 5:22 pm

Pilgrim, it appears that I cannot choose between pages (download1 vs download2) in the settings page. When I select download2 and click save, it just goes back to download1 automatically. I'm going to see if I can fix this code for myself, but thought I would let you know. It might be something I'm doing wrong, but I doubt it. Copied all files you said to.

EDIT: Direct downloads must be checked to take the user to download2.html. Would it be possible to not run direct downloads, but still take the user to download2.html IF the file is a video file? That sounds complicated, but I thought I'd ask.

User avatar
PilgrimX182
Posts: 2186
Joined: Mar 22, 2006 1:39 pm

#9 Postby PilgrimX182 » Jul 01, 2009 6:12 pm

oh, forgot to mention - you need new option in XFileConfig.pm:

Code: Select all

m_v_page => '1',
check this in XFileConfig from new zip.

dl.cgi and download2 page is possible but I don't think I will provide you quick hack or put this into official version.

th3hotcake
Posts: 51
Joined: Apr 07, 2009 7:24 pm

#10 Postby th3hotcake » Jul 01, 2009 10:04 pm

Works nicely. Although I checked the the newest files on your site do not have this line.

Code: Select all

m_v_page => '1',
I got it working, though. Thanks again for the great support.