685b6cdba166740bbfc21f91c0d1584d9056c53b
commit 685b6cdba166740bbfc21f91c0d1584d9056c53b
Author: spesk1 <spesk@pm.me>
Date: Wed Apr 27 15:34:44 2022 -0400

Initial commit

diff --git a/pl_gen.pl b/pl_gen.pl
new file mode 100755
index 0000000..d00cafd
--- /dev/null
+++ b/pl_gen.pl
@@ -0,0 +1,68 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+my $ROOT="/mnt/usb/spesktv";
+my $BUMPER_DIR="$ROOT/bumpers";
+my $VID_DIR="$ROOT/videos";
+my $PFILE="$ROOT/playlist.vlc";
+
+my $PLENGTH=20;
+
+my @video_paths = split("\n", `ls $VID_DIR/*.mp4`);
+my @bumper_paths = split("\n", `ls $BUMPER_DIR/*.mp4`);
+
+sub wr($$) {
+ my $path = shift;
+ my $line = shift;
+ open(my $fh, '>', $path) or die "Couldn't open $path";
+ print $fh $line;
+ close($fh);
+}
+
+sub apd($$) {
+ my $path = shift;
+ my $line = shift;
+ open(my $fh, '>>', $path) or die "Couldn't open $path";
+ print $fh $line;
+ close($fh);
+}
+
+sub rnd_vid_path {
+ my $path =$video_paths[ rand @video_paths ];
+ $path = $path . "\n";
+ return $path;
+}
+
+sub rnd_bmp_path() {
+ my $path = $bumper_paths[ rand @bumper_paths ];
+ $path = $path . "\n";
+ return $path;
+}
+
+
+sub gen_pl() {
+
+ wr($PFILE,"");
+ apd($PFILE,rnd_bmp_path());
+ foreach my $i ( 1..$PLENGTH ) {
+ if ( $i % 2 == 0 ) {
+ apd($PFILE,rnd_bmp_path());
+ }
+ apd($PFILE,rnd_vid_path());
+ }
+ apd($PFILE,$PFILE . "\n");
+}
+
+while () {
+
+ my $date = `date`;
+ chomp $date;
+ print("$date\n");
+ print("Generating playlist...\n");
+ gen_pl();
+ print("Sleeping for 1hr minutes...\n");
+ sleep 3600;
+
+}
diff --git a/start_vlc.sh b/start_vlc.sh
new file mode 100755
index 0000000..ea0339f
--- /dev/null
+++ b/start_vlc.sh
@@ -0,0 +1 @@
+vlc -I dummy --control dbus playlist.vlc --loop --sout-keep --sout '#standard{access=http,mux=ts,dst=10.0.0.253:21225}'