aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpsyc://loupsycedyglgamf.onion/~lynX <ircs://psyced.org/youbroketheinternet>2016-08-10 15:28:49 +0000
committerpsyc://loupsycedyglgamf.onion/~lynX <ircs://psyced.org/youbroketheinternet>2016-08-10 15:28:49 +0000
commit677e6c209079b05a612a87c8e0519067c89fe024 (patch)
tree72aed877f3018f2abc780c1c41590c0228e1a8fd
parent1d2891be74a625947b67e0bb2cf9bd0bf7c516d4 (diff)
downloadperlpsyc-677e6c209079b05a612a87c8e0519067c89fe024.tar.gz
perlpsyc-677e6c209079b05a612a87c8e0519067c89fe024.zip
prefer local directory playlists
-rwxr-xr-xbin/psycamp9
1 files changed, 5 insertions, 4 deletions
diff --git a/bin/psycamp b/bin/psycamp
index a6ca3ce..6ae4b43 100755
--- a/bin/psycamp
+++ b/bin/psycamp
@@ -150,7 +150,8 @@ my $screen = 0;
150 $tmpdir='/tmp' unless -d $tmpdir and -w _; 150 $tmpdir='/tmp' unless -d $tmpdir and -w _;
151 $tmpdir='.' unless -d $tmpdir and -w _; 151 $tmpdir='.' unless -d $tmpdir and -w _;
152 # $tmplock="$tmpdir/.psycamp-copylock"; 152 # $tmplock="$tmpdir/.psycamp-copylock";
153 $playlist="$tmpdir/playlist-$ENV{USER}.m3u"; 153 $playlist=".psycamp-$ENV{USER}.m3u";
154 $playlist="$tmpdir/$playlist" unless -w $playlist or -w '.';
154 155
155MAIN: { 156MAIN: {
156 if ($#ARGV >= 0) { 157 if ($#ARGV >= 0) {
@@ -1334,7 +1335,7 @@ sub load {
1334 local *L; 1335 local *L;
1335 return unless open (L, $playlist); 1336 return unless open (L, $playlist);
1336 for ($NS=0; <L>;) { 1337 for ($NS=0; <L>;) {
1337 chomp; 1338 s/\r?\n$//;
1338 if ($opt_L and not -r $_) { 1339 if ($opt_L and not -r $_) {
1339 print "Skipping $_\n"; 1340 print "Skipping $_\n";
1340 next; 1341 next;
@@ -1356,7 +1357,7 @@ sub save {
1356 foreach my $i ($cs+1 .. $NS-1) { 1357 foreach my $i ($cs+1 .. $NS-1) {
1357 my $f = $file[$order[$i]]; 1358 my $f = $file[$order[$i]];
1358 print L $ENV{PWD}, '/' unless $f =~ m!^/!; 1359 print L $ENV{PWD}, '/' unless $f =~ m!^/!;
1359 print L $f, "\n"; 1360 print L $f, "\r\n";
1360 } 1361 }
1361 close L; 1362 close L;
1362} 1363}
@@ -1371,7 +1372,7 @@ sub edit {
1371 1372
1372sub addtolist { 1373sub addtolist {
1373 if (open(A, ">>playlist.m3u")) { 1374 if (open(A, ">>playlist.m3u")) {
1374 print A "$CurrentFile\n"; 1375 print A "$CurrentFile\r\n";
1375 close A; 1376 close A;
1376 print YELLOW, "\rAdded $CurrentFile to ./playlist.m3u \n", RESET; 1377 print YELLOW, "\rAdded $CurrentFile to ./playlist.m3u \n", RESET;
1377 return; 1378 return;