Jump to content

Guide To Cutting The Cord With Emby/UnRAID Interactive Programming


HouseOfCards

Recommended Posts

HouseOfCards

Hello all,

With a great deal of help from various online communities including this one, I have been working to create an "interactive" media channel out of my Emby Server.  The idea behind this is to create a curated experience more like a paid streaming service, but using your own content and own scheduling preferences.  I wanted to share my setup in case this would give others ideas for their own circumstances.

Some of the possibilities of this setup include.

1. Adding Christmas content in December, rather than having it in your face year round.

2. Adding batches of campy horror movies around Halloween.

3. Adding documentaries around the date the event occurred.

4. Adding featured content for special circumstances like "Black History Month". 

 

REQUIREMENTS
========================================================================================

To do this, I have all my content on an UnRAID server.  I suppose you could adapt this to other NAS platforms, but this guide is specific to UnRAID.

The first item to check off is to create two shares for each type of content.  One share will contain everything, and the other share will contain just what Emby is hosting at the moment.  For example, you need an "All Movies" and an "All Television" share which you put every Movie and TV Show you have.  You also would create an "Emby Movies" and an "Emby Television" share for your server to read from.  This creates a place for all your content to live and be edited, and another set of locations for your Emby server to pull content from.  

TIP: Depending upon your UnRAID configuration, I keep the shares Emby reads from on a single hard disk.  You can keep the other "everything" shares wherever you like, but having Emby read from only one disk means that only one drive needs to spin up to watch content.  This can save some wear/tear, and reduce power consumption and your electric bill.

Using different ports, you can use two Docker containers to have two Emby servers if you desire.  This is what I have done.  I point a "maintenance" server to the location for everything.  This allows me to edit metadata and images for everything to be just the way I want.  I utilize the options to save metadata to NFO files, and the option to save artwork in media folders.  This way, I can use specific artwork and customized metadata if I like.

I also create a "production" Emby server.  This is the one the family uses, and contains only the content you move in and out of it.  Because you have saved customized artwork and saved metadata to NFO files on the "maintenance" server, you don't need to tweak anything once it copies in.  The media in the "production" server is transitional.  Any changes made will be lost next time the content shuffles in/out anyway.

Obviously, you need to create the Emby servers, and I assume you know how to setup Docker containers on your platform.  This guide is not for specific setup instructions in all the possible scenarios.  This is an overview to tweak for your own situation, so let's continue...

At this point, you should have two Emby servers setup.  One hosting all your content, and one for the interactive content with nothing in it.  Let's fix that.

 

INTERACTIVE CONTENT
=============================================================================================

In UnRAID, there is a nifty little plugin called "User Scripts".  Install it.

Using this script functionality, we can make little snippets to copy and remove content from our servers.  THIS IS TEDIOUS, AND WILL BE DONE OVER TIME AS YOU DECIDE WHEN TO ADD/REMOVE THINGS.  The more granular you decide to add/remove (one movie vs. batches), the more tedious it will be.  The good news is that once you schedule a movie or show, it happens automatically for the rest of time.  

IMPORTANT: Once you begin writing these scripts, it's important to back up your boot media (should be doing this anyhow) because the scripts are stored there, and you wouldn't want to have to write them all over again.

What makes the most sense to me is to do most movies independently (with exceptions for batches like Christmas), and TV Shows in "Seasons".  So how do we write that?  

First is to decide on naming for the scripts so you can find things in a long list.

"Add Collection: Christmas Movies"
"Add Movie: Deepwater Horizon (2016)"
"Add Television: Rick And Morty (2013) S01"
"Remove Collection: Christmas Movies"
"Remove Movie: Deepwater Horizon (2016)"
"Remove Television: Rick And Morty (2013) S01"

Then, edit the scripts BEING SURE TO CHANGE THE PATHS SPECIFIC TO YOU.

"Add Collection: Christmas Movies"

cp -R /mnt/user/"All Movies"/"A Christmas Story (1983)" /mnt/user/"Emby Movies"
cp -R /mnt/user/"All Movies"/"Frosty The Snowman (1969)" /mnt/user/"Emby Movies"
cp -R /mnt/user/"All Movies"/"Yogi's First Christmas (1980)" /mnt/user/"Emby Movies"

