Jump to content

Intro Detection Options


jaketame

Recommended Posts

jaketame

Hi,

Please can I request some enchancements to the Intro Detection Options

1) Ability to select 'New Episodes Only'

2) Ability to Refresh Metadata without Fingerprinting (Without having to disable library setting)

3) Refresh metdata but keep existing fingerprints

Thanks

Edited by jaketame
Link to comment
Share on other sites

rbjtech
1 hour ago, jaketame said:

Hi,

Please can I request some enchancements to the Intro Detection Options

1) Ability to select 'New Episodes Only'

2) Ability to Refresh Metadata without Fingerprinting (Without having to disable library setting)

3) Refresh metdata but keep existing fingerprints

Thanks

One day emby might implement what the original Introskip Plugin had .. 🙄

#2/3

image.png.ffea1cf50fd714d4ec599e0b39801729.png

image.png.fb10939f430e603927c1149a3d1458e0.png

For #1 - Not 100% sure why you would want this - but the Plugin allowed you to select the shows to include/exclude - so you could just add 'New' shows if that's what you mean.

 

 

 

 

 

  • Like 1
Link to comment
Share on other sites

jaketame
Just now, rbjtech said:

One day emby might implement what the original Introskip Plugin had .. 🙄

#2/3

image.png.ffea1cf50fd714d4ec599e0b39801729.png

image.png.fb10939f430e603927c1149a3d1458e0.png

For #1 - Not 100% sure why you would want this - but the Plugin allowed you to select the shows to include/exclude - so you could just add 'New' shows if that's what you mean.

 

 

 

 

 

I've had some various issues over the years and a few times had to scan the entire library again (looks like I might have to do an entire library.db wipe again with issues with duplicate items + now 'items not found' with google drive 403 downloadlimitexceeded gets hit when any form of downloading the entire library happens so a backup method of 'native' metadata to reimport would be ideal (similar to the plugin). Refreshing of independent intros if required, refreshing metadata without shows, only allowing the library to scan 'net new' items.

What would be even better is if we could figure out how to export plex > emby (this is where the library orignally started so has all the intro markers already) I don't mind given this a go however Emby DB isn't the easiest to follow table dependencies.

https://github.com/Casvt/Plex-scripts/blob/main/changing_settings/intro_marker_editor.py

https://github.com/danrahn/MarkerEditorForPlex

One thing i'm not clear is that if I refresh metadata without intro detection enabled. Does that clear the fingerprints for data the does exist?

Link to comment
Share on other sites

rbjtech
13 minutes ago, jaketame said:

What would be even better is if we could figure out how to export plex > emby (this is where the library orignally started so has all the intro markers already) I don't mind given this a go however Emby DB isn't the easiest to follow table dependencies.

https://github.com/Casvt/Plex-scripts/blob/main/changing_settings/intro_marker_editor.py

https://github.com/danrahn/MarkerEditorForPlex

One thing i'm not clear is that if I refresh metadata without intro detection enabled. Does that clear the fingerprints for data the does exist?

So emby's Intro data is actually really easy - as it just uses hidden 'chapters' as part of it's normal 'chapters' information.

All accessable via the 'chapters' API in emby.

If you use the 'Chapter API' plugin - you'll see how they are stored.   That is open source from TeamB (on github) - see the Plugin details on the forum.

If Plex has a IntroStart, IntroEnd, CreditStart (and maybe a CreditEnd) marker (time), then it's easy enough to just slot that into the existing chapter markers, and then re-save them... 

Link to comment
Share on other sites

  • 2 weeks later...
jaketame

@LukeNoticed another slight annoyance. It looks like 'Scheduled Task and when new media is added" for Intro Detections. It looks like it refreshes the entire Show's metadata/intros so if for example 1 episode is added and its missing intro's for all, it goes through and scans all media. Is there a way to limit is to the recently added media only so the single episode?

Link to comment
Share on other sites

13 hours ago, jaketame said:

@LukeNoticed another slight annoyance. It looks like 'Scheduled Task and when new media is added" for Intro Detections. It looks like it refreshes the entire Show's metadata/intros so if for example 1 episode is added and its missing intro's for all, it goes through and scans all media. Is there a way to limit is to the recently added media only so the single episode?

HI, what makes you think it scans all media?

Link to comment
Share on other sites

jaketame
23 hours ago, Luke said:

HI, what makes you think it scans all media?

It would appear on new media being added to a season, it scans the entire directory thus intro detection.

Link to comment
Share on other sites

jaketame
On 03/03/2024 at 09:31, rbjtech said:

So emby's Intro data is actually really easy - as it just uses hidden 'chapters' as part of it's normal 'chapters' information.

All accessable via the 'chapters' API in emby.

If you use the 'Chapter API' plugin - you'll see how they are stored.   That is open source from TeamB (on github) - see the Plugin details on the forum.

If Plex has a IntroStart, IntroEnd, CreditStart (and maybe a CreditEnd) marker (time), then it's easy enough to just slot that into the existing chapter markers, and then re-save them... 

So extracting some data from Plex...

WITH seasons AS (
  SELECT
    id,
    `index` AS season_number
  FROM metadata_items
  WHERE
    metadata_type = 3 -- TV Show season metadata type
)
SELECT
  mi.title,
  s.season_number,
  mi.`index` AS episode_number,
  mi.id AS id,
  mp.file AS file,
  t.id AS intro_number,
  (
    SELECT (
      PRINTF('%02d',(time_offset / 1000 - time_offset / 1000 % 60) / 60))
      || ':'
      || PRINTF('%02d', (time_offset / 1000 % 60)
    )
  ) AS intro_begin,
  (
    SELECT (
      PRINTF('%02d', (end_time_offset / 1000 - end_time_offset / 1000 % 60) / 60))
      || ':'
      || PRINTF('%02d', (end_time_offset / 1000 % 60)
    )
  ) AS intro_end
