Linux

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

Have some content

Music: 

It seems like I really don't write very much, but that's kind of a massive misconception. I don't write "much", but I had a bunch of blog entries that were at least 60% written and were missing like, screenshots or links or tags or I need to make new tags for things like XScreensaver and BSDs. Haiku. Shit lots of stuff.

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

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

It's 1997 Again

Music: 

The Pixies - Dig For Fire

A few weeks ago a friend found some PC hardware by the side of the road and started putting it aside for me. He got one Packard Bell Pentium 120 system with a monitor and everything, and a white-box PC from the P4-era that I haven't fully ID'd yet. Neither had hard drives, so I got an IDE -> MicroSD adapter and today I fired up the Pentium 120.

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.

xrayspx's picture

Mister Multisystem, Finally

Music: 

I am not writing this as a "getting started" or beginners guide, though it might evolve to serve that for some people. It's just notes I'm taking for things I need to look up. I'm not going to do any in-depth technical review or anything, go watch a youtube video for that. My perspective is from a career as a sysadmin and Linux user. Your mileage will certainly vary.

I strongly encourage you to skip my un-edited drivel and just scroll to more listy looking part.

This past weekend we resolved to kicking off, tidying up and playing with the MiSTer Multsystem. The actual "Problem" with getting this project going was that everything was way too easy to get, which has been our luck every time we need any Raspberry Pi's and stuff. We anticipated about a 3-4 month minimum lead time to land all the parts, figure out how it all goes together and how to get software to it. Everything turned up within a week. We got the DE-10 direct from the Terasic and they shipped pretty much immediately. Same story with the MultiSystem pack. I've been extremely interested watching this project as Neil has announced updates and features. The box was well packed and safe even after a real kicking by the various shipping companies.

I think it sat on the Project shelf for a month before we even had time around the holidays to put it together and try it out. It was super easy to assemble. Note: I spent 3 or 4 years in a local computer store in the '90s, and a 25-mumble-year career in IT so your mileage may vary. Actually that's not fair. Natalie did pretty much all the assembly work with me just kind of putting the case together. I'm still paranoid that I over-tightened screws or something since I've never really worked much with 3d printed anything. The case is very nice, well laid out and, while tight, everything is easy to route and very well documented.

Goals vs Reality


The Plan: This guy should sit prominently in The Room, quite probably wood-grained and hooked up to the main TV. There it would host all the console games for all the consoles neither of us ever had, and so have no muscle memory or nostalgia for. You know, For Kids.

The Reality: I was familiar from well-afar of the Mister project for some time. I know why the ST is there, and given all our other projects, this does have the capacity of seriously amusing me. But I wasn't sure about the MiSTer's interface, it looked like it might be a lot less friendly than something like EmulationStation. And that's a thing I go into below.

The other day I temporarily yet elegantly installed the MiSTer in the arcade cabinet and gave it a quick smoke test to make sure it still did things. I took a few minutes to figure out what using the external drive that I just happened to have hanging around was about and the effect it had on the virtual filesystem browser stuff.


1 week later and we spent a couple of hours today playing a bit, loading more games and software, then playing a bit more. Natalie wanted to start getting things documented for the Manual to the Living Room we are slowly beginning to put together. As we went through computer platforms from Atari 8-bit, ST, Amiga Natalie was taking notes on how to load software on each and get back to the main menu and whatever but really aside from necessary differences in how the keyboards are mapped, everything's just the same. We've been playing with an X-Box 360 controller because it's the only controller we own and it just worked. The arcade controls are going to take a bit of effort but the sticks and the trackball work, I just need to map buttons, and from what I can see that's not very hard.

The Big, Ugly Truth

The reason I really liked the standard linux machine plus a slick launcher is because it looks nice on the arcade cabinet and people could navigate it pretty easy. You know what? There are no "people" and this thing is way more convenient to use than the Pi + RetroPie. No trying to keep the button layout relatively synced between a bunch of different MAME emulators. Make that "A bunch of different versions of a bunch of different emulators". Nothing was ever consistent beyond the necessary controls. But it does look cool.

Enter the MiSTer. Since we're not emulating, there's not really anything much to tweak. Everything can pretty much be set up globally aside from a few platform specific changes. Even with arcade cores the UI is so consistent and easy to deal with that I won't exactly be pining for RetroArch any time soon. I need to figure out how to set a default set of controls though so I don't have to set the controls up for every single arcade cabinet forever. I know there's a menu item for that I just haven't pulled the trigger on possibly screwing things up yet.

