Hacks

xrayspx's picture

The Proper Way To Watch Television

Music: 

Tom Waits - Such a Scream

I've been threatening for quite some time to post my TV playlist workflow. I'll put up my music video builders as well just because for some reason they're different.

TL;DR: Here's the primary TV script.

Warning

This was banged out over a few nights of non-sober hacking. It's not "good", but it's "good enough" until I can dig in and fix all the inconsistencies. You can get the idea.

The Executive Summary

I believe the correct way to watch TV is to throw the TV on, pick a "channel" and not have to think too super hard about what you want to see beyond choosing where to start watching. With Netflix and Amazon and stuff you're paying some number of dollars per month for access to content, but the way they present it is that you have to find a thing you want to see, then dig into that and play an episode of a TV show. This is let's say inefficient for anything other than single-show binging. Which is why single-show binging got huge when everyone dropped cable for Netflix and Amazon. When you have 400 or 500 TV series to choose from, do you really want to dig into "Season 6, Episode 12" of Cheers, and then choose to hit "Season 5, Episode 9" of King of the Hill, or would you rather hit "Sitcoms" and let the computer do the work?

The Methodology

I prefer the TNT method of "you throw on TNT and now you're watching a block of Friends" or you put on Nick at Nite and you might get Mary Tyler Moore followed by Speed Racer and a Drew Carey Show. So that's what I've built.

I have full runs of many many TV shows, I build daily playlists, around 120 at the moment, for various Genres, as well as several dozen shows to run as "blocks". I mix in commercials, though I need lots more commercials and I need to tailor them a little better so I'm not getting Underoos ads between episodes of The Wire.

So the menus are sort of:

  • TV Shows
    • Blocks - Individual 50 episode playlists for ~100 series or so. So we're watching a block of Star Trek, or Seinfeld or whatever.
    • BritBox - Comedies, Cozy Mysteries and Doctor Who, pretty much
    • Sitcoms
    • Nick at Nite - All stuff from Nick at Nite, TV Land etc
    • Buddies - Buddy Cop / Detective type shows. Cagney & Lacey, Columbo, Barnaby Jones, Starsky and Hutch, Burn Notice, all that stuff.
    • Saturday Morning Cartoons
    • Superheroes - The Live Action shows mainly from the 70s. Hulk, Wonder Woman, Six Million Dollar Man, Bionic Woman, that sort of thing.
    • Variety Shows - Laugh In, Kids in the Hall, SNL, blah blah blah, SCTV...
  • MTV
    • 120 Minutes
    • Yo! MTV Raps
    • Arcade / Pizzaria - This is like the ubiquitous music from my youth pretty much
    • I create playlists of specific lengths because media players really don't deal too well with massive playlists. Though Kodi does better than most. My "MTV" playlist is around 12000 songs if I just let it rip and Kodi handles it just fine. But the main reason for creating playlists and not just say, go into a folder and hit "Shuffle" is that I get to choose my entry point and find a run of TV shows that I want to watch, or skip the first few music videos to start with something "good".

      The Workflow

      These playlists are the simplest possible .m3u files. Just basically lists of absoluterelative paths to individual files with no metadata or context. This requires all the files to be named appropriately such that they're all uniform and informative. "Show Name -SeasonEpisode - Episode Name".ext.

      The Simpsons - S03E07 - Treehouse of Horror II.avi

      Kodi does not automatically add metadata for .m3u playlists in the way Jellyfin/Emby does for theirs. It's on my to-do list to scrape the series name and episode title from Kodi's database and add it in before inserting the file path.

      To create these M3Us I have a few cron jobs on my home server, the steps are pretty simple:

    • Build a master filelist of my TV Shows directory.
    • For each genre + blocks, scan the filelist for shows listed in my /cfg/$playlist.txt file
    • Scan against a master "exclusions" list so I don't include like .nfo files, subtitles, text files, ISOs, "dvd extras" etc.
    • Insert commercials according to a cfg file for each playlist. (Number of episodes before a commercial break, number of commercials per break)

      To build the playlist itself, I scrape all this into an array and randomize it:

      vids=()
      sed "s/^/\/Volumes\/Filestore\/Common\/TV Shows\//" $cfgdir/$vfil.txt > $cfgdir/$vfil.txt.bob
      mapfile -t vids

      That works out to, using Nick at Nite as our example:

    • Create the vids array as an empty set
    • Strip the base filesystem path from all ....../cfg/nickatnite.txt and create nickatnite.txt.bob. This doesn't make sense to me as "nickatnite.txt" doesn't have all that path info anyway.
    • Populate the "vids" array by grepping for all the shows in nickatnite.txt.bob within the overall file list. Remove anything in the global exclusion list, then do a random sort on all that and shove it into "vids". I suppose I could limit this to only the top 50 or however many files right here....

      From there I just iterate through the vids() array in increments of however many shows between commercials. Then I insert the commercials from a similarly populated array and resume iterating through episodes until I hit the total number of episodes I want.

      I do testing to see if a show is part 1 of 2, or part 2 of 2. If so it will grab the other part and place it appropriately in the playlist so you're not stuck with a single episode and have to dig for the other one like some kind of animal. Currently I only handle those two cases for two reasons. Empirically there aren't that many things with more than 2 parts in the entire corpus of Shit I Own. Those that are tend to be things like Rocky & Bullwinkle which stretch out a story arc over half a season, or vintage Doctor Who. Rocky & Bullwinkle really doesn't matter, you get the jist. If I really care about watching a whole arc in a 50 year old Doctor Who, I'll just go watch it. It's not like I can't browse for files. But I don't need 5 hours of shows popping up in the middle of my list.

      I just don't want to have to dig for Time's Arrow part 1 just because Part 2 was fed into the SciFi playlist. I'm usually watching TV as I go to sleep so two hours is plenty.

      Fun fact, I don't count these episodes in the total, so you end up with like a few extra episodes in the playlist if there are multipart ones. Also, if the file I pull is Part 1 of 2, then Part 2 goes in at the end of the bus. So you'll get "part 1", "Some other show", "part 2". Again, on my Todo.

      Anticipating some Qs:

      • "Why don't you just"
        • Use "shuffle mode"?
        • Really good question. I'm being polite and I really shouldn't be. Anyway because with Shuffle Mode on a folder of TV shows, I don't get to choose my entry point. I can't for instance skip the first 12 episodes and enter at one I haven't seen in a while.

        • Use Kodi or Jellyfin's playlists?
        • One, because this is 100% automated with new playlists every day and I never have to think about it. And it's platform agnostic. I can pull an M3U into VLC or whatever and play it there. I'm not naive enough to believe that Kodi or Jellyfin or whatever is going to be around in 20 years. You know what will be around? Something that can play a bog standard M3U on my TV.

      • Ew absolute paths
      • There are reasons for this. One time I owned a Mac. By default that Mac put CIFS mounts into /Volumes/ along with other mounted filesystems. I haven't used a Mac in like a decade, but I standardized on that, and now every machine I have uses the /Volumes/... paradigm for our main file storage.. This can get awkward when I use something like a phone or an Amazon Fire Stick. All of this can be switched at a moment's notice to relative paths from wherever the playlist file is though no problem.

        Also I am now generating both so I can "upgrade" to a Flatpak Kodi since their apt repo isn't going to work anymore.

      • Ew bash
      • Get bent. I'm not a developer, clearly, but I know how to get pretty much anything I want to get done, done. Bash doesn't make a habit of introducing breaking changes and it works every goddamn where.

