HOW-TO:Use MakeMKV Template Pattern with TV Shows: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 56: Line 56:
# Transcode the second disc.
# Transcode the second disc.
## The result, using our example setup, will result in three additional files: {{divbox|plain||<code>My Foobar Honey/<br/>My Foobar Honey/Season 1<br/>My Foobar Honey/Season 1/My Foobar Honey (2005) S1E01.mkv<br/>My Foobar Honey/Season 1/My Foobar Honey (2005) S1E02.mkv<br/>My Foobar Honey/Season 1/My Foobar Honey (2005) S1E03.mkv<br/>My Foobar Honey/Season 1/My Foobar Honey (2005) S1E-3-01.mkv<br/>My Foobar Honey/Season 1/My Foobar Honey (2005) S1E-3-02.mkv<br/>My Foobar Honey/Season 1/My Foobar Honey (2005) S1E-3-03.mkv</code>}}
## The result, using our example setup, will result in three additional files: {{divbox|plain||<code>My Foobar Honey/<br/>My Foobar Honey/Season 1<br/>My Foobar Honey/Season 1/My Foobar Honey (2005) S1E01.mkv<br/>My Foobar Honey/Season 1/My Foobar Honey (2005) S1E02.mkv<br/>My Foobar Honey/Season 1/My Foobar Honey (2005) S1E03.mkv<br/>My Foobar Honey/Season 1/My Foobar Honey (2005) S1E-3-01.mkv<br/>My Foobar Honey/Season 1/My Foobar Honey (2005) S1E-3-02.mkv<br/>My Foobar Honey/Season 1/My Foobar Honey (2005) S1E-3-03.mkv</code>}}
# Using some "shell" wizardry, rename the new files:<code>1  OFFSET=3<br/>2  for PRIOR_NAME in *-${OFFSET}-*;do<br/>3    ADJUST=$(printf "%02d" $(($(echo -n ${PRIOR_NAME}|sed -E -e "s/^.*-${OFFSET}-(.*)\.mkv$/\1/g")+OFFSET)))<br/>4    NEW_NAME=$(echo -n ${PRIOR_NAME}|sed -E -e "s/^(.*)-${OFFSET}-.*$/\1${ADJUST}.mkv/g")<br/>5    mv -i "$PRIOR_NAME" "$NEW_NAME"<br/>6  done</code>
# Using some "shell" wizardry, rename the new files:<code><br/>1  OFFSET=3<br/>2  for PRIOR_NAME in *-${OFFSET}-*;do<br/>3    ADJUST=$(printf "%02d" $(($(echo -n ${PRIOR_NAME}|sed -E -e "s/^.*-${OFFSET}-(.*)\.mkv$/\1/g")+OFFSET)))<br/>4    NEW_NAME=$(echo -n ${PRIOR_NAME}|sed -E -e "s/^(.*)-${OFFSET}-.*$/\1${ADJUST}.mkv/g")<br/>5    mv -i "$PRIOR_NAME" "$NEW_NAME"<br/>6  done</code>
# The prior info explained, line-by-line:
# The prior info explained, line-by-line:

Revision as of 03:01, 30 January 2022

Do you use MakeMKV for transcoding from different formats (i.e., DVDs, Blu-Rays, etc.) into Matroska Multimedia Container (aka "MKV") formats?

If so, you may have struggled with transcoding a TV show from a DVD into a file that Kodi can properly integrate into your Video Library (category link).

This HOW-TO article provides a step-by-step approach to manage MakeMKV-to-named-for-Kodi TV show episodes.

Overview

When using MakeMKV to transcode a disc that contains multiple TV show episodes, manually renaming things is fairly trivial. What is problematic is when that TV Show has multiple seasons and episodes, the renaming of the various "MKV" files can becoming daunting.

This HOW-TO article provides a general strategy with a specific example done using MakeMKV-with-Linux solution.

General Strategy

MakeMKV has a, "preferences" dialog, allowing end-users to change different settings. On the "Advanced" tab, there is an entry titled, Output file name template:

TODO - show default template

By combining the use of the "name" of the disc with different Output Filename Template patterns, one can ease how TV show episodes are named.

Assumptions for this HOW-TO

  • You are going to transcode a TV show named, "My Foobar Honey"
  • With Season 1(one), produced in the year 2005.
    • The recommended approach for naming a TV show episode can be found at Naming video files/TV shows.
    • Which means that the first episode of the first season would be named: My Foobar Honey (2005) S01E01
  • Season 1(one) of the show is delivered with two discs. Both discs have three episodes each.

High level outline of the steps taken

  1. Adjust MakeMKV to save the first disc conforming to Kodi's TV Show naming conventions.
    1. Setup the Output file name template for the first disc.
    2. Set the name of the disc to the TV Show name, year of the season being transcoded.
  2. Transcode the first disc.
  3. Adjust the MakeMKV's Output file name template for the second disc
    1. The template will use a "pattern" that offsets from where the last disc transcoded left off.
    2. Since the prior transcode stopped at three(3), the offset is "4".
  4. Transcode the second disc.
  5. From CLI, move the second disc's episode to conform with Kodi's TV Show naming conventions.
  6. BONUS: Reset MakeMKV's default template pattern!

Example using Linux

  1. Adjust MakeMKV for the first disc.
    1. Change the pattern in the output file template from:
          {NAME1}{-:CMNT1}{-:DT}{title:+DFLT}{_t:N2}
    2. To:
          {NAME} S1E{M2}
    3. Set the "name" of the disc to: My Foobar Honey (2005)
  2. Transcode the first disc.
    1. The result, using our example setup, will result in three files:
  3. Adjust MakeMKV for the second disc.
    1. Determine the "offset". As the first disc result in 3(three) files, the "offset" is 3(three).
    2. Incorporate the "offset" into the template pattern. The prior pattern of: {NAME} S1E{M2}
    3. Becomes: {NAME} S1E-3-{M2}
  4. Transcode the second disc.
    1. The result, using our example setup, will result in three additional files:
  5. Using some "shell" wizardry, rename the new files:
    1 OFFSET=3
    2 for PRIOR_NAME in *-${OFFSET}-*;do
    3 ADJUST=$(printf "%02d" $(($(echo -n ${PRIOR_NAME}|sed -E -e "s/^.*-${OFFSET}-(.*)\.mkv$/\1/g")+OFFSET)))
    4 NEW_NAME=$(echo -n ${PRIOR_NAME}|sed -E -e "s/^(.*)-${OFFSET}-.*$/\1${ADJUST}.mkv/g")
    5 mv -i "$PRIOR_NAME" "$NEW_NAME"
    6 done
  6. The prior info explained, line-by-line: