Display Channel & Date\Time Recorded

Like most users, I use an outside antennae to record shows. I sometimes see scatter on the screen where I need to adjust the antennae. I don’t keep up which show is on what network so to decide where I need to adjust the antennae I have to look the information up on my PC and make the antennae adjustment. Have the channel listed right on the screen that displays information about the show is extremely helpful.

However, there is more needed. So, adjusting the antennae is an art not science and it typically occurs across multiple days to get it just right. Therein, is where it is helpful to show the date\time the show was recorded. So, 2 days later I can now determine the show recorded on date\time X is much better than the show on date\time Y. Having that data gives me full insight as to which adjustments I made when and which direction works best.

Thanks

You can find the date and time of a recording using information already present on the server.

If you hover over an episode or movie poster and select the vertical ellipsis in the lower-right, you can select “Get Info,” For a recorded item, the Unix epoch timestamp of the recording’s start time is available in the field “Media Grab Begins At.”

You can plug that into a site such as this one to convert it to a human readable date and time.

Or, if you’re comfortable on the command-line for your operating system of choice, you can find the information by running…

On macOS: date -r <timestamp>
On Linux: date -d @<timestamp>
On Windows (PowerShell): See this link.

There are also ways to find the channel a show was recorded from by querying the Plex database. The information is in the media_grabs table in the extra_data column. So if you recorded The Simpsons at the timestamp 1732496400, you could use something like the following (once you’ve opened the database):
SELECT extra_data FROM media_grabs WHERE extra_data LIKE '%1732496400%' and extra_data LIKE '%The Simpsons%';

The extra_data column just contains one long string of JSON-formatted data about the item; the channel information is in a field named “channelTitle” in that string.

You could pass the output through a JSON processor like jq to pull just the channel information from extra_data.

"/Applications/Plex Media Server.app/Contents/MacOS/Plex SQLite" ~/Library/Application\ Support/Plex\ Media\ Server/Plug-in\ Support/Databases/com.plexapp.plugins.library.db "select extra_data from media_grabs where extra_data like '%1732496400%' and extra_data like '%$TheSimpsons%';" | jq '.["me:channelTitle"]'

This is from my Mac, but you could do something similar from a Linux or Windows system (provided you have jq available).

Wow, such level of expertise in the detail and capabilities of how to extract such content? However, that is above my capabilities and seems to be a lot of effort to just get to 2 values - Channel and Date\Time stamp of recording.

Can Plex not simply add these 2 values to the screen you shared to make it simpler to the common users?

I really appreciate your reply. I will save it and use it in cases where I am get up against the wall until Plex can make a simple upgrade to that screen.

I don’t doubt that they can but I’m not sure that they will. In the event that they do not…

Here’s a small Python script which outputs recording information (show name, channel, and start time) for all the items in the ‘media_grabs’ table.

import sys
import sqlite3
import json
from datetime import datetime

def unix_to_datetime(epoch_time):
    offset = datetime.fromtimestamp(int(epoch_time)) - datetime.utcfromtimestamp(int(epoch_time))
    rec_time = datetime.utcfromtimestamp(int(epoch_time)) + offset
    return rec_time.strftime('%Y-%m-%d %H:%M:%S')   

db_path = sys.argv[1]

print(f"Listing recording information from {db_path}\n")

conn = sqlite3.connect(db_path)
cursor = conn.cursor()

cursor.execute("SELECT extra_data FROM media_grabs")

for row in cursor.fetchall():
    extra_data = row[0]
    
    try:
        data = json.loads(extra_data)
        
        show_title = data.get("mt:grandparentTitle", None)
        if show_title is None:
            show_title = data.get("mt:title", "N/A")
        
        channel = data.get("me:channelTitle", "N/A")
        
        begins_at = data.get("me:beginsAt", None)
        
        if begins_at is not None:
            begins_at = unix_to_datetime(begins_at)
        else:
            begins_at = "N/A"
        
        print(f"Recording: {show_title}")
        print(f"Channel: {channel}")
        print(f"Start Time: {begins_at}")
        print('-' * 40)
        
    except json.JSONDecodeError:
        print(f"Error decoding JSON for row: {row}")
    except Exception as e:
        print(f"An error occurred: {e}")

conn.close()

You can save it to a file named “recording_info.py” (or any name you like, really) and then run it like: python3 recording_info.py "<path to your database file>"

The path to your database file should be quoted; for example, on Linux it would be something like:
python3 recording_info.py "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db"

It needs Python 3; you can run python --version or python3 --version to see what you have. It should work on pretty much any platform but I only tested it on macOS and Linux.

Full disclosure: This about 50/50 ChatGPT and me.