It's also extremely easy to keep updated with all the latest cores using the "update_all" script. I'm using the "RetroDriven" fork, though I'm not sure what materially differs from the main line version. It's just the one I saw first. That tool was a revelation since you can just have it go out and populate any missing arcade ROMs, as well as adding cores that haven't made it to the main-line MiSTer distribution yet.

Sound can be /amazingly/ better than MAME. I'm not familiar enough with any console game to know what it should sound like vs an emulator. But I played a couple of games to test out Donkey Kong and it took me 3 games to get past just how much better it sounded on exactly the same hardware. I think it's like emulating a Moog synth vs copying it electrically at the circuit level. It'll at least get you a lot closer to "actual hardware" than MAME possibly can. (Important Note: The 4th game of DK I got within 700 points of my personal best 62,500 score on the board, and it's not like I'm constantly playing that game, it's pretty rare for me to do that well that quickly. [I think it's really more like 85k but that was before we had the board so I can't remember])

Conclusions?

While it's true that there are some arcade games that aren't yet "there" on the MiSTer, which work fine on a Pi-3, the fact is that while a given arcade core might not be ready for showtime just yet, like OutRun. And obviously there are systems that are simply too complex for the DE10-nano to copy. There are options, and they're imperfect, but still fun. The Sega 32x core works just fine I guess for games like Virtua Racing, and the Saturn core seems to be coming along fast. However for me a lot of the real value of this system is going to come in running the computers of my youth. Since I always had computers, I never really had consoles aside from the 2600 so I've been playing with the Atari 8-bit and ST cores (and the Amiga, because, you know, let's be real...). I'm even going to set up some hard drive images and profiles for color vs high-res mono.

This will get us through in emulation until the Next Big Kickstarter shows up at my door and I can use the ST to all of its ability with my SpecreGCR cartridge, etc...

I think we're into the MiSTer Multisystem for somewhere in the region of $400-$450. That's kind of steep, however what you get is every game released for every console up to about the PS1 / Sega 32x and maybe Saturn-ish. Plus all the 8-bit and 16-bit computers of the '70s through the early '90s, and their entire libraries. Plus a couple hundred arcade games. All easily managed in a simple to use and easy to understand interface.

Definitely 100% worth a look, especially given what people will spend for those "throwback" mini-consoles with a fixed set of titles baked into some potted-blob SoC.



I'm going to move a lot of the above into sorted bullets. I'm throwing some stuff around and will organize it as I go.



  • The "Minimig" Amiga emulator seems to run /way/ too fast, and I can't see any setting to slow it down, all indications are that it should be running a 7.whatever Mhz 68000. But the ST one works great. I saw someone saying the music was too fast, but indicated the game play was accurate. I disagree, the whole thing feels too fast to use for games I have muscle memory for (Tower Toppler).


  • As noted above in detail, the sound is fantastic, it's not even close.


  • Video Weirdness. I'm positive this is down to some scaling setting. I'm trying to get screenshots but my Mac keyboard doesn't have either a printscreen key or an F13 key, so balls. To use DK as an example since it does show up prominently what I'm seeing is variable "width" of identical single-pixel vertical lines or dots. So for instance the ladders in DK. One side of the ladder might be narrower than the other. Usually I see "normal" and "skinny" ladders, but I think I saw a "fat" one or two. Similarly in Ms. PacMan, some dots render as skinny. Aspect ratios seem correct otherwise so that's why I'm thinking it's some setting somewhere maybe. I don't even care it's a trade-off I'm willing to make for all the other benefits for gameplay and manageability.



    Yep, that was it: There are video processing options and you can choose from a list of profiles to match what you're doing


  • I do wish I could figure out how to directly edit core configs from the command line. Everything I've found seems to either be an empty file or binary that I can't modify. I'm sure there's something I can do. I'd love to figure out how to set generalized defaults for all cores, and then the user can define anything custom. So one key layout that will generally work across the board and then per-core settings can override that. Those per-core files could be shared as well. An editable "SNES Core - MS XBOX 360 Controller.cfg" or whatever.


  • I'm struggling to correctly make a folder for favorites using symlinks with absolute paths
  • Pages

    Subscribe to RSS - Linux