xrayspx's picture

Linux Serial Console

Music: 

Portishead - All Mine

Ok this is just a neat toy and something I never needed to care about, and probably will never use.

I have a 16 port Avocent serial console that lets me log into all my network hardware and watch it boot if there are any issues and you can't connect to them over the network. This is all pretty standard Network Guy nerd nonsense. It's what you do in a datacenter. Being a network guy, and one who de-commissions lots of stuff, I basically run my house like a datacenter now as well. This is especially useful since I've been working from home the last five years. I have very little downtime.

My main workstation has a physical 9-pin serial port so I figured it'd be neat have it start getty at boot so I can use a serial console and bounce to it through the Avocent. And so I set off about trying to figure out the pinout for a serial to RJ-45 Avocent cable . But what didn't really click until I read thread while I was on my search is that you can have Grub start that getty and get full access beginning at the bootloader. This makes this actually useful. If there is some problem, and I'm either not here, or the problem includes "there's no video from my machine", I can view the serial console, log in if the machine is up, reboot it and watch the startup sequence to see where it's failing. The Grub boot menu actually shows up on the serial console /before/ my monitor displays it.

On all my production server hardware we have iLO anyway, so like, what did I care about watching those servers over serial anyway? Actually from what I understand my servers will output over serial right from the BIOS so you can watch the machines post and such before they even reach the bootloader. I doubt my Asus motherboard will do that, but I'll definitely dig around in there for a while.

Anyway, while I did find enough information to make the cable, I re-documented it so the next person might find the guide I wish I had. Since some people are more "visual" I've included both a basic text "RJ45 pin 1 -> DE-9 Pin 8" and a color coded diagram. I started by testing continuity inside the connector and noting which colors aligned to which RJ45 pins, then made before and after diagrams. The 9 pin connector is "as seen from the back (inside) of the connector" where the solder points are. Most of these have labels on the pins both on the inside and outside, they're just hard to see:

