XFileSharing Pro - mp3 preview problems - Page 2

Message
Author
komi
Posts: 161
Joined: Nov 27, 2009 12:41 pm

#16 Postby komi » Dec 06, 2009 1:19 am

Ofcourse you can. That's the way I use direct links myself.

Code: Select all

<a href="<TMPL_VAR direct_link>"><img src="<TMPL_VAR site_url>/images/download.gif" border="0"></a>
You probably also need to move the direct link piece from sub Download2 to sub Download1 in index.cgi

Arthur
Posts: 74
Joined: Dec 04, 2009 12:00 am

#17 Postby Arthur » Dec 06, 2009 1:29 am

k i got the button in and when I click it just refreshes the page what exactly do I change in the index.cgi

komi
Posts: 161
Joined: Nov 27, 2009 12:41 pm

#18 Postby komi » Dec 06, 2009 1:36 am

I'm going to get some sleep (I live in Europe), I will check back tomorrow.
Temporarily restore the download button if you want.

Arthur
Posts: 74
Joined: Dec 04, 2009 12:00 am

#19 Postby Arthur » Dec 06, 2009 1:50 am

k thnx for the help Ill try to figure it out till then ;)

Arthur
Posts: 74
Joined: Dec 04, 2009 12:00 am

#20 Postby Arthur » Dec 07, 2009 2:06 am

couldnt figure it out..little more help?

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

#21 Postby PilgrimX182 » Dec 07, 2009 8:59 am

Solution for dl.cgi: comment this line in index.cgi:

Code: Select all

my $fname = $file->{file_name};

Arthur
Posts: 74
Joined: Dec 04, 2009 12:00 am

#22 Postby Arthur » Dec 07, 2009 10:45 pm

I have this in my index.cgi

Code: Select all

if($c->{mp3_mod} && $file->{file_name}=~/\.mp3$/i && !$file->{message})
   {
      DownloadTrack($file) if $c->{mp3_mod_no_download};
      $file->{song_url} = DownloadGenLink($file,"$file->{file_code}.mp3");
      (undef,$file->{mp3_secs},$file->{mp3_bitrate},$file->{mp3_freq},$file->{mp3_artist},$file->{mp3_title},$file->{mp3_album},$file->{mp3_year}) = split(/\|/,$file->{file_spec}) if $file->{file_spec}=~/^A\|/;
      $file->{no_link}=1 if $c->{mp3_mod_no_download};
      $ses->{meta_keywords}.=", $file->{mp3_artist}" if $file->{mp3_artist};
      $ses->{meta_keywords}.=", $file->{mp3_title}" if $file->{mp3_title};
      $ses->{meta_keywords}.=", $file->{mp3_album}" if $file->{mp3_album};
   }
Where would I put that line?

Arthur
Posts: 74
Joined: Dec 04, 2009 12:00 am

#23 Postby Arthur » Dec 08, 2009 3:51 am

But I would like to use the direct link download instead. I have replaced the generate button with an image but now which parts need to be change in the index.cgi to make it download right away when clicking on image..

Whats exact direct link code would I copy from sub Download2 to sub Download1 in index.cgi?

Arthur
Posts: 74
Joined: Dec 04, 2009 12:00 am

#24 Postby Arthur » Dec 09, 2009 1:53 am

Never mind figured everything out.

komi
Posts: 161
Joined: Nov 27, 2009 12:41 pm

#25 Postby komi » Dec 09, 2009 9:29 am

Great! Maybe an idea to post exactly what you did? I'm sure some people are interested in doing this.

shynobee
Posts: 29
Joined: Apr 28, 2009 4:35 am

#26 Postby shynobee » Dec 12, 2009 2:46 pm

yea would be cool when u can tell us what you did..im also trying to find out what i need to change in index.cgi

Arthur
Posts: 74
Joined: Dec 04, 2009 12:00 am

#27 Postby Arthur » Dec 17, 2009 6:15 pm

All you got to do is put this code under sub 1 download in the index.cgi

Code: Select all

$file->{direct_link} = &DownloadGenLink($file); 
it goes right after this

Code: Select all

   if($c->{mp3_mod} && $file->{file_name}=~/\.mp3$/i && !$file->{message})
   {
      DownloadTrack($file) if $c->{mp3_mod_no_download};
      $file->{song_url} = DownloadGenLink($file,"$file->{file_code}.mp3");
      (undef,$file->{mp3_secs},$file->{mp3_bitrate},$file->{mp3_freq},$file->{mp3_artist},$file->{mp3_title},$file->{mp3_album},$file->{mp3_year}) = split(/\|/,$file->{file_spec}) if $file->{file_spec}=~/^A\|/;
      $file->{no_link}=1 if $c->{mp3_mod_no_download};
      $ses->{meta_keywords}.=", $file->{mp3_artist}" if $file->{mp3_artist};
      $ses->{meta_keywords}.=", $file->{mp3_title}" if $file->{mp3_title};
      $ses->{meta_keywords}.=", $file->{mp3_album}" if $file->{mp3_album};
   }

shynobee
Posts: 29
Joined: Apr 28, 2009 4:35 am

#28 Postby shynobee » Dec 17, 2009 8:38 pm

thx Arthur works fine

revive
Posts: 9
Joined: Apr 04, 2010 6:40 am

#29 Postby revive » Jun 09, 2010 3:33 am

Just saw this thread and was working on the same thing for one of our sites.. thought this might be a helpful addition.

When we added the Direct Link for the MP3's and moved the index.cgi code accordingly.. we ended up with BOTH the 'Generate Direct Link' and 'Direct Link' links.. (say that 10 times fast!).. anyway, here is a small code snippet for your download1.html file that will hide all but your MP3 direct download link, IF the file is an MP3..

Code: Select all

<TMPL_UNLESS song_url>
	<TMPL_IF direct_links>
		<input type="hidden" name="down_direct" value="1">
		<input type="submit" id="btn_download" value="Get Direct Link">
	<TMPL_ELSE>
		<input type="hidden" name="down_script" value="1">
		<input type="submit" id="btn_download" value="<TMPL_VAR lang_download_file>">
	</TMPL_IF>
</TMPL_UNLESS>

<TMPL_IF song_url>
	<a href="<TMPL_VAR direct_link>" id="btn_download">Download Song Instantly</a>
</TMPL_IF>

It's pretty self explanatory,.. but, for those not as familiar with XFileSharing Pro's code.. I've wrapped the original IF/ELSE statement with an UNLESS statement.. meaning, UNLESS its an MP3, show that code.. then after that.. since it will effective hide the original buttons if its an MP3 file.. I've added the IF song_url code.. this checks to make sure its an MP3 and then adds the link accordingly.. I've styled it using CSS and changed the image to text, from the previous posters example.

You can see the results here:
http://gigashares.net/tktejzp68ier.html

Cheers