Match ep_1_part1.mp4 and ep_1_part2.mp4 as same ep_1 name

Any questions? Need some help?
Post Reply
xxSlayeRxx
Posts: 4
Joined: 24 May 2014, 15:40

Match ep_1_part1.mp4 and ep_1_part2.mp4 as same ep_1 name

Post by xxSlayeRxx »

Hi (it's my first post so i should say hi :D)

I was looking for answer, but i cant find anything.


First introduction:




I have files like this (i have "czesc" 1 z 2, but it means "part 1 of 2") and for sure it works with bamboo blade and futari ecchi:

Code: Select all

Gosick 1 part 1 of 3
Gosick 1 part 2 of 3
Gosick 1 part 3 of 3
Gosick 2
Gosick 3
Gosick 4 part 1 z 2
Gosick 4 part 2 z 2
And when FileBot is matching this, it looks like:

Code: Select all

Gosick 1 part 1 of 3  - Gosick 1
Gosick 1 part 2 of 3            - Gosick Special 1
Gosick 1 part 3 of 3            - not matches
Gosick 2                             - Gosick 2
Gosick 3                             - Gosick 3
Gosick 4 part 1 z 2             - Gosick 4
Gosick 4 part 2 z 2             - Gosick Special 2
with futari echi i get (with TheTVDB, with AniDB work well but only match part1) (when it was futari ecchi 1 - only one digit number - it cant match, but with two digits is better) i've attached empty file for tests:

Code: Select all

Futari Echci 01 - Part1 = Futari Echci 1
Futari Echci 01 - Part2 = Futari Echci 2
Futari Echci 02 - Part1 = not matched
Futari Echci 02 - Part2 = not matched
Futari Echci 03 - Part1 = Futari Echci 3
Futari Echci 03 - Part3 = not matched
Futari Echci 04 - Part1 = Futari Echci 4
Futari Echci 04 - Part2 = not matched
Now question:
What am I doing wrong? Can FileBot match parts of anime as one episode, and add "Part X" in the end of name?

I have scheme from forum and it has word "Part", so i think that i cant set proper name for matching.

And side question: Can i match files by hand - like futari ecchi drag "Futari Ecchi 2" from "Futari Echci 01 - Part2" to "Futari Echci 02 - Part1"?

i have powershell script that convets one number digit to two number digit (1 -> 01, 2 -> 02, 15 -> 15):

Code: Select all

#start from folder and goes one level deep
# a
# -> b
# -> c
# -> d
#    -> e
#    -> f
# -> g
# convert files in b,c,d,g folder and starts form a (files in a are not converted)
foreach ($dic in ls -Directory){
    cd $dic
    foreach ($file in dir) 
    {
        # this is for "część 1 z 2", means for "part 1 of 2")
        # Gostick 1 - część 1 z 2 -> Gostick 01 Part1
        if ([regex]::IsMatch($file.Name, " \d{1} - ")) 
        {   
            # add 0 before single digit umber
            $newName = $file.Name.Insert([regex]::Match($file.Name, " \d{1} - ").Index+1,"0")
            # convert "- część X z Y" -> "PartX"
            # in eng: "- part X of Y" -> "PartX"
            $match = [regex]::Match($file.Name, "- część \d{1} z \d{1}")
            $newName = $newName.Replace($match, "Part"+$match.Value[8])
            Rename-Item -Path $file -NewName $newName
        }
        # this is for "Name of anime ep_number"
        # number bust be in the end of line (before ext) and splited by space - if u have only this eps, it should work without changing enything
        # Gostick 1.mp4 -> Gostic 01.mp4
        # Gostick 12.mp4 -> untouched
        elseif ([regex]::IsMatch($file.Name, " \d{1}\" + $file.Extension + "$"))
        {
            $file.Name.Insert([regex]::Match($file.Name, " \d{1}\" + $file.Extension + "$").Index+1,"0")
            # add 0 before single digit umber
            Rename-Item -Path $file -NewName $file.Name.Insert([regex]::Match($file.Name, " \d{1}\" + $file.Extension + "$").Index+1,"0")
        }
    }
    cd ..
}
User avatar
rednoah
The Source
Posts: 23933
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Match ep_1_part1.mp4 and ep_1_part2.mp4 as same ep_1 nam

Post by rednoah »

1.
When processing absolute numbers, then each episode must not exist more than once per batch.

Image


2.
When processing duplicates with 1x01 patterns then filebot can take care of the limitation above internally.

Image

Naming Scheme used above:

Code: Select all

{n} - {sxe} - {t}{" ($di)"}
:idea: Please read the FAQ and How to Request Help.
xxSlayeRxx
Posts: 4
Joined: 24 May 2014, 15:40

Re: Match ep_1_part1.mp4 and ep_1_part2.mp4 as same ep_1 nam

Post by xxSlayeRxx »

thank you

this is my powershell script (easier modify than create)

Code: Select all

Param([int] $SeasonNumber = 1, [switch] $UseCurrentFolder, [switch] $Recurse)


$runPath = $PWD
# if UserCurrentFolder is on
#start from folder and goes one level deep
# if Recurse is on, goes whole tree and take files
# a
# -> b
# -> c
# -> d
#    -> e
#    -> f
# -> g
# convert files in b,c,d,g folder and starts form a (files in a are not converted)
if ($UseCurrentFolder)
{
    foreach ($file in dir -Name -Recurse:$Recurse $PWD) 
    {
        # this is for "część 1 z 2", means for "part 1 of 2")
        # Gostick 1 - część 1 z 2 -> Gostick 01 Part1
        if ([regex]::IsMatch($file.FullName, " \d{1,2} - ")) 
        {   
            # add 0 before single digit umber
            $newName = $file.FullName.Insert([regex]::Match($file.FullName, " \d{1,2} - ").Index+1, "" + $SeasonNumber.ToString() + "x0")
            # convert "- część X z Y" -> "PartX"
            # in eng: "- part X of Y" -> "PartX"
            $match = [regex]::Match($file.FullName, "- część \d{1} z \d{1}")
            $newName = $newName.Replace($match, "Part"+$match.Value[8])
            Rename-Item -Path $file -NewName $newName
        }
        # this is for "Name of anime ep_number"
        # Gostick 1 -> Gostic 01
        # Gostick 12 -> untouched
        elseif ([regex]::IsMatch($file.FullName, " \d{1,2}\" + $file.Extension + "$"))
        {
            $newName = $file.FullName.Insert([regex]::Match($file.FullName, " \d{1,2}\" + $file.Extension + "$").Index+1, "" + $SeasonNumber.ToString() + "x0")
            # add 0 before single digit umber
            Rename-Item -Path $file -NewName $newName
        }
    }
}
else
{
    foreach ($dic in ls $runPath -Directory)
    {
        cd $dic
        foreach ($file in dir -Name -Recurse:$Recurse $PWD) 
    {
        # this is for "część 1 z 2", means for "part 1 of 2")
        # Gostick 1 - część 1 z 2 -> Gostick 01 Part1
        if ([regex]::IsMatch($file.FullName, " \d{1,2} - ")) 
        {   
            # add 0 before single digit umber
            $newName = $file.FullName.Insert([regex]::Match($file.FullName, " \d{1,2} - ").Index+1, $SeasonNumber + "x0")
            # convert "- część X z Y" -> "PartX"
            # in eng: "- part X of Y" -> "PartX"
            $match = [regex]::Match($file.FullName, "- część \d{1} z \d{1}")
            $newName = $newName.Replace($match, "Part"+$match.Value[8])
            Rename-Item -Path $file -NewName $newName
        }
        # this is for "Name of anime ep_number"
        # Gostick 1 -> Gostic 01
        # Gostick 12 -> untouched
        elseif ([regex]::IsMatch($file.FullName, " \d{1}\" + $file.Extension + "$"))
        {
            $newName = $file.FullName.Insert([regex]::Match($file.FullName, " \d{1,2}\" + $file.Extension + "$").Index+1,$SeasonNumber + "x0")
            # add 0 before single digit umber
            Rename-Item -Path $file -NewName $newName
        }
    }
        cd ..
    }
}
and for Part1, i've used this (marked)
Image

I have last one (i hope) question, can i read warnings or is this only an icon? (also marked)
User avatar
rednoah
The Source
Posts: 23933
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Match ep_1_part1.mp4 and ep_1_part2.mp4 as same ep_1 nam

Post by rednoah »

The WARNING just means you better have a look. In this case it's probably because you're matching 1x01 with 01 which is not necessarily a correct match. Just happens to be in this case. ;)
:idea: Please read the FAQ and How to Request Help.
Post Reply