Jump to content

Auto Generate TV Crossover Episodes from local input file


rbjtech

Recommended Posts

rbjtech

So up until this point I've been manually hacking together 'Crossover' episodes using 'Specials' - a very manually intensive and frankly laborious task.  I soon realised that this is not only wasting my time, but nothing was consistent and I would lose the lot during a database rebuild or metadata refresh etc.

So I thought i'd put together a script to automate this to make it -

  1. Repeatable
  2. Consistent
  3. Accurate

What does it do ?

  1. Creates a .strm (link) file in the 'Specials/Season 0' folder - linking to the real media file.
  2. Copies the associated jpg file
  3. Creates a relevant nfo file - used for naming and placing the 'Special'. 

It does this for each member of the crossover and for all combinations.

So in a simple 2 way crossover, it will create 1 'crossover' per show (2 crossover links created).  You can have a maximum of 5 crossover events -  so in this extreme example, each show would have an extra 4 'Specials/Crossovers' per normal episode (20 crossover links created).

The reason for doing this is so it doesn't matter which show you are watching, you will always see ALL members of the crossover.

So taking an example - Arrowverse Invasion !  (a 3 way crossover)

The first part of the crossover is 'the Flash' so that appears as it would do normally ... (episode 8 ) ..

 flash.thumb.PNG.f03c03f002e5c845263e0f7cbb89f95f.PNG

.. the script has inserted the two 'crossover' episodes after ep8 - they are named accordingly (Arrow, then DC Legends) and the plot also details all the members of the crossover in order - with the current 'real' member in square brackets.

arrow.thumb.PNG.2b33b47b0639324dc50fecd368de5e76.PNG

.. Arrow is next in the crossover, so in that show, it is listing the crossovers as 'the Flash' (before) and DC Legends (after), with the Arrow episode being ep8.

Finally, in the 3rd show - DC legends, it has put the two 'crossover' episodes before the DC legends Ep7.

dcl.thumb.PNG.61623ef624cd592de4cb835c3f237f8b.PNG

So it doesn't matter what show you are viewing it from - you always get the correct crossover sequence. 😎

Pre-requisites - The metadata nfo/artwork needs to be stored alongside the media file - this will not work if this option is not ticked (ie your metadata/artwork is held within the emby subdirectories instead).

art.PNG.72efa32cff2a5772da97b4e653db196d.PNG

What is the script ? 

Unfortunately it's just a Windows based batch script that does the work (yuk, yes I know..) but it's been developed over time when I was just mucking about getting the concept correct and it works just fine, so I have no real inclination to convert it to Powershell or Python etc as speed is not really an issue here.

Run it from a Command prompt - you do not need any elevated permissions but will need permissions to write to the media directories.

What is the input file ?

It's just a semi-colon delimited text file, listing all the crossover data.

My exact file is attached, but you'll obviously need to generate your own in the format :-

<special number>;<crossover name>;<show1 path to file>;<show1 season>;<show1 episode>;<show2 path to file.... blah blah

<special number> is just a unique number sequence for each franchise, 10 will start the episode numbering at 101 - meaning it should not interfere with any existing specials.

List of the episodes should match the crossover sequence - ie unc file 1 will show first, unc file 2 will show second etc.. 

Media File location ?

Grab the media file location from the 'Media Info' section in a web browser - just copy and paste it into the input file.

file_location.PNG.e3bcc2eb90480de176194452fa58284e.PNG

Testing

I have only tested with UNC file paths (shares), but there is no reason it should not work with drive letters and folders.

For your system, I suggest just creating a single crossover (or modify my file) and check to see what is has done before adding others.

Nothing on the script deletes or modifies existing files in any way - it only creates new or copies existing files.  

Execution speed depends on your system, but for all the crossovers I have listed, it takes about 30 seconds to generate them all.

Improvements

Many things haha - I need to sort out creating the nfo files in a more elegant way .. I would also like to have each show listed as a new line in the 'plot' text, but could not get this to work.

Down the line, I'd also like to get the input list created from the media ID's via the Emby API rather than UNC links, but one step at a time.

Also - Read the Season and Episode from the UNC filename rather than add in the input file - should be easy enough to do, I just haven't got around to it yet ..

Suggestions welcome :)

Other things to note ..

The crossover episodes are 'backdated' when they are created (year 2000) - they will therefore not screw up any 'new items or next up' lists.  When created, you'll have to find them in the shows in the relevant season - or a quick check in Season 0 will list them all.

'Next Up Special Playing in sequence' - will only work in the Beta release - the current 'Release' does NOT honour the special sequence playback numbering.    As soon as the long overdue Beta is promoted to Release, this will be fixed. (or run the beta)..

edit 21/05 - 'Next Up' Special Playing sequence now works with the current Release - 4.6 

 

Edited by rbjtech
Expand details on metadata/artwork location
  • Like 5
Link to comment
Share on other sites

RaptorCentauri

What do you mean by 

On 4/19/2021 at 3:49 PM, rbjtech said:

