Re: Media Protection and other stuff
Paul Westbrook <[email protected]> Wed, 23 Jun 2004 09:46:26 -0700
| Newsgroups | gmane.comp.audio.netjuke.user |
|---|---|
| Message-ID | <[email protected]> |
--Apple-Mail-1-180321177
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
Hello,
I like what we did for the NetjukeTiVo project
http://sourceforge.net/projects/netjuketivo
We created a playtrack.php script that is used to play the tracks.
Here is the contents of the important function. This function will
currently only work with the NetjukeTiVo project, but something similar
to this could be used for Netjuke in general.
The benefits of doing something like this are:
1) The play count is only updated when the track is played
2) The url only contains the track id of the song. The actual music
directory does not need to be in the htdocs path, since the php script
opens the files
3) This would be a perfect place to add transcoding.
function PlayTrack($id) {
GLOBAL $netjuke_music_path;
ini_set('zlib.output_compression', 'Off');
$trinfo = new TrackInfo;
$trinfo->FetchFromId($id);
$filename = $netjuke_music_path."/".urldecode($trinfo->location);
$safe_filename = escapeshellcmd($filename);
$FILECMD = '/usr/bin/file';
$contentType = '';
$fp=popen("$FILECMD -binL \"$safe_filename\"", 'r');
if (!$fp) $contentType='application/octet-stream';
else {
while($string=fgets($fp, 1024)) $contentType .= $string;
pclose($fp);
}
header("Content-type: $contentType");
header("Content-Length: ".filesize($filename));
header("Content-Disposition: inline;
filename=".basename($filename));
$mp3file = fopen($filename, 'rb');
if ($_REQUEST['Seek']) {
/* The 'Seek' paramater is specified in milliseconds from the
beginning of the song, so what we're going to do is
interpolate
bytes from there, because actually seeking is too much
work. We
could do that later if we really cared */
$fraction = $_REQUEST['Seek'] / $trinfo->time;
$byte_location = floor($fraction * $trinfo->size);
/*
print "location is $trinfo->location\n";
print "Seek is ".$_REQUEST['Seek']."\n";
print "Fraction is $fraction\n";
print "byte_location is $byte_location\n";
*/
fseek($mp3file, $byte_location, SEEK_SET);
} else {
if (isset($_REQUEST['update'])) {
if ($_REQUEST['update'] != 0) {
// $_REQUEST['update'] is set to something other than 0
$trinfo->IncrementPlaycount();
}
} else {
// $_REQUEST['update'] is unset
$trinfo->IncrementPlaycount();
}
}
fpassthru($mp3file);
exit;
}
--Paul
On Jun 23, 2004, at 8:58 AM, Josh Escobedo wrote:
> What are folk doing for media protection? I'm using the "media proxy"
> built into netjuke (simple URL obfuscation), but it isn't enough to
> make me feel safe. It's still possible, should someone guess the name
> of any subdirectory in my /var/music folder and get at the files.
>
> Making the /var/music folder non world-readable or aliasing it back to
> /netjuke breaks netjuke's playback.
>
> Anyone know how the media proxy works in netjuke? I'm wondering if it
> can be hacked to, say, open mp3s with readfile(); or something, from a
> directory that the web user has access to, but that isn't a valid path
> to the http server.
>
> Or maybe something using .htaccess? I dunno. The goal is to leave
> netjuke on a public enough box that I can get to my music from
> anywhere, while not leaving it open for strangers to pilfer my
> collection and suck up valuable bandwidth.
>
> Next issue...
>
> I encode my collection at 320kbps. I like it that high, because I
> listen to the same files at home where bandwidth isn't an issue, and
> while 128kbps is certainly listenable, 320 is actually somewhat
> pleasant. Ideally, I'd have the disk space to keep everything .ape or
> even .wav/.aiff.
>
> This puts a serious cramp in listening through netjuke away from home.
> What I wind up doing is using VNC to connect to a windows box at
> home, open a web browser to netjuke there, pick the day's random batch
> of songs, and play them in winamp, which streams to shoutcast on a
> unix box (equalizing every track to a more manageable 128kbps
> bitrate), that I listen to at work/fiancee's/friends' houses/etc.
>
> Short of maintaining two separate collections (320kbps or
> uncompressed, and 128kbps for net playback), what else is there?
> Netjuke seems to be configurable to send its playlists to an app on
> the server, but that's a global setting. This leads me to believe any
> user in my household who plays a track will interrupt any existing
> playlist that someone else may be listening to.
>
> Next...
>
> Anyone else do any hacking of the PHP/html in netjuke for
> customization? I didn't like the three-column genre browsing list, I
> made it two. In "Random," picking a 500-track playlist freaks the
> server out, and 10 was too small a default for me, so I changed things
> a bit there too. A 250-track playlist seems to not freak the server
> out, and that's now the default. Also added defaults to filter out
> songs less than 61 seconds or more than 900. Beats typing it in every
> day. I also stuck nowrap attributes in various <td> tags throughout
> netjuke, out of personal preference. Simple changes.
>
> I'd be interested to hear what other folk have done, maybe some deeper
> stuff. Like I think it'd be neat to have a "browse-only" user class,
> that would allow browsing of the collection without download/playback
> ability. It would let folk put their netjukes more in the public eye
> (allowing others to toy with it and see if they like it) without
> making "criminals" out of them in the eyes of the RIAA.
>
> -- josh escobedo, computer support
> office of international services
> university of illinois at chicago
> -------------------------------------
> Any opinions expressed in the content of this e-mail
> are the sole responsibility of the author, and do not
> reflect the opinions, policies or intentions of the
> University of Illinois at Chicago, the Office of the Vice
> Chancellor for Student Affairs, the Office of International
> Services, or their assigns.
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by Black Hat Briefings & Training.
> Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital
> self defense, top technical experts, no vendor pitches, unmatched
> networking opportunities. Visit www.blackhat.com
> _______________________________________________
> Netjuke-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/netjuke-users
>
>
--
Paul Westbrook
[email protected]
<http://www.westbrooks.org>
--Apple-Mail-1-180321177
Content-Transfer-Encoding: base64
Content-Type: application/pkcs7-signature;
name=smime.p7s
Content-Disposition: attachment;
filename=smime.p7s
MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGGjCCAtMw
ggI8oAMCAQICAwt8jDANBgkqhkiG9w0BAQQFADBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhh
d3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVt
YWlsIElzc3VpbmcgQ0EwHhcNMDQwMTE2MDQ1OTQ4WhcNMDUwMTE1MDQ1OTQ4WjBFMR8wHQYDVQQD
ExZUaGF3dGUgRnJlZW1haWwgTWVtYmVyMSIwIAYJKoZIhvcNAQkBFhNwYXVsQHdlc3Ricm9va3Mu
b3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1QAsFxJzkKVF3otQ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GQuMSwwKgYDVQQDEyNUaGF3dGUgUGVyc29uYWwg
RnJlZW1haWwgSXNzdWluZyBDQQIDC3yMMHoGCyqGSIb3DQEJEAILMWugaTBiMQswCQYDVQQGEwJa
QTElMCMGA1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3Rl
IFBlcnNvbmFsIEZyZWVtYWlsIElzc3VpbmcgQ0ECAwt8jDANBgkqhkiG9w0BAQEFAASCAQCIKgRu
KGCJIvGkRfSS7EXvfOf/R9M5zdB1KxIojqiFrzALmt6gAJqp0edpUv/0EwesqXJSK+yFXwsAC4cW
I+gXBIW/4XGSFqWXxWi+rEEOQHruXAjTOvYdibELz0Qhl/b3iI/i/uLzTGOZ/RjklzWOEQ4Eq8Ew
TO827EPo5HiMvqB+tXwQh76k0lQVHiKu3TzZIjtSb5TRDiKV7YcT+PbJ8lqG2GpbJ4+LG6hrtg/Z
x5VRZL8F4GHWZgqAqBgORyLS/FtR2bdpxcbGAhaPaXV+uuRLeLpQKk4IiVkgNnWZW1GZH+jM/5fs
HB60ANCakq9OGiplmq3ytNR+0/oiRo9AAAAAAAAA
--Apple-Mail-1-180321177--
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com