From 73a22265ab53271122bf1f47bcca6e9604c5d159 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 1 Sep 2015 00:51:03 -0500 Subject: html5 mp3 player --- bucky2/bin/move-file | 38 +++++++++++---- bucky2/bin/rename-file | 44 +++++++++++++++++ cgi-bin/details | 115 +++++++++++++++++++++++++++++++++++---------- cgi-bin/localbucky.pm.tmpl | 2 +- cgi-bin/profile | 2 +- docs/css/bogart.css | 6 +++ fortune/titles | 10 ++-- 7 files changed, 178 insertions(+), 39 deletions(-) create mode 100755 bucky2/bin/rename-file diff --git a/bucky2/bin/move-file b/bucky2/bin/move-file index bd6dc48..7bfec85 100755 --- a/bucky2/bin/move-file +++ b/bucky2/bin/move-file @@ -4,15 +4,37 @@ use lib "../lib"; use Bucky; if (scalar(@ARGV) < 2) { - print "usage: move-file thread-id comment-id\n"; + print "usage: move-file thread-id file-ids\n"; exit(1); } -my $bucky = new Bucky; -$bucky->db->update_by_id('file', { - "id" => $ARGV[1], - "record" => { - "thread" => $ARGV[0] - } -}); +our $bucky = new Bucky; +our $thread_id = $ARGV[0]; + +for (my $i = 1; $i < scalar(@ARGV); $i++) { + move_file($ARGV[$i]); +} + +sub move_file { + my $file_id = shift; + + my $files = $bucky->db->select('file', { id => $file_id }); + my $file = $files->[0]; + + my $path = $ENV{"HOME"} . "/bucky/data/"; + + print "moving " . $file->{'filename'} . "\n"; + + system("/bin/mkdir", "-p", $path . $thread_id); + system("/bin/mkdir", "-p", $path . $thread_id . "/.thumb"); + system("/bin/mv", $path . $file->{'thread'} . "/" . $file->{'filename'}, $path . $thread_id); + + $bucky->db->update_by_id('file', { + "id" => $file_id, + "record" => { + "thread" => $thread_id + } + }); +} + diff --git a/bucky2/bin/rename-file b/bucky2/bin/rename-file new file mode 100755 index 0000000..a060b1a --- /dev/null +++ b/bucky2/bin/rename-file @@ -0,0 +1,44 @@ +#!/usr/bin/perl +use strict; +use lib "../lib"; +use Bucky; + +if (scalar(@ARGV) < 2) { + print "usage: move-file file-id filename\n"; + exit(1); +} + +our $bucky = new Bucky; +our $file_id = $ARGV[0]; +our $filename = $ARGV[1]; + +rename_file($file_id, $filename); + +sub rename_file { + my ($file_id, $filename) = @_; + + my $files = $bucky->db->select('file', { id => $file_id }); + my $file = $files->[0]; + + my $path = $ENV{"HOME"} . "/bucky/data/"; + + print $path . $file->{'thread'} . "/" . $filename . "\n"; + if (-e $path . $file->{'thread'} . "/" . $filename) { + print "file exists!\n"; + return + } + print "renaming " . $file->{'filename'} . " => " . $filename . "\n"; + + system("/bin/mv", + $path . $file->{'thread'} . "/" . $file->{'filename'}, + $path . $file->{'thread'} . "/" . $filename); + + $bucky->db->update_by_id('file', { + "id" => $file_id, + "record" => { + "filename" => $filename + } + }); +} + + diff --git a/cgi-bin/details b/cgi-bin/details index 35b34c7..dc245cf 100755 --- a/cgi-bin/details +++ b/cgi-bin/details @@ -147,32 +147,32 @@ sub details_view } if (@$files > $many_jpgs) { - if (find_mp3($files)) - { - my $z_playlist = "/cgi-bin/bucky/playlist/$t->{id}"; - my $z_autoplay = "false"; - if (check_key($USER->{boxes}, "autoplay")) - { $z_autoplay = "true"; } - print <<__PLAYLIST__; -
LOADING MP3 PLAYER ...
- - - -__PLAYLIST__ - } +# if (find_mp3($files)) +# { +# my $z_playlist = "/cgi-bin/bucky/playlist/$t->{id}"; +# my $z_autoplay = "false"; +# if (check_key($USER->{boxes}, "autoplay")) +# { $z_autoplay = "true"; } +# print <<__PLAYLIST__; +#
LOADING MP3 PLAYER ...
+# +# +# +#__PLAYLIST__ +# } if (check_key($t->{display}, "nfl")) # no file list { ; } elsif (check_key($t->{display}, "ffl")) # full file list @@ -193,6 +193,69 @@ __PLAYLIST__ print ""; print qq(); + print <<__PLAYER__; + +__PLAYER__ } sub find_mp3 diff --git a/cgi-bin/localbucky.pm.tmpl b/cgi-bin/localbucky.pm.tmpl index 143c192..69a617a 100644 --- a/cgi-bin/localbucky.pm.tmpl +++ b/cgi-bin/localbucky.pm.tmpl @@ -9,7 +9,7 @@ our $BUCKY_NAME = 'king of sf'; our $BUCKY_SHORT_NAME = 'kingofsf'; our $BUCKY_COOKIE_DOMAIN = 'kingofsf.com'; -our $BUCKY_ADMINISTRATOR = 'marc'; +our $BUCKY_ADMINISTRATOR = 'jules'; our $BUCKY_DEFAULT_BOXES = " welcome bPod radio postform hootbox photostream "; our $BUCKY_DEFAULT_KEYWORD = 'NONE'; # default should be 'NONE' our $BUCKY_TIMEZONE_OFFSET = 8; # correct your server's offset from GMT diff --git a/cgi-bin/profile b/cgi-bin/profile index 93dc089..3342f0c 100755 --- a/cgi-bin/profile +++ b/cgi-bin/profile @@ -44,7 +44,7 @@ sub main } elsif ($input->{username} eq "system") { - $input->{username} = "marc"; + $input->{username} = "jules"; header("profile for $input->{username}"); } elsif (get_uid($input->{username}) == -1) diff --git a/docs/css/bogart.css b/docs/css/bogart.css index 491f793..563b34c 100644 --- a/docs/css/bogart.css +++ b/docs/css/bogart.css @@ -299,3 +299,9 @@ pre,tt,code width: 310px; } +a.playing { + font-weight: bold; +} +a.playing:before { + content: '> '; +} diff --git a/fortune/titles b/fortune/titles index 1dfc421..4c17138 100644 --- a/fortune/titles +++ b/fortune/titles @@ -338,7 +338,7 @@ let me get the door for you, bucky bucky doffs his cap to you bucky ties your shoelaces together something on your mind, bucky? -a little bucky in the chest of drawers +bucky sleeping in the chest of drawers whoa! bucky, are you getting all this? bucky takes in the yard situation bucky stays home and pulls weeds @@ -379,7 +379,6 @@ bucky's final paroxysm bucky on two gelcaps bucky is transforming bucky making it happen -bucky's berry store bucky dines out bucky throws down bucky begs the question @@ -388,7 +387,7 @@ bucky orders the best thing bucky will have double bucky demands satisfaction bucky's dream comes alive -bucky's midday reverie +bucky's afternoon reverie call 555-bcky calling bucky to account bucky goes slo-mo @@ -398,3 +397,8 @@ bucky reveals the answer bucky and the dream deferred bucky intends to say more blushing bucky bends backward +bucky pulls up the traps +bucky casts the line +bucky leaps from the high rock +bucky crisps up some smores +bucky cracks open a lobster tail -- cgit v1.2.3-70-g09d2