Trouble with audio channels

Any questions? Need some help?
User avatar
rednoah
The Source
Posts: 16920
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Trouble with audio channels

Post by rednoah » 25 Jul 2017, 09:07

Remove "eng" from the list:

Code: Select all

audioLanguages.ISO3 - 'eng'
:idea: Please read the FAQ and How to Request Help.

Morgenstern72
Donor
Posts: 39
Joined: 09 May 2014, 18:57

Re: Trouble with audio channels

Post by Morgenstern72 » 25 Jul 2017, 09:31

rednoah wrote:
25 Jul 2017, 09:07
Remove "eng" from the list:

Code: Select all

audioLanguages.ISO3 - 'eng'

What's the ISO3 for?

So instead of
{audioLanguages}

it would be
{audioLanguages.ISO3 - 'eng'}
?

User avatar
rednoah
The Source
Posts: 16920
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Trouble with audio channels

Post by rednoah » 25 Jul 2017, 09:49

audioLanguages will give you a list of Language objects, so for each Language object, we get the ISO3 property, that gives use a list of String objects, from which we can remove the String object "eng".
:idea: Please read the FAQ and How to Request Help.

Morgenstern72
Donor
Posts: 39
Joined: 09 May 2014, 18:57

Re: Trouble with audio channels

Post by Morgenstern72 » 25 Jul 2017, 11:36

rednoah wrote:
25 Jul 2017, 09:49
audioLanguages will give you a list of Language objects, so for each Language object, we get the ISO3 property, that gives use a list of String objects, from which we can remove the String object "eng".
Thank you for the explanation :)
For the nice support and the free upgrade o the new version as an early donor I just sent you another small donation. Thank you for your dedication :)

Silke79
Posts: 10
Joined: 11 Dec 2018, 22:13

Re: Trouble with audio channels

Post by Silke79 » 29 Dec 2018, 21:55

Could use some help to get this working as it should if it's possible to fix it.
I used copy past on most of the script to put this togetter and are not that good at this typ of writing, so bare that in mind when you answer this.
  • 1) First problem is when there are more then one sub fil with the same language tag and it want to give it CD1 and so on and not give it .eng and then eng.forced as it should have been.
  • 2) Is that srt subs don't get the right folder name when it's a DC, TC or Remastered that I could use some help with too.
  • 3) Is it possible when it's both a Remastered and DC to be able to get that in the folder name?
  • 4) And fix the problem when : shows in the name and change it to - instead.
Code I use for Movie/Anime

Code: Select all

Filmer/{n} {' ['+fn.replaceAll(/(?i)directors|theatrical|ultimate/,'$0 Cut').matchAll(/UNRATED|REMASTERED|EXTENDED|UNCUT|DIRECTORS.CUT|THEATRICAL.CUT|ULTIMATE.CUT|SPECIAL.EDITION/).join('][').upperInitial().lowerTrail()+']'} ({y}) {vf} {source} {gigabytes} {audioLanguages}/{n} ({y}) {' CD'+pi} - {dim} {vf} {vc} [{ac}{fn.match("-HD.MA.")}-{af}]{'.'+lang}
Result
Image

User avatar
rednoah
The Source
Posts: 16920
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Trouble with audio channels

Post by rednoah » 30 Dec 2018, 07:01

1.
I'm not exactly sure what you try to do here. But if you have multiple subtitles for the same language for the same video file, then then accounting for that in your format is somewhat tricky.

The {subt} binding will give you .eng or .eng-forced so it's possible to have a pair of normal / forced subtitles, but that only works if the original file already has "forced" in the subtitle filename.


2.
Have you tried using {tags} instead? Your format explicitly checks the filename, so if the filename doesn't contain "UNRATED" then the destination path doesn't contain "UNRATED", which is the case for your badly named subtitle files.

:idea: {tags} will also check accompanying video files for tags, but I'm not sure if it'll work in your particular case, since video and subtitle files have completely different names in your particular case.


3.
Yes, just add another{tags} to your custom format, e.g.

Code: Select all

Movies/{ny} {tags}/{plex.name}

4.
{plex} does take care of that already. But there's a built-in convenience methods for that as well, e.g.

Code: Select all

{ny.colon(' - ')}
:idea: Please read the FAQ and How to Request Help.

Silke79
Posts: 10
Joined: 11 Dec 2018, 22:13

Re: Trouble with audio channels

Post by Silke79 » 31 Dec 2018, 00:17

Thanks rednoah

Got most of the problem fixed, but not #1 and that I can managed manually if need be.

But I stumble upon a new problem with my choice of having {gigabytes} in the script when I get movie folders/files that have CD1, CD2 and so on and it then makes a new folder for every CD1, CD2 and so on based on the files size and I would like it to put all in the same folder instead and if possible calculate the total size at the end of the main folder?

How I changed the script

Code: Select all