FROM metadata_items mi
INNER JOIN seasons s ON mi.parent_id = s.id
INNER JOIN media_parts mp ON mi.id = mp.media_item_id
LEFT JOIN taggings t ON mi.id = t.metadata_item_id AND t.text = 'intro'
WHERE mi.metadata_type = 4 -- TV Show episode metadata type
ORDER BY mi.id, s.season_number, mi.`index`;

Example output;

episode_title, season_number, episode number, id, file path, intro_number, intro_start, intro_end

The Austere Academy: Part One    2    1    2457    /data/media/tvshows/13 Reasons Why/Season 2/13 Reasons Why S02E02 Two Girls Kissing - WEBDL-1080p.mkv    2138964    00:00    01:23

Just thinking about the best way to match data between plex > emby. Might need to extract emby ids to then add and then inject it directly in as raw SQL.... Anyone got thoughts?

Link to comment
Share on other sites

12 minutes ago, jaketame said:

It would appear on new media being added to a season, it scans the entire directory thus intro detection.

What makes you think it scans the entire directory?

Link to comment
Share on other sites

jaketame
1 minute ago, Luke said:

What makes you think it scans the entire directory?

Saw it in the logs scanning new media + the directories for 2 new episodes. (now I don't have the logs so lets ignore for now as not seen it again)

Link to comment
Share on other sites

20 minutes ago, jaketame said:

Saw it in the logs scanning new media + the directories for 2 new episodes. (now I don't have the logs so lets ignore for now as not seen it again)

Saw what in the logs exactly?

Link to comment
Share on other sites

jaketame
Just now, Luke said:

Saw what in the logs exactly?

New media scanned and the subsequent fingerprinting for all items in that series. 

Link to comment
Share on other sites

Just now, jaketame said:

New media scanned and the subsequent fingerprinting for all items in that series. 

Such as?

Link to comment
Share on other sites

jaketame
1 minute ago, Luke said:

Such as?

Like I said I don’t have the logs anymore so can’t show you. 

Link to comment
Share on other sites

rbjtech
On 15/03/2024 at 20:27, jaketame said:

So extracting some data from Plex...

WITH seasons AS (
  SELECT
    id,
    `index` AS season_number
  FROM metadata_items
  WHERE
    metadata_type = 3 -- TV Show season metadata type
)
SELECT
  mi.title,
  s.season_number,
  mi.`index` AS episode_number,
  mi.id AS id,
  mp.file AS file,
  t.id AS intro_number,
  (
    SELECT (
      PRINTF('%02d',(time_offset / 1000 - time_offset / 1000 % 60) / 60))
      || ':'
      || PRINTF('%02d', (time_offset / 1000 % 60)
    )
  ) AS intro_begin,
  (
    SELECT (
      PRINTF('%02d', (end_time_offset / 1000 - end_time_offset / 1000 % 60) / 60))
      || ':'
      || PRINTF('%02d', (end_time_offset / 1000 % 60)
    )
  ) AS intro_end
FROM metadata_items mi
INNER JOIN seasons s ON mi.parent_id = s.id
INNER JOIN media_parts mp ON mi.id = mp.media_item_id
LEFT JOIN taggings t ON mi.id = t.metadata_item_id AND t.text = 'intro'
WHERE mi.metadata_type = 4 -- TV Show episode metadata type
ORDER BY mi.id, s.season_number, mi.`index`;

Example output;

episode_title, season_number, episode number, id, file path, intro_number, intro_start, intro_end

The Austere Academy: Part One    2    1    2457    /data/media/tvshows/13 Reasons Why/Season 2/13 Reasons Why S02E02 Two Girls Kissing - WEBDL-1080p.mkv    2138964    00:00    01:23

Just thinking about the best way to match data between plex > emby. Might need to extract emby ids to then add and then inject it directly in as raw SQL.... Anyone got thoughts?

Better to just use the chapter API in Emby, yes you'll need to match the plex id to the emby id - I suggest maybe just use the Provider Id as a key if that is available (tvdb episode id).

Then convert the intro time to ticks, then 'insert' the existing chapters, re-order, then re-write the chapters via the API.

You'll be discourages from doing it directly in SQL - but it's perfectly doable, there is a 'chapter' table (chapters3) in the emby database that you could edit..

Link to comment
Share on other sites

jaketame
Posted (edited)
8 minutes ago, rbjtech said:

Better to just use the chapter API in Emby, yes you'll need to match the plex id to the emby id - I suggest maybe just use the Provider Id as a key if that is available (tvdb episode id).

Then convert the intro time to ticks, then 'insert' the existing chapters, re-order, then re-write the chapters via the API.

You'll be discourages from doing it directly in SQL - but it's perfectly doable, there is a 'chapter' table (chapters3) in the emby database that you could edit..

Thanks. Yes started to look at the chapters field in the Items service.

will need to get creative with some code on matching ids, grabbing entries etc.

i can dump more data from Plex so not an issue. Will see if can wrap into into json output which can then be passed straight into the Emby API.

i will want to ignore anything with a chapter intro already as if this works could publish to community for others.

Edited by jaketame
  • Like 1
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...