Re: Can Netjuke create MP3s on the fly?
"Paul Westbrook" <[email protected]>
| Newsgroups | gmane.comp.audio.netjuke.user |
|---|---|
| Message-ID | <[email protected]> |
Hello,
Thank you for your changes. It wasn't working for me in a lot of songs
since I have spaces in many of my artists and albums. I needed to
urlencode the track information. Here are my changes:
diff play.php play.php.orig
83d82
<
89,99c88,89
<
< # this is disabled - we go for resampling
< # if (!strstr($tr_location,"://")) $tr_location =
WEB_PATH."/".$tr_location;
<
< # new code
< if (strncmp('10.',$_SERVER['REMOTE_ADDR'],3) &&
strncmp('192.168.',$_SERVER['REMOTE_ADDR'],8) &&
strstr($tr_location,".mp3")) {
< if (!strstr($tr_location,"://")) $tr_location =
WEB_PATH."/playmp3.php?mp3file=".$tr_location.'&tr='.specialUrlEncode($tr_name).'&ar='.specialUrlEncode($ar_name).'&al='.specialUrlEncode($al_name);
< }
< else {
< if (!strstr($tr_location,"://")) $tr_location =
WEB_PATH."/".$tr_location;
< }
---
> if (!strstr($tr_location,"://")) $tr_location =
WEB_PATH."/".$tr_location;
>
Here is my playmp3.php file:
<?
$filename = $_REQUEST['mp3file'];
$tr_name = (isset ($_REQUEST['tr'])) ? rawurldecode($_REQUEST['tr']) :
'Netjuke playlist';
$ar_name = (isset ($_REQUEST['ar'])) ? rawurldecode($_REQUEST['ar']) : '';
$al_name = (isset ($_REQUEST['al'])) ? rawurldecode($_REQUEST['al']) : '';
$bitrate = 64; // desired streaming bitrate
header("Content-type: audio/mp3");
set_time_limit(1800); // maximum length of a song
echo passthru("/usr/local/bin/lame --add-id3v2 --ta \"$ar_name\" --tl
\"$al_name\" --tt \"$tr_name\" -b $bitrate -f --silent \"/data/www/html/
netjuke/$filename\" - ");
?>
Thanks,
Paul
Chuck Rider -Lists said:
> Here is another twist on the same theme.
>
> This one has two effects. First, it downsamples for any request from the
> internet and sends the files directly to the internal network. That way
> I can log on with the same name from work or home and have the system
> figure it out for me.
>
> Second, It passes the track, artist, and album names to lame for
> inclussion in the downsampled mp3. It also forces lame to generate both
> ID3v1 and ID3v2 tags. This way Windows Media Player (and other I
> suspect) display the info as the song plays.
>
> diff netjuke/play.php netjuke/play.php.orig :
> 88,96c88,89
> < # this is disabled - we go for resampling
> < # if (!strstr($tr_location,"://")) $tr_location =
> WEB_PATH."/".$tr_location;
> < # new code
> < if (strncmp('10.',$_SERVER['REMOTE_ADDR'],3) &&
> strncmp('192.168.',$_SERVER['REMOTE_ADDR'],8) &&
> strstr($tr_location,".mp3")) {
> < if (!strstr($tr_location,"://")) $tr_location =
> WEB_PATH."/playmp3.php?mp3file=".$tr_location.'&tr='.$tr_name.'&ar='.$ar_name.'&al='.$al_name;
> < } else {
> < if (!strstr($tr_location,"://")) $tr_location =
> WEB_PATH."/".$tr_location;
> < }
> ---
>> if (!strstr($tr_location,"://")) $tr_location =
> WEB_PATH."/".$tr_location;
>>
>
> and playmp3.php looks like:
> <?
>
> $filename = $_REQUEST['mp3file'];
> $tr_name = (isset ($_REQUEST['tr'])) ? $_REQUEST['tr'] : 'Netjuke
> playlist'; $ar_name = (isset ($_REQUEST['ar'])) ? $_REQUEST['ar'] : '';
> $al_name = (isset ($_REQUEST['al'])) ? $_REQUEST['al'] : '';
>
> $bitrate = 8; // desired streaming bitrate
> header("Content-type: audio/mp3");
> set_time_limit(1800); // maximum length of a song
>
> echo passthru("/usr/local/bin/lame --add-id3v2 --ta \"$ar_name\" --tl
> \"$al_name\" --tt \"$tr_name\" -b $bitrate -f --silent
> \"/www/netjuke/$filename\" - ");
>
> ?>
> ------------------------------------------------------
>
>
>> Will Meyer <[email protected]> schrieb am 21.03.03 14:45:45:
>>>
>>> My music collection is all FLAC, which I listen to directly at home.
>>> If I set up Netjuke, is there a way to configure it to generate MP3s
>>> from FLAC dyamically, maybe pre-caching whole albums or something but
>>> in > essence a way to keep a lossless format for most purposes and
>>> just get it to stream out MP3s for listening over lower-bandwith WAN
>>> connections? Is the code set up to be able to write a plugin for
>>> such without too > much trouble?
>>
>> Hi Will,
>>
>> I have used a former hint from the mailing list to set up netjuke to
>> transcode mp3's on the fly to a lower bitrate for a single user. In
>> this setup you can easily replace the 'transcode' thing with an
>> 'encode' thing. Well, as long as your machine is powerful enough.
>> And if you like to have it be done unconditionally, you can just leave
>> out the bit with the user; and you would have to replace the *.mp3
>> with *.flc or whatever the suffix for FLAC's is.
>>
>> It goes like this:
>>
>> diff netjuke/play.php netjuke/play.php.orig :
>>
>> 88,101c88,91
>> <
>> < # this is disabled - we go for resampling
>> < # if (!strstr($tr_location,"://")) $tr_location =
>> WEB_PATH."/".$tr_location; <
>> < # new code
>> < if (($NETJUKE_SESSION_VARS["email"] == "[email protected]") &&
>> (strstr($tr_location,".mp3"))) { < if
>> (!strstr($tr_location,"://")) $tr_location =
>> WEB_PATH."/playmp3.php?mp3file=".$tr_location; <
>> $tr_location = separatorCleanup($tr_location);
>> < }
>> < else {
>> < if (!strstr($tr_location,"://")) $tr_location =
>> WEB_PATH."/".$tr_location; < $tr_location =
>> separatorCleanup($tr_location);
>> < }
>> <
>> ---
>>> if (!strstr($tr_location,"://")) $tr_location =
>>> WEB_PATH."/".$tr_location;
>>>
>>> $tr_location = separatorCleanup($tr_location);
>>
>> Basically this just calls playmp3.php with the approriate parameter if
>> the user name is as specified and the file is an MP3.
>>
>> Additionally you need netjuke/playmp3.php which goes like this:
>>
>> <?
>>
>> $filename = $_REQUEST['mp3file'];
>>
>> $bitrate = 64; // desired streaming bitrate
>> header("Content-type: audio/mp3");
>> set_time_limit(1800); // maximum length of a song
>>
>> echo passthru("/usr/bin/lame -b $bitrate -f --silent
>> \"/srv/www/netjuke/$filename\" - ");
>>
>> ?>
>>
>> Here you can see the transcoding command. Just replace it with
>> anything appropriate. (Maybe you' ll have to de-flac and then encode
>> to mp3 in a pipe.)
>>
>> Have fun
>> Matthias
>>
>> ps Just drop me an e-mail if you've got some question on the above.
>>
>> ______________________________________________________________________________
>> Sie haben mehr zu sagen als in eine SMS passt? Mit WEB.DE FreeMail ist
>> das jetzt kein Problem mehr!
>> http://freemail.web.de/features/?mc=021182
>>
>>
>>
>> -------------------------------------------------------
>> This sf.net email is sponsored by:ThinkGeek
>> Welcome to geek heaven.
>> http://thinkgeek.com/sf
>> _______________________________________________
>> Netjuke-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/netjuke-users
>
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by:
> The Definitive IT and Networking Event. Be There!
> NetWorld+Interop Las Vegas 2003 -- Register today!
> http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en
> _______________________________________________
> Netjuke-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/netjuke-users
--
Paul Westbrook
[email protected]
http://www.westbrooks.org
-------------------------------------------------------
This SF.net email is sponsored by:
The Definitive IT and Networking Event. Be There!
NetWorld+Interop Las Vegas 2003 -- Register today!
http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en