Renaming movies with Filebot

Discussion in 'Development' started by konstar, Oct 7, 2019.

  1. konstar

    konstar New Member

    Based on the badges and ribbons available in HomeTheater have come up with the following Filebot script to rename movies. You need a license to use Filebot, but it's worth it if you have a large collection to manage. I use the command line version and run directly on a Synology NAS.

    Using this script you'll end up with something like this:
    E.g. "2 Fast 2 Furious (2003) - (BluRay.2160p23.3840x1636.10bit-UHD.HDR.DTS-X.HEVC).mkv"

    Only the items in red are used by PosterWall. The BluRay / {source} tag is only used if it is a DVD - BluRay badge seems to come from whether it is an iso movie or not. Everything else I just use to help summarise video quality.

    Movies
    Code:
    {n.ascii().removeIllegalCharacters()} ({y})/{n.ascii().removeIllegalCharacters()} {tags} ({y}){try {if (vc) {" - ("}} catch(e) { if (source) {" - ("}}}{source}{if (source && vf) {"."}}{vf}{fps.trunc(0)}{"."+resolution}{"."+bitdepth+"bit"}{"-"+hd}{"."+hdr}{switch(aco) {
        case { it == "Dolby TrueHD with Dolby Atmos" || it == "Dolby Digital Plus with Dolby Atmos" }: ".TrueHD "+channels+" Atmos"
        break
        case { it == "Dolby TrueHD" }: ".TrueHD "+channels
        break
        case { it == "Dolby Digital" || it == "Dolby Digital Plus" }: ".Dolby "+channels
        break
        case { it == "DTS-HD High Resolution Audio" || it == "DTS-HD Master Audio" }:
            try { ".DTS-HD "+channels } catch (e) { ".DTS-X" }
        break
        case { it == "DTS-ES Matrix" || it == "DTS-ES Discrete" }: ".DTS "+channels
        break
        case { it == "Layer 3" }: ".MP3 "+channels
        break
        case { it == "Layer 2" }: ".MP2 "+channels
        break
        default: "."+aco+" "+channels
        break
    } }{switch(vc) {
        case { it == "x265" }: ".HEVC"
        break
        case { it == "x264" }: ".AVC"
        break
        default: "."+vc
    } }{try {if (vc) {")"}} catch(e) { if (source) {")"}}}{subt}
    
    TV
    Code:
    {n.ascii().removeIllegalCharacters()}/{"Season "+s+"/"}{n.ascii().removeIllegalCharacters()}.{s00e00}.{t.removeIllegalCharacters()} {tags} {try {if (vc) {" - ("}} catch(e) { if (source) {" - ("}}}{source}{if (source && vf) {"."}}{vf}{fps.trunc(0)}{"."+resolution}{"."+bitdepth+"bit"}{"-"+hd}{"."+hdr}{switch(aco) {
        case { it == "Dolby TrueHD with Dolby Atmos" || it == "Dolby Digital Plus with Dolby Atmos" }: ".TrueHD "+channels+" Atmos"
        break
        case { it == "Dolby TrueHD" }: ".TrueHD "+channels
        break
        case { it == "Dolby Digital" || it == "Dolby Digital Plus" }: ".Dolby "+channels
        break
        case { it == "DTS-HD High Resolution Audio" || it == "DTS-HD Master Audio" }:
            try { ".DTS-HD "+channels } catch (e) { ".DTS-X" }
        break
        case { it == "DTS-ES Matrix" || it == "DTS-ES Discrete" }: ".DTS "+channels
        break
        case { it == "Layer 3" }: ".MP3 "+channels
        break
        case { it == "Layer 2" }: ".MP2 "+channels
        break
        default: "."+aco+" "+channels
        break
    } }{switch(vc) {
        case { it == "x265" }: ".HEVC"
        break
        case { it == "x264" }: ".AVC"
        break
        default: "."+vc
    } }{try {if (vc) {")"}} catch(e) { if (source) {")"}}}{subt}
    
    Notes:
    • Using {vc} as a simple way to check if any info has been identified by filebot. If it is missing then in all cases I've seen everything else is missing as well. {source} can exist, but that comes from the filename not the media file.
    • trunc fps to highlight between 23.976 and 24 fps. Posterwall reads the media file not the filename though.
    • Have to highlight DD+ w/ Atmos as TrueHD w/ Atmo as there isn't a badge for DD+Atmos.
    • Using a hack to identify DTS-X. Filebot (in most cases) doesn't identify channel info from a DTS-HD track if there are object channels. Have seen 1 case where this didn't work. Looks like DTS-X Master tracks work fine (which most are), but DTS-X only tracks aren't picked up correctly. There are ways around this but requires a bit more code.
    • Firmware 2.1.30 (x9s 27-Sep-2019) ignores media tags if there are square brackets present, this seems to be a bug.
    • Each movie and its associated files should be placed inside their own separate movie directory. nfsstat analysis while playing video suggests the initial video open scans the directory (a getattr request per file). Guessing that the native player is looking for subtitles in the same directory as the video file. The delay in playing content correlates to the number of files in the same directory. Large movie libraries will suffer from these delays.
     
    Last edited: Dec 14, 2019
    JS_racer and paxnn like this.
  2. JS_racer

    JS_racer Member

    nice, thank you for this...
    any code updates, or still using this ??
     
  3. McBluna

    McBluna Active Member

    JS_racer likes this.
  4. Marcusstoini

    Marcusstoini New Member

    This may be the age of streaming video, but we still like to keep an eye on the Plex Media Server and its various apps for people who prefer to have local copies of their content. Plex makes it easy to organize any (non-DRM) movies and TV shows saved to your hard drive, and stream them across your devices. Plex works even better when your files are named properly. That’s where a handy little utility called FileBot comes in NEWS ENERGIA LUCE GAS.
     

Share This Page