"Add Movie: Deepwater Horizon (2016)"

cp -R /mnt/user/"All Movies"/"Deepwater Horizon (2016)" /mnt/user/"Emby Movies"

"Add Television: Rick And Morty (2013) S01"

mkdir -p /mnt/user/"Emby Television"/"Rick And Morty (2013)"
cp /mnt/user/"All Television"/"Rick And Morty (2013)"/* /mnt/user/"Emby Television"/"Rick And Morty (2013)"/
cp -R /mnt/user/"All Television"/"Rick And Morty (2013)"/"Season 01" /mnt/user/"Emby Television"/"Rick And Morty (2013)"

IMPORTANT: BEFORE REMOVING, ENSURE YOUR PATH IS REMOVING CONTENT ONLY FROM THE "EMBY MOVIE/TELEVISION" LOCATION, AND NOT YOUR "ALL MEDIA" LOCATIONS.  OTHERWISE YOU WILL DELETE YOUR PERMANENT COLLECTION MATERIAL.

"Remove Collection: Christmas Movies"

rm -R /mnt/user/"Emby Movies"/"A Christmas Story (1983)"/
rm -R /mnt/user/"Emby Movies"/"Frosty The Snowman (1969)"/
rm -R /mnt/user/"Emby Movies"/"Yogi's First Christmas (1980)"/

"Remove Movie: Deepwater Horizon (2016)"

rm -R /mnt/user/"Emby Movies"/"Deepwater Horizon (2016)"/

"Remove Television: Rick And Morty (2013) S01"

rm -R /mnt/user/"Emby Television"/"Rick And Morty (2013)"/"Season 01"/
rm -R /mnt/user/"Emby Television"/"Rick And Morty (2013)"/

So yes, this can be tedious and annoying.  The good thing is that you can do this with everything, or just selected content like Christmas Movies.  How involved you get is totally up to you.  You can choose to have a permanent collection always on the main server, and just rotate in more obscure content periodically, etc...   This is the framework, not the only option...


MINI-SERIES VARIABLE
=================================================================================================

I chose one additional share to create for my "production" server, and that is to separate out "Television" from "Television Series".  The reason is simple...

My goal is to have an ever-changing television station without commercials to replace a paid TV service which is way too expensive nowadays.  I want to be able to go into the Television library, hit shuffle, and always have some varying content play.  This month you might see Roseanne, next month you might replace that with Married With Children...  In the nice weather, maybe some Love Boat...  Ever changing.  But what about things that are meant to be binge-watched, or watched in order?  The Walking Dead, Chernobyl, The Sopranos...?  It wouldn't make sense to have the third episode of Chernobyl play at random.  That series is 5 episodes and meant to be watched in order.  This is where "Series" comes in...

Anything mini-series or binge-worthy like Roots or The Sopranos gets added, and stays much longer.  I might throw the sopranos in, and leave it for six months.  After that, replace it with a different series.  This way, when it shows up, you have adequate time to watch it.  Every April, Chernobyl will pop in for say two months, because that's the time of year for the anniversary of the incident.  It doesn't need too long because it's only 5 episodes.  A Walking Dead type addition might get 4/6 months... whatever.

So in Emby, you'll have two categories.  "Television" and "Mini-Series" or some other names you prefer.  Just remember to change the paths in the scripts when copying/deleting...


SCHEDULING
================================================================================================

The User Scripts plugin has a field for your scripts, allowing you to determine when to schedule the script to run.  The easiest way to figure that out is to use a CRON tool on the web to format the entry.  Like this one...

https://crontab.guru/

 

THE CHALLENGES (DATE ADDED)
================================================================================================

The first challenge I ran into was the "date added" entry in the NFO file.  One of the primary purposes of this process is to have the "production" server always show content as "recently added".  When the server with all content initially writes the NFO it adds the date added as a permanent fixture.  This isn't what you want, as it prevents the newly copied content from showing above all the existing items still on your server.  To get around this, I went around with some nice folks at a Unix forum here...

https://community.unix.com/t/batch-remove-line-from-files-recursively/390725/1

In short, I use the User Script plugin to run the following command once a month.  This removes the "date added" line from every NFO file recursively, in every subdirectory below where you point it.  Then, when copied to your "production" server, it uses its own date added stamp.

find /mnt/user/'All Movies' -name '*.nfo' -type f -exec sed -i "/<dateadded>/d" {} +
find /mnt/user/'All Television' -name '*.nfo' -type f -exec sed -i "/<dateadded>/d" {} +

 

THE CHALLENGES (FRIDAY THE 13TH)
================================================================================================

I haven't figured this one out.  CRON doesn't seem to have a way to execute on a day/date combination like this.  You can run every Friday...  You can run every 13th...  But not every time the 13th IS a Friday.  

Any workarounds for this would be appreciated.

 

SUMMARY
==============================================================================================

Hopefully, this helps more of you "cut the cord".  The more content you have available, and the more interactive and dynamic it feels, the less you feel as though you're "missing television".  This approach, with a few free streaming services for other stuff/news is working well for me so far.  If any other hiccups along the way appear, I'll update the guide.  If anyone has any ideas for improvement, please share.  If guru's like @Lukesee any issues, let me know.

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

  • 2 weeks later...
HouseOfCards

I have a couple related questions for @Lukeand the other developers.

1.  How does Emby manage play history?  Specifically, if I play a title, then remove the title from the system, will it show played when it's added back some time later, or does it delete play history when removing an item from the database?

2.  A similar question for the artist metadata.  Does Emby remove the actor information when all content in which they appear is removed?  I'm wondering because in the scenario I outlined, if I customize metadata for the actors there is no way to save those customizations outside the Emby database.  This means if I delete the only movie they're in, and Emby removes the actor, the customizations are lost... so I'm just wondering.

3.  How long before 4.8 is released?  Just kidding, I know that answer is wishful thinking.  LOL

Thanks for any insight you have...

Link to comment
Share on other sites

visproduction
1 hour ago, HouseOfCards said:

1.  How does Emby manage play history?  Specifically, if I play a title, then remove the title from the system, will it show played when it's added back some time later, or does it delete play history when removing an item from the database?

After media playback Emby-Server/programdata/data/library.db and library.db-wal are updated.
Both files appear to be SQLite files with binary characters.

Is there a plug-in that can selectively manage play history?

Does deleted file playback data get ignored, once the file is deleted, even when the delete happens from a command line / script?   
When the same file is added again, at a later date, would this file just be considered a brand new media file and any old playback history does not show as previously played or "Since you watched this" areas?

I have not tested this.  I would guess reloading media should give it a new dbase row and new ID, so it probably does not pick up any old playback data.  Does anyone know which way this works?

Edited by visproduction
Link to comment
Share on other sites

rbjtech
1 hour ago, HouseOfCards said:

1.  How does Emby manage play history?  Specifically, if I play a title, then remove the title from the system, will it show played when it's added back some time later, or does it delete play history when removing an item from the database?

If the item has a valid Provider id (from the likes of imdb, thetvdb, tmdb..) then it will be 'remembered' via this value.

Thus if you delete the file, and then restore it later - it will keep the user played 'history' as it's tied to this value, not the unique ItemId.

If you want to see the full history of what's been played by each user - then the 'Playback Reporting' Plugin will keep this for you (in it's own database).  It is a very powerful and impressive plugin - and tbh, should be included with Emby when it's installed ..

Edited by rbjtech
  • Thanks 2
Link to comment
Share on other sites

rbjtech
1 hour ago, HouseOfCards said:

2.  A similar question for the artist metadata.  Does Emby remove the actor information when all content in which they appear is removed?  I'm wondering because in the scenario I outlined, if I customize metadata for the actors there is no way to save those customizations outside the Emby database.  This means if I delete the only movie they're in, and Emby removes the actor, the customizations are lost... so I'm just wondering.

Use NFO files saved with the media (set emby to read AND write) - these will save any customisations outside of emby - making them portable for emby to 're-use' at a later date (or others Apps to use or modify such as TMM/KODI etc ) ...

  • Agree 1
Link to comment
Share on other sites

HouseOfCards
1 hour ago, rbjtech said:

Use NFO files saved with the media (set emby to read AND write) - these will save any customisations outside of emby - making them portable for emby to 're-use' at a later date (or others Apps to use or modify such as TMM/KODI etc ) ...

This is what my setup does, but this question is specific to actor information.  The NFO will write and read the actors appearing in the movie, but I'm referring to the data Emby downloads about the actors, and if you customize that, or choose a different actor photo, etc... 

A lot of this is "try it and see", but there may be a delay I am unaware of.  For example, I delete the only movie that actor is in, maybe Emby waits 30, 60, 90 days to delete it once the actor information becomes irrelevant or stale.  If so, I can add it back tomorrow and see, but it might not be accurate.

Link to comment
Share on other sites

HouseOfCards
1 hour ago, visproduction said:

Is there a plug-in that can selectively manage play history?

That would be interesting.  I DO have the Playback History plug-in installed and is what I use mostly.  For this, my best case would be if the playback history for removed items deleted after a period of time, so it would appear "unplayed" again when it gets re-added a year later...

And in a perfect world the customized actor information would remain in the database permanently, but be editable through the metadata manager if you wanted to remove something specific.

  • Thanks 1
Link to comment
Share on other sites

AvengersFan

Following on from this, I have removed old movies and TV series over 2 or more years ago. I recently added them back into my NAS to re-watch, and they all showed up as played. Now that in itself is easy enough to fix by going into EMBY and marking them as unwatched.

I'm sure the size of my database is negligible compared to the size of my media library, but I would have so many entries in there that are no longer on my NAS. So I was wondering if there a way to clean the data base periodically on my choosing, and somehow remove played items that are no longer in the library/NAS media storage location? (I used to run the scan media library task, mistakenly thinking this removed any references to missing movies/TV series. I understand now that this is not its function.)

When doing a "Attempt to optimise the database on server shutdowns" what is the maximum "Analysis row limit" I can put in?

Cheers Mark

 

Link to comment
Share on other sites

HouseOfCards
39 minutes ago, AvengersFan said:

Following on from this, I have removed old movies and TV series over 2 or more years ago. I recently added them back into my NAS to re-watch, and they all showed up as played. Now that in itself is easy enough to fix by going into EMBY and marking them as unwatched.

Exactly...  From my point of view, I'm not entirely offended by something showing as previously watched when it shuffles out/in over time.  My biggest concern is that is shows back up as recently added, which the script above should fix.  It would be nice if there were a plugin, or better way to manage play history though.  Music for example, can't even be marked as unplayed from within the interface.  It's not relative to this scenario, but once you play a song, it's played forever.

These are all small gripes with workarounds.  I just wanted to share this for people who may want to curate their own "Netflix"-style channel for their family.  It's more work than many people will undertake, but some of us get pretty anal with our media.  If you're one of them, this setup is for you.  For most people, this will be better suited to just handle their Christmas movies so they aren't in the library year-round.  That's fine too.

Whatever works best, and to each their own.

Link to comment
Share on other sites

HouseOfCards
6 hours ago, crusher11 said:

I cannot fathom wanting Emby to not have all my media on it.

LOL.  This definitely isn't for everyone, I admit.

To be fair though, what I outlined above, has two servers available from the "switch server" options.  In my case, one named after the local video store from when they were a thing in every town... and another named "Blockbuster" for the impersonal monster that helped kill those off.  My local video store server is more personal and curated.  It's aimed at the casual family member who doesn't know what media we have, and would benefit from an every rotating library of content pointing out what they can watch...

And then there is "Blockbuster".  If you can't find it in your local store, go over there.  They're big and impersonal, but they have everything.  You'll just have to find it yourself.

See, in my case (and I'm sure many of our cases) *we* know exactly what media we have.  Most of the people we share that media with don't.  I share the local video store, which I curate for them.  And even if they don't see them all the time, they know that there is huge library somewhere constantly feeding them things to watch.  It's ever-changing and personalized for the things that matter to them.  Maybe your aunt & uncle see their favorite movie appear right around their anniversary?  Let's see Netflix do that?  LOL

Have a great day...

  • Like 1
Link to comment
Share on other sites

AvengersFan
12 hours ago, crusher11 said:

I cannot fathom wanting Emby to not have all my media on it.

Its only a space issue for me mate, and I sometimes do a cleanup and remove stuff I haven't watched in a while. Then I get on a retro show phase, and for example I have readded Hereos from 2006 and I'm loving it! I think it holds up very well after all these years in my humble opinion lol. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...