Here's a PDF of that if you want to zoom in, apparently the original draw.io file is embedded in there too.

Most pins are pretty straight forward swapping a wire from one pin to another, but pin 4 on the serial connector has two wires going to it, so I just twisted them together and soldered them both in. Pins 1 and 6 on the Serial connector also need to connect to the same RJ-45 wire. So I soldered the main wire to Pin 1 and used some very fine bodge wire to connect Pin1 to Pin 6. So far so good.

I took some photos, but they're pretty blurry and I'm not ripping this thing back apart since I don't want to break anything. Honestly the diagrams above do a better job of conveying it.

To get Grub to launch getty and start listening, the relevant part of the SuperUser.com thread, and the even more dense Arch documentation they linked to was:

vi /etc/default/grub

GRUB_TERMINAL="console serial"
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"

grub-mkconfig -o /boot/grub/grub.cfg

Here it is all working in a video recorded on my bench machine:

The Avocent is the top thing in (not on, in) the rack here, the yellow network cable is going to my workstation:

xrayspx's picture

DVD Ripper

Download the dvdrip bash script

This is the correct way (for me) to rip hundreds of DVDs. I still wish there was a global hash table of discs whereby we could automatically name individual files, but this does the job and I'll describe my overall workflow. Ripping TV shows is stupidly time consuming compared to audio CDs and I've done everything I can to reduce the time wastery involved. It's not perfect, but I can just feed disks through my machine all day then take an hour or so a week and rename everything I've done.

xrayspx's picture

Quick Music Video Fact

Music: 

MTV From 1992

Or: The shit I put up with for good TV in this house.

I had two conversations today about how I basically optimize statistical analysis and data reconfiguration...blah blah. Each conversation just wound up with me wanting to tell the same story so I though I should write it down.

Some time ago I made a colossal mistake. I have a lot of music videos.. Like a lot a lot, to me anyway. And there's organization and logic to it to build different playlists and whatever.

xrayspx's picture

Juggling Evidence

Music: 

If you know you know

Because my mom didn't think I knew how to juggle.

Here.

Fixed Tags:
xrayspx's picture

Cinnamon Needs To Get Their Shit Together

Music: 

Eddy Grant - Electric Avenue

I'm a KDE user. I like having my ultimate control over look & feel, even though in almost every sense I'm a "leave it default" guy. But I have a nice MacOS-ey theme, handily and easily-ish customized for the proper Green on Black color scheme which is one of 1.25 acceptable palettes (amber on black):

PICTURE

Note things like the Strawberry media player window and the Dolphin windows, these will be important at probably some future date.

xrayspx's picture

That 120 Minutes Playlist

Music: 

I've just been directed toward a YouTube playlist that apparently made the rounds last August claiming to have "Every Video Played on 120 Minutes".  Well no.  Not really.  The claim is "2506 Videos".  Reality is...less.

 

I grabbed the playlist and threw it into my nightly randomizing grinder.  I already have a "120 Minutes" playlist, in which I just cram every video from every band who was ever on 120 Minutes in there.  Since it all "spiritually" counts.  I put stuff that "should" be in there too because what other slot would have played Humanwine I guess?

xrayspx's picture

NoMachine NX Key Based Auth

Music: 

This will likely be updated.

I saw a request for some help in setting up key-based auth in NoMachine NX tonight just as I was going to bed and decided to do that instead.  I believe the request is for Mac-to-Mac, but for the moment I'm doing bi-directional Linux-to-Mac and Mac-to-Linux.  If I make any changes at all in how I set the Mac side up vs the Linux side I'll note them of course.

So here is the basic Linux client to Mac server.  In testing I set this up Linux-to-Linux.  The commands I used were exactly the same on the Linux and Mac servers.

Tags:
xrayspx's picture

Two Step Remote Assistance Tool

Music: 

My mom has a Mac, and occasionally something will fuck up in a way that is best fixed by me having some control over her machine.  I had one of those cases last week and it was embarrassing that there was no good way for me to get remote access.  Google Meet doesn't cut it, but there's a whole other Chrome Remote Desktop app, but that was a lot of hoops to install and gave up any hope of walking my mother through the install process.

xrayspx's picture

Daily Driving Haiku

Music: 

I've been testing Haiku OS pretty regularly as they'd release a new beta, but I hadn't ever really given it a fair shake. I saw it simply as a way to make old computers run somewhat modern software and load a wikipedia page or something. But with the release of Beta 4 I decided to give it a real chance and installed on an i7 laptop with 16GB of memory. Pretty much the same as my main Linux laptop.

Pages

Subscribe to RSS - Hacks