Movies/{n.colon(' - ')} {tags} ({y}) {vf} {source} {gigabytes} {audioLanguages}/{ny.colon(' - ')} - [{resolution}] [{vf} & {vc}] [{ac}{fn.match("-HD.MA.")}-{af}]{' CD'+pi}{'.'+lang}
BTW are there a more elaborated page then this one that go deeper in how scripts works in Filebot and how to change and to be able to write them yourself and learn how to?
https://www.filebot.net/naming.html

I tried to use this script with {plex.name}, but there was one problem that it put the sub files lang tag before this [{resolution}] [{vf} & {vc}] [{ac}{fn.match("-HD.MA.")}-{af}] and I need the lang tag at the end for it to work.

Code: Select all

Filmer/{n.colon(' - ')} {tags} ({y}) {vf} {source} {gigabytes} {audioLanguages}/{plex.name} - [{resolution}] [{vf} & {vc}] [{ac}{fn.match("-HD.MA.")}-{af}]
BTW is it possible for Filebot to have more then on script for Movies, Music, Episods?
For example I got anime on one HDD, movies on another HDD and so on to make it easier for me, but I use different scripts when i'm om the HDD with anime then I do on the HDD with movies or Episodes.
So it could be nice when i'm naming on my Anime HDD it change to that script and the one I use for my Movie HDD and so on automatically.

Otherwise a great program, but a few things for the next update I would like to see would be a color setup for different file so one easy can see what typ of file it is instead of the Yellow background and Black font as it is now.
Don't know if this is with my Windows 10 or it is the program itself, but it could be nice if the pop up screen you get when going into Edit Format stay at the size I had last time and is not go back to the small one every time.

User avatar
rednoah
The Source
Posts: 16920
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Trouble with audio channels

Post by rednoah » 31 Dec 2018, 04:40

1.
FileBot provides the data, but the code is effectively Groovy, which runs on top of the Java runtime, so you can do anything, and any Groovy or Java skills will help you understand and write FileBot format expressions.

Unfortunately, there's no "easy advanced" tutorial for writing Groovy code with FileBot format expressions in mind specifically.

In this case, {folder} is a FileBot binding, but everything else is just plain Groovy code and Java File API:

Code: Select all

{(folder.listFiles()*.length().sum() / 1e9).round(1) + " GB"}

2.
The File.derive(Closure...) method takes care of adding additional information after the name but before the extension part:

Code: Select all

{plex.derive{" by $director"}{" [$vf, $vc, $ac]"}}

3.
You can make Presets for different use cases. Alternatively, you can have your format be smart enough to just do different things depending on where the files are located. Ideally, once set up, you won't have to modify your format ever again.
:idea: Please read the FAQ and How to Request Help.

Silke79
Posts: 10
Joined: 11 Dec 2018, 22:13

Re: Trouble with audio channels

Post by Silke79 » 01 Jan 2019, 00:18

Thanks ones more for your patience rednoah with me. :D

I guess i'm again doing something wrong because with the new path you posted to me and I put into the script I use I get the problem that it will give me a folder from everything with different size as can be seen on the picture I put here.

Next problem is that the Plex path will give me the sub folder Movies that I don't like to have there.

New mod on the script

Code: Select all

Movies/{n.colon(' - ')} {tags} ({y}) {vf} {source} {(folder.listFiles()*.length().sum() / 1e9).round(1) + " GB"}/{plex.derive{" [$resolution]"}{" [$vf-$vc] [$ac-$af]"}}
New Problem
Image

User avatar
rednoah
The Source
Posts: 16920
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Trouble with audio channels

Post by rednoah » 01 Jan 2019, 06:00

1.
Strange indeed. My code assumes that video and subtitle files are in the same folder, which may or may not be the case for you.

You could do something like this for testing, to see the file list for each folder, which should be the same for files that are in the same folder:

Code: Select all

{folder.listFiles()*.name}
:idea: If you provide more detailed information (i.e. full file paths) then I may be able to help you write code that works for you.


2.
Using standard folder names is highly recommended, however, you can pick the path tail like so:

Code: Select all

{plex.tail}
:idea: viewtopic.php?f=5&t=4116
:idea: Please read the FAQ and How to Request Help.

Silke79
Posts: 10
Joined: 11 Dec 2018, 22:13

Re: Trouble with audio channels

Post by Silke79 » 01 Jan 2019, 17:41

The subtitles are in a sub folder when you have media that's from RARBG, but you have it in the main folder V:\Rocky.1976.REMASTERED.1080p.BluRay.H264.AAC-RARBG\Sub.
I tried moving the subtitle to the main folder and then the script worked with putting it all in the same main folder, but you still got the same problem with Plex path putting a \Movies\Rocky (1976)\ with the folders that I don't want.

This is what I get.
V:\Filmer\Rocky [Remastered] (1976) 1080p BluRay 2.5 GB\Movies\Rocky (1976)\Rocky (1976) [1920x1040] [1080p-x264] [AAC-6ch].MP4

