Announcement

Collapse
No announcement yet.

Naming Template Issues

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    StreamFab for Windows Naming Template Issues

    Since 6.2.0.8 or maybe 6.2.0.7, SF no longer respects the "" backslash in the naming template. For instance, I like to download movies into the Movies subdirectory, followed by a folder for the movie itself, and finally the movie.

    Click image for larger version

Name:	template.png
Views:	226
Size:	9.8 KB
ID:	455956

    The template clearly shows that it will download to the correct path, but then converts the \ to a _.

    Click image for larger version

Name:	output.png
Views:	184
Size:	2.3 KB
ID:	455957

    Can this change be reverted so that this functions correctly again? While I haven't tested every service, this is the case for both Amazon and Hulu.

    Thanks.

    #2
    While StreamFab has a Template for file names and such, it doesn't allow for all the options I want, and sometimes gets the resolution wrong. This Power Automate Desktop script uses MediaInfo CLI to capture the parameters of the file and sets variables that will be used in the file renaming process.

    For my plex library I like to use the Edition tags, and capture what service the file was downloaded from, if its 4K and if it has HDR or not. I also use abbreviations for the services.

    This flow meets my needs, and works, I've been using this for a long time, so I thought I'd share. I know there are other renamers out there, but I use Power Automate (cloud) for work so thought I'd play with Power Automate Desktop.

    The script evaluates for video resolution of 2160, 1080, 720. It assumes progressive scan as everything I've downloaded has been progressive. It also evaluates HDR types of HDR10, DV, or DoVi HDR10 (which is DV with fall back to HDR10 included). Audio is evaluated for EAC3, EAC3 JOC, and AAC.


    This script relies on StreamFab's VIP Services naming template for MOVIES to be:
    <moviename> (<year>) {edition-}

    Note: Peacock doesn't use StreamFab's name template currently, so I have separate rename steps for those files.


    While this script recurses the service provider folders in the main StreamFab Output folder, it only looks at the top level of the Service Provider folder, it does not recurse those subfolders. In other words, It does not touch already processed movies or touch TV shows as they would be in subfolders.

    I have StreamFab set to download as MKV, so this script is set to work only on MKV files. If you download as MP4, you would need to make a few changes in the flow, where MKV is specifically called out (like steps 37, and 95-98)

    What to expect:

    non-4K movie Source file:
    StreamFabOut\Amazon\MovieName (year) {edition-}.mkv

    Output file:
    StreamFabOut\Amazon\MovieName (year)\MovieName (year) 1080p {edition-Amz DL}.mkv

    4K Movie source file (downloaded from Max as 4K only HDR10):
    StreamFabOut\Max\MovieName (year) {edition-}.mkv

    Output file:
    StreamFabOut\Max\MovieName (year)\MovieName (year) 2160p {edition-Max DL 4K HDR10}.mkv


    When copied to your Plex movie folder, they will show as the movie name, and the edition tag will be respected.


    REQUIRED:
    • Power Automate Desktop -> https://learn.microsoft.com/en-us/po...-flows/install
    • MediaInfo CLI from -> https://mediaarea.net/en/MediaInfo/Download/Windows
      • ONE TIME SETUP: With Power Automate Desktop Closed, download MediaInfo CLI, then unzip it, (move the folder if you need to) and add the folder to the Windows Path environment variable. To add to Path... Windows Settings -> System -> About -> Advanced System Settings -> Environment Variables. In the SYSTEM variables section, select Path, click the Edit Button, and add the folder where you unzipped MediaInfo CLI.
    • Select the entire script in Post #2 of this thread, copy to the clipboard. Open Power Automate Desktop, Create a New Flow, name it, click Create. In the Main section (middle of screen), right click and paste. The flow steps will be created there. (if copy/paste of the "code" doesn't work, please see the attached text file, to copy/paste from)
    • Make sure you set the FolderBase variable (lines 3-8 of the flow) in the Flow to match the top level if your StreamFab output folder. (also see personalization note below)

    Personalization notes:
    • I have both a laptop and desktop, the location of the download folders are different on each computer. Therefore I have a two sets of IF statements (rows 3 through 8) to evaluate if the folder exists and sets FolderBase = to the correct StreamFab output folder for the computer I'm working on.
    • While I do have MediaInfo CLI capture video and audio details to variables, I only use the video info when renaming. You can adjust rows 99-115 to include the Audio variable if you wish.
    • Lines 15-34 set the custom Service names or abbreviations used when renaming the files. So if you don't like Amz for Amazon, edit line 16 for example.
    • You can tweak the output file name string and variables on rows 99-115. ​ For example: you don't need to have the edition tag in the final file name, you can remove it.
    Last edited by KidJoe; 12-20-2024, 02:58 PM.

    Comment


      #3
      Code:
      /# <<Expand and read this entire comment!!>>
      
      This script is the initial attempt at making the Flow more generic to use for MOVIES from all services.  It relies on StreamFab using a folder for each service (See the naming template below)
      
      REQUIRED:  Download MediaInfo CLI from -> https://mediaarea.net/en/MediaInfo/Download/Windows   ONE TIME SETUP:  unzip it, and add the folder to the Windows Path environment variable, exit and restart Power Automate before running or HDR/DV detection will not work.
      
      This script relies on StreamFab's VIP Services naming template for MOVIES be:
      <moviename> <year> {edition-}
      
      Make sure you set the FolderBase line 4 and 7.   The IF statements are there (lines 3-8) in case you have more than one computer.
      Folder Base =StreamFab's Output folder.
      
      
      
      
      
      
      
      #/
      DateTime.GetCurrentDateTime.Local DateTimeFormat: DateTime.DateTimeFormat.DateAndTime CurrentDateTime=> DT_Start
      IF (Folder.IfFolderExists.Exists Path: $'''F:\\BluRay-Working\\- DVDFab10\\DVDFab Downloader''') THEN
          SET FolderBase TO $'''F:\\BluRay-Working\\- DVDFab10\\DVDFab Downloader'''
      END
      IF (Folder.IfFolderExists.Exists Path: $'''C:\\DVDFab\\StreamFab\\Download''') THEN
          SET FolderBase TO $'''C:\\DVDFab\\StreamFab\\Download'''
      END
      Folder.GetSubfolders Folder: FolderBase FolderFilter: $'''*''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Subfolders=> Folders
      SET MovieCount TO 0
      LOOP FOREACH CurrentItem IN Folders
          **REGION Configure Startup Variables
          SET FolderPath TO CurrentItem
          DISABLE SET FolderPath TO $'''%FolderBase%\\%FolderService%'''
          IF CurrentItem.Name = $'''Amazon''' THEN
              SET Service TO $'''Amz'''
          END
          IF CurrentItem.Name = $'''AppleTV+''' THEN
              SET Service TO $'''A+'''
          END
          IF CurrentItem.Name = $'''Disney+''' THEN
              SET Service TO $'''D+'''
          END
          IF CurrentItem.Name = $'''Hulu''' THEN
              SET Service TO $'''Hulu'''
          END
          IF CurrentItem.Name = $'''Max''' THEN
              SET Service TO $'''Max'''
          END
          IF CurrentItem.Name = $'''netflix''' THEN
              SET Service TO $'''Netflix'''
          END
          IF CurrentItem.Name = $'''Peacock''' THEN
              SET Service TO $'''Peacock'''
          END
          **ENDREGION
          Folder.GetFiles Folder: FolderPath FileFilter: $'''*.mkv''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> FilesMKV
          LOOP FOREACH MP4Files IN FilesMKV
              SET Is4K TO $'''No'''
              File.GetPathPart File: MP4Files Directory=> Directory FileName=> FileName FileNameWithoutExtension=> FileNameNoExtension Extension=> FileExtension
              **REGION Get Video info - MediaInfo CLI
              # This DOS Command runs MediaInfoCLI to return Frame Width, Frame Height, HDR Format and Video Codec used.   Each are then stored in variables for use later.
              @@copilotGeneratedAction: 'False'
      Scripting.RunDOSCommand.RunDOSCommand DOSCommandOrApplication: $'''mediainfo --Output=Video;%%Width%%x%%Height%%x%%HDR_Format/String%%x%%Format%% \"%Directory%\\%FileNameNoExtension%.mkv\"''' WorkingDirectory: Directory StandardOutput=> CommandOutput2 StandardError=> CommandErrorOutput2 ExitCode=> CommandExitCode2
              Text.SplitText.SplitWithDelimiter Text: CommandOutput2 CustomDelimiter: $'''x''' IsRegEx: False Result=> MediaInfoOut
              SET varFrameWidth TO MediaInfoOut[0]
              SET varFrameHeight TO MediaInfoOut[1]
              SET HDR_Format TO MediaInfoOut[2]
              SET CodecID TO MediaInfoOut[3]
              # This DOS Command returns the Audio Format which is stored as a variable for use later
              @@copilotGeneratedAction: 'False'
      Scripting.RunDOSCommand.RunDOSCommand DOSCommandOrApplication: $'''mediainfo --Output=Audio;%%Format/Info%% \"%Directory%\\%FileNameNoExtension%.mkv\"''' WorkingDirectory: Directory StandardOutput=> AudioFormat StandardError=> CommandErrorOutput3 ExitCode=> CommandExitCode3
              **ENDREGION
              **REGION Determine Audio Type based on Audio Format string returned from MediaInfo CLI
              # This Section evaluates the string returned from MediaInfo CLI for Audio type looking for EAC3, EAC3 JOC, or AAC and sets a variable to optionally be used in file naming later.
              SET Audio TO $'''%''%'''
              IF Contains(AudioFormat, $'''Enhanced AC-3''', True) THEN
                  SET Audio TO $''' E-AC-3'''
              END
              IF Contains(AudioFormat, $'''Enhanced AC-3 with Joint Object Coding''', True) THEN
                  SET Audio TO $''' Atmos'''
              END
              IF Contains(AudioFormat, $'''Advanced Audio Codec Low Complexity''', True) THEN
                  SET Audio TO $''' AAC'''
              END
              **ENDREGION
              **REGION Determine video resolution
              IF (varFrameHeight = 2160 OR varFrameWidth = 3840) = $'''True''' THEN
                  SET Resolution TO $'''2160p'''
              END
              IF (varFrameWidth = 1920 OR varFrameHeight = 1080) = $'''True''' THEN
                  SET Resolution TO $'''1080p'''
              END
              IF (varFrameWidth = 1280 OR varFrameHeight = 720) = $'''True''' THEN
                  SET Resolution TO $'''720p'''
              END
              **ENDREGION
              **REGION Set HDRType - Mediainfo CLI
              IF HDR_Format = $'''SMPTE ST 2086, HDR10 compatible''' THEN
                  SET HDRType TO $'''HDR10'''
              END
              IF (Contains(HDR_Format, 'dvhe.08.06', True) OR Contains(HDR_Format, 'dvhe.07.06', True)) = $'''True''' THEN
                  SET HDRType TO $'''DoVi HDR10'''
              END
              IF Contains(HDR_Format, $'''dvhe.05.06''', True) THEN
                  SET HDRType TO $'''DV'''
              END
              **ENDREGION
              DISABLE GOTO 'End'
              IF (Service = 'Peacock') = $'''True''' THEN
                  DISABLE SET NewVar3 TO MP4Files.NameWithoutExtension
                  Text.SplitText.SplitWithDelimiter Text: MP4Files.NameWithoutExtension CustomDelimiter: $'''.mkv''' IsRegEx: True Result=> TextList
              ELSE
                  DISABLE SET NewVar3 TO FileName
                  Text.SplitText.SplitWithDelimiter Text: FileName CustomDelimiter: $'''{e''' IsRegEx: True Result=> TextList
              END
              SET MKVFilesFullname TO $'''%Directory%\\%MP4Files.NameWithoutExtension%.mkv'''
              SET MKVFileName TO $'''%MP4Files.NameWithoutExtension%.mkv'''
              SET MKVFilesFullname TO $'''%Directory%\\%MP4Files.NameWithoutExtension%.mkv'''
              SET MKVFilesFullname1 TO $'''%Directory%\\%MP4Files.NameWithoutExtension%'''
              IF (Service = 'Peacock') = $'''True''' THEN
                  IF Resolution = $'''2160p''' THEN
                      File.RenameFiles.RenameAddText Files: MP4Files.FullName TextToAdd: $''' %Resolution% {edition-%Service% DL 4K %HDRType%}''' TextPosition: File.AddTextPosition.AfterName IfFileExists: File.IfExists.Overwrite RenamedFiles=> RenamedFiles
                      SET NewFolderName1 TO $'''%TextList[0]%- 4K'''
                  ELSE
                      File.RenameFiles.RenameAddText Files: MP4Files.FullName TextToAdd: $''' %Resolution% {edition-%Service% DL}''' TextPosition: File.AddTextPosition.AfterName IfFileExists: File.IfExists.DoNothing RenamedFiles=> RenamedFiles
                      SET NewFolderName1 TO TextList[0]
                  END
              ELSE
                  IF Resolution = $'''2160p''' THEN
                      File.RenameFiles.RenameReplaceText Files: MKVFilesFullname TextToReplace: $'''{edition-}''' ReplaceWith: $'''%Resolution% {edition-%Service% DL 4K %HDRType%}''' IfFileExists: File.IfExists.DoNothing RenamedFiles=> RenamedFiles
                      SET NewFolderName1 TO $'''%TextList[0]%- 4K'''
                  ELSE
                      File.RenameFiles.RenameReplaceText Files: MKVFilesFullname TextToReplace: $'''{edition-}''' ReplaceWith: $'''%Resolution% {edition-%Service% DL}''' IfFileExists: File.IfExists.DoNothing RenamedFiles=> RenamedFiles
                      SET NewFolderName1 TO TextList[0]
                  END
              END
              Folder.Create FolderPath: FolderPath FolderName: NewFolderName1 Folder=> NewFolder
              SET NewRenamed TO RenamedFiles[0]
              DISABLE File.Move Files: NewRenamed.FullName Destination: NewFolder.FullName IfFileExists: File.IfExists.DoNothing MovedFiles=> MovedFiles
              # since PAD's File Move/File Copy funtions weren't working,  I went with DOS command instead.    These next two steps handle that.
              SET DOSCommand TO $'''move \"%NewRenamed%\"  \"%NewFolder%\"'''
              Scripting.RunDOSCommand.RunDOSCommand DOSCommandOrApplication: DOSCommand WorkingDirectory: FolderPath StandardOutput=> CommandOutput StandardError=> CommandErrorOutput ExitCode=> CommandExitCode
              Variables.IncreaseVariable Value: MovieCount IncrementValue: 1
          END
      END
      DateTime.GetCurrentDateTime.Local DateTimeFormat: DateTime.DateTimeFormat.DateAndTime CurrentDateTime=> DT_End
      DateTime.Subtract FromDate: DT_End SubstractDate: DT_Start TimeUnit: DateTime.DifferenceTimeUnit.Hours TimeDifference=> TimeDifference
      Variables.TruncateNumber.GetIntegerPart Number: TimeDifference Result=> Hours
      Variables.TruncateNumber.GetDecimalPart Number: TimeDifference Result=> Remainder
      SET Minutes TO Remainder * 60
      Variables.TruncateNumber.GetDecimalPart Number: Minutes Result=> Remainder
      Variables.TruncateNumber.GetIntegerPart Number: Minutes Result=> Minutes
      Variables.TruncateNumber.GetIntegerPart Number: Remainder * 60 Result=> Seconds
      Display.ShowMessageDialog.ShowMessageWithTimeout Title: $'''Complete''' Message: $'''Processed %MovieCount% movies
      %Hours%h %Minutes%m %Seconds%s''' Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: True Timeout: 180 ButtonPressed=> ButtonPressed
      ​
      ​
      Attached Files

      Comment


        #4
        I recently updated my SF to version 6.2.0.9, and noticed that when it names files, always overrides my settings.
        For example i choose:

        tvseriestitle.S(season number)E(episode number).Episode title

        and it gives me this uotput:

        tvseriestitle_S(season number)E(episode number)_Episode title

        I think it may be a little bug, because all the rest is working like a charm.

        Thanks for the time.
        Very good software!

        Comment


          #5
          > I think it may be a little bug

          StreamFab 6.2.0.9 Changelog
          Fix: A problem that the file names are wrong when download videos as audio format from Amazon.
          Looks like in 6209 all dots are replaced by underscores.

          This also annoys me enormously, because (for all providers)
          ..\ at template start is no longer possible - info about ..\ here

          Comment


            #6
            I put the movies in subfolders like movie.name (year)/movie.name but now it adds the underscore so the movie goes in the folder as movie.name (year)_movie.name.

            I had to change this for now and manually create the subfolder until this is corrected.

            Comment


              #7
              My ..\ used for severals months is now ___

              see also "point replacement" in 6209 here

              Comment


                #8
                I am riding 6.2.0.8 until it explodes or they fix the template once and for all...

                I honestly don't understand the coding decisions made by the Dev and Wilson.

                BTW: Did you try double backslashes?

                Comment


                  #9
                  Originally posted by jpp72 View Post
                  BTW: Did you try double backslashes?
                  I did. And it just converts it to a double underscore. Can't win with this app... One step forward, fifteen steps back.

                  Comment


                    #10
                    Literally, all they need to do is update the list of illegal characters.

                    Who decided that a . is an illegal character??? Makes no sense.

                    They should change it from something like:

                    Code:
                    const std::string invalidChars = ".<>:\"/\\|?*";
                    to

                    Code:
                    const std::string invalidChars = "<>:"/\\|?*";

                    Comment


                      #11
                      Even better the method System.Io.Path.GetInvalidPathChars in .Net actually returns the list of characters not supported by the windows file system. They don't need to maintain their own.

                      But anyway, I noticed all my moves are now named movies_movename, le sigh

                      Comment


                        #12
                        Originally posted by jpp72 View Post
                        I am riding 6.2.0.8 until it explodes or they fix the template once and for all...

                        I honestly don't understand the coding decisions made by the Dev and Wilson.

                        BTW: Did you try double backslashes?
                        Hello there, yeah it's really annoying and I cannot find SF 6.0.2.8, do you have a link ?
                        Thank you.

                        Comment


                          #13
                          Originally posted by Valent1 View Post

                          Hello there, yeah it's really annoying and I cannot find SF 6.0.2.8, do you have a link ?
                          Thank you.
                          try logging in the member center at the top of the and see if you have the extended download service
                          for older versions of streamfab.

                          Comment


                            #14
                            Originally posted by october262 View Post

                            try logging in the member center at the top of the and see if you have the extended download service
                            for older versions of streamfab.
                            Unfortunatly I don't have it !

                            Comment


                              #15
                              I am so baffled by this.

                              In 6.2.0.8, everything is good except for the fact that all of a sudden, the naming template gets a bunch of codecs wrong for Amazon. It used to work flawlessly.
                              In 6.2.0.9, all . and \ are converted to _ and you couldn't even add a . unless it was already there from the previous versions
                              In 6.2.1.0, you can again add a . but it still gets converted to _

                              That means they removed the restriction in the GUI but not the conversion when using the template to write to the disk

                              So of course, i am staying with 6.2.0.8. If 6.2.0.8 stops working because of DRM changes, then that will effectively put a nail in StreamFab's coffin when it comes to me using it

                              smh...

                              Comment

                              Working...
                              X