The metadata needs to be stored with the media - this will not work if the metadata is stored locally.

if the metadata is with the media, doesn't that mean its stored locally?

  • Thanks 1
Link to comment
Share on other sites

4 hours ago, RaptorCentauri said:

What do you mean by 

if the metadata is with the media, doesn't that mean its stored locally?

Yes that's what he means.

Link to comment
Share on other sites

rbjtech

Hi @RaptorCentauri

In the library settings - you can opt to save the metadata/artwork/nfo in the folders alongside the media file itself.  It doesn't matter where the media is - be it on a NAS (UNC path) or 'local' disk. (drive letter).  

My script only works if this option is selected, because otherwise it doesn't know where the metadata/artwork is held as it gets it's path from the media file location.

I'll reword this to make it clearer - thanks for pointing this out.

nfo.PNG.d81f85d9f47e60623ab3642e70aeaf4f.PNG

art.PNG.194f3457a404e98f02327f872a0db7b7.PNG

Link to comment
Share on other sites

  • 4 weeks later...
Diedrich

@rbjtech Sorry for being dense, but where do I put the bat/text file? In the root of my TV library, the root of the series folder, or the series season 0 folder?

 

Link to comment
Share on other sites

rbjtech

Hi - It doesn't matter where you run the bat/txt file from as long as it has permissions to modify the file system or shares listed in the txt file.

Maybe create a folder on your c drive and run it from there.

 

 

Link to comment
Share on other sites

Diedrich
53 minutes ago, rbjtech said:

Hi - It doesn't matter where you run the bat/txt file from as long as it has permissions to modify the file system or shares listed in the txt file.

Maybe create a folder on your c drive and run it from there.

Thanks. My issue was that I am using a Windows computer to run the bat file (for ease of use) but my Emby server is on a Ubuntu host. So I did what you suggested above and used the unc location and then just went back into the strm files and adjusted the file location.

Ok, so some questions... It created the appropriate links in the Stargate SG-1 and Stargate Atlantis season 0 folders but I thought it was also going to make links in the appropriate series seasons, e.g.

Stargate SG-1: Season 8

  1. Stargate SG-1 s08e01
  2. Stargate SG-1 s08e02 and then after that would be the strm file for
  3. Stargate Atlantis s01e01.strm

and then in the Atlantis series it would create a strm file to Stargate SG-1

Stargate Atlantis: Season 1

  1. Stargate SG-1 s08e01.strm
  2. Stargate SG-1 s08e02.strm
  3. Stargate Atlantis s01e01
Edited by Diedrich
Link to comment
Share on other sites

rbjtech
1 hour ago, Diedrich said:

Ok, so some questions... It created the appropriate links in the Stargate SG-1 and Stargate Atlantis season 0 folders but I thought it was also going to make links in the appropriate series seasons, e.g.

It doesn't need to because it gets the link location from the metadata in the season 0 nfo file in the 'Specials' section.   Emby itself then put's in the correct season and episode location for you.

So first question - Do you have the NFO reader turned on for this library ?

If you look in the Stargate SG1 season 0 folder - you should have a .strm file plus a .nfo file as well ?

The .nfo should have something like this is it - this tells emby where to put that special.  In the example below it will appear in season 1 after episode 9.

<episode>101</episode>
  <season>0</season>
  <displayepisode>9</displayepisode>
  <displayseason>1</displayseason>

 

Link to comment
Share on other sites

  • 2 years later...
Locutus64

I was hoping to have crossovers independent of the regular episodes so as in you example 8 would be skipped when looking at the season and just in a special folder for the episodes involved in the crossover, but this looks like it would work very nicely cause if I don't want to watch the crossover I can just skip to the next episode after the crossover. I'll have a go at this. Thanks for putting in the time to create this, very much appreciated.

Link to comment
Share on other sites

rbjtech
9 minutes ago, Locutus64 said:

I was hoping to have crossovers independent of the regular episodes so as in you example 8 would be skipped when looking at the season and just in a special folder for the episodes involved in the crossover, but this looks like it would work very nicely cause if I don't want to watch the crossover I can just skip to the next episode after the crossover. I'll have a go at this. Thanks for putting in the time to create this, very much appreciated.

It gets complicated really quickly - especially for the CW crossovers with 5 shows having crossovers !

The idea behind it was to include the crossovers from the other shows seemlessly - because they will then get marked as 'watched',  if you then watch the other show(s), then those episodes will get skipped, as you have already watched them.  ie If you watch 'Invasion!' while watching the Flash, you won't view it again if then watching 'Arrow' for example.

If I were to do it again, I'd either use the Emby API or via an Emby Plugin - as currently it uses NFO files to update the placement of the crossover within the season - far from ideal !

Have fun. 

Edited by rbjtech
  • Like 1
Link to comment
Share on other sites

Locutus64

I knew that this was going to be a project and a half when I decided to do this. Think I'm going to put in a feature request for edible playlist. So few crossovers they won't look out of place in a drop down list of playlist on the left side of the Home screen. Thanks again.

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...