V:\Filmer\Rocky [Remastered] (1976) 1080p BluRay 0.0 GB\Movies\Rocky (1976)\Rocky (1976) [1920x1040] [1080p-x264] [AAC-6ch].srt

This is what I get in the Edit Format.
Filmer/Avatar [Remastered] (2009) 1080p BluRay 0.0 GB/Movies/Avatar (2009)/Avatar (2009) CD1 [1920x1040] [1080p-x264] [AAC-6ch]

This is what I would like it to do
Filmer\Rocky [Remastered] (1976) 1080p BluRay 2.5 GB\Rocky (1976) [1920x1040] [1080p-x264] [AAC-6ch].MP4

Filmer\Rocky [Remastered] (1976) 1080p BluRay 2.5 GB\Rocky (1976) [1920x1040] [1080p-x264] [AAC-6ch].eng.srt

This is the script I need help fixing so it might do what I want in the end.

Code: Select all

Filmer/{n.colon(' - ')} {tags} ({y}) {vf} {source} {folder.listFiles()*.name}/{plex.derive{" [$resolution]"}{" [$vf-$vc] [$ac-$af]"}}
So if you could help me fixing the script to work as I want it to work I would be very happy for the help.
That it will work even if the subtitles are in a sub folder and be able to put in if it's Remastered, DC and so on when that is in the Folder/File name.

User avatar
rednoah
The Source
Posts: 16920
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Trouble with audio channels

Post by rednoah » 01 Jan 2019, 19:10

1.
This code will take all the matches currently loaded into FileBot, find the ones that match the current match by id, and then sum all the file sizes:

Code: Select all

model.findAll{ it.id == id }.file.length.sum()
So here's the format snippet for that, formatted as 0.0 GB value:

Code: Select all

{def size = model.findAll{ it.id == id }.file.length.sum(); (size / 1e9).round(1) + ' GB'}

2.
This snippet will give you the REMASTERED|DC value if the file path contains that value:

Code: Select all

{f.path.match(/REMASTERED|DC/)}
:!: The obvious limitation being that this doesn't work if REMASTERED does not appear in the full path of the subtitle file (i.e. it'll work for the use case you have given, but may not work for other use cases you have not given).


3.
This snippet will give you the file name part of the Plex path:

Code: Select all

{plex.derive{" [$resolution]"}{" [$vf-$vc] [$ac-$af]"}.name}
:idea: Please read the FAQ and How to Request Help.

Silke79
Posts: 10
Joined: 11 Dec 2018, 22:13

Re: Trouble with audio channels

Post by Silke79 » 02 Jan 2019, 16:20

Thanks for all the help I got from you rednoah :D

It works great for me so far after I have tested a few different typs of file and folders with DC and not and other media files.

For my Anime Movies

Code: Select all

Anime/{n.colon(' - ')} {tags} ({y}) {vf} {source} {def size = model.findAll{ it.id == id }.file.length.sum(); (size / 1e9).round(1) + ' GB'} {imdbid} {audioLanguages}/{plex.derive{" [$resolution]"}{" [$vf-$vc] [$ac-$af]"}.name}
Example
Anime\Berserk - The Golden Age Arc 1 - The Egg of the King (2012) 1080p BluRay 4.1 GB tt2210479 [jpn]\Berserk - The Golden Age Arc 1 - The Egg of the King (2012) [1920x816] [1080p-x264] [FLAC-6ch]

Anime\Berserk - The Golden Age Arc 1 - The Egg of the King (2012) 1080p BluRay 4.1 GB tt2210479 [jpn]\Berserk - The Golden Age Arc 1 - The Egg of the King (2012) [1920x816] [1080p-x264] [FLAC-6ch].eng

Regular Movies

Code: Select all

Movies/{n.colon(' - ')} {tags} ({y}) {vf} {source} {def size = model.findAll{ it.id == id }.file.length.sum(); (size / 1e9).round(1) + ' GB'} {imdbid}/{plex.derive{" [$resolution]"}{" [$vf-$vc] [$ac-$af]"}.name}
Example
Movie\Berserk - The Golden Age Arc 1 - The Egg of the King (2012) 1080p BluRay 4.1 GB tt2210479\Berserk - The Golden Age Arc 1 - The Egg of the King (2012) [1920x816] [1080p-x264] [FLAC-6ch]

Movie\Berserk - The Golden Age Arc 1 - The Egg of the King (2012) 1080p BluRay 4.1 GB tt2210479\Berserk - The Golden Age Arc 1 - The Egg of the King (2012) [1920x816] [1080p-x264] [FLAC-6ch].eng

BTW are there some why when you are renaming documentaries to have the company that made it, like BCC?

kim
Power User
Posts: 825
Joined: 15 May 2014, 16:17

Re: Trouble with audio channels

Post by kim » 02 Jan 2019, 21:53

only if in path name or in

Code: Select all

{info.productionCompanies}

Post Reply