Announcement

Collapse
No announcement yet.

Easy MOD for Amazon Individual Season/Episode Analysis

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    StreamFab for Windows Easy MOD for Amazon Individual Season/Episode Analysis

    StreamFab users who download a lot from Amazon know that individual season and episode analysis is essential. Reasons for wanting this could be:
    • You don't necessarily always want the highest bitrate possible
    • TV Show has some seasons in SD and others in HD or FHD
    • TV Show has different audio codecs for different seasons
    • Different episodes within a season have very different bitrates available. StreamFab will download the highest bitrate if it doesn't find the one you selected from another episode.
    • TV Show has a lot of seasons, making the analysis painfully long
    0xFeedBeef came up with 2 ways of modifying the Python scripts for Amazon in order to alleviate these issues. This way for individual seasons and this way for individual episodes.

    I took his findings and created 2 Windows CMD scripts for people that aren't comfortable manually editing the Python scripts. This will ensure there are no typos that will break the code. Python is extremely finicky about proper indentation. It also speeds up the process of applying the mods after a StreamFab upgrade and speeds up selecting an episode to analyze.

    Installation
    • Unzip the file onto your desktop for easy access. It doesn't need to be there if you don't like clutter on your desktop to work
    • Right-Click the file named sf_manage_mod.cmd and click Run as administrator
    Click image for larger version  Name:	image.png Views:	28 Size:	23.7 KB ID:	458113
    • Confirm the elevation of privileges
    • Choose the Install MOD option
    Click image for larger version  Name:	image.png Views:	24 Size:	23.7 KB ID:	458114

    If you want to uninstall the MOD, choose the Restore out-of-box functionality option

    EDIT: Here is a gofile link if you cannot click on the file above: https://gofile.io/d/daI8JR
    Last edited by jpp72; 01-24-2025, 08:56 PM.

    #2
    Usage

    Once you have extracted the MOD to your desktop or any other folder, you should have a folder called SF Amazon Mod with 6 files. 4 Python scripts and 2 CMD scripts:

    Click image for larger version  Name:	image.png Views:	0 Size:	11.8 KB ID:	458119
    • sf_manage_mod.cmd is used to install or remove the MOD
    • sf_amzn_ep_select.cmd will take the episode number you want to analyze in the current season displayed in StreamFab
    • mod.* files are the pre-modified versions of the python scripts that make the MOD work
    • orig.* files are the original untouched versions of the python scripts that come with StreamFab Out-of-the-box

    After installing the MOD as explained in the previous post, you will only ever need to use sf_amzn_ep_select.cmd unless you wish to revert to OOB functionality.

    As with the other CMD script, we need to run sf_amzn_ep_select.cmd as an administrator because we modify files directly from the C:\Program Files\DVDFab\StreamFab\script folder.
    1. Right-click on sf_amzn_ep_select.cmd and Run as administrator
    2. Input the episode number that you want to analyze
    3. Click the Click to analyze button in StreamFab
    Click image for larger version  Name:	image.png Views:	0 Size:	26.6 KB ID:	458120

    Things to consider:
    • If StreamFab is not installed in the default location, you can edit both scripts with your custom location. Same if you are using 32-bit instead of 64-bit StreamFab
    • For this to work properly, you must disable the Automatic Analysis in the StreamFab settings
    • You can run the script while StreamFab is running
    • If you are adding to the queue and need to analyze another episode, refresh the page in StreamFab, run the script, click analyze.
    • The episode you choose to analyze will be moved to the top of the episode list. If you have severe OCD, you can re-order the episodes in the Download Queue
    Here is a screenshot of what the pop-up will look like:

    Click image for larger version  Name:	image.png Views:	0 Size:	140.8 KB ID:	458121

    This is a perfect example of why we need StreamFab to implement individual episode analysis. It has 40 seasons and i don't just need the last episode so sort by descending doesn't really help me because i need the last 5 episodes.

    If you'd like to know how the sf_amzn_ep_select.cmd script works, you can paste it into Gemini AI, Claude AI or ChatGPT and they will explain what is happening.

    For the python script, here is the code i added:

    Code:
        # Move the episode with position X to the beginning of the array
        for i, episode in enumerate(episodes_array):
            if episode["seq"] == 1:
                episodes_array.insert(0, episodes_array.pop(i))
                break​

    Comment


      #3
      Any working links for this?

      Comment


        #4
        Originally posted by travelar View Post
        Any working links for this?
        Dunno why the zip appears and disappears randomly. Added a link to GoFile

        Comment


          #5
          After ACTUALLY using my script to download those 5 missing episodes, i realized that having to run it as administrator every time is cumbersome.

          So i created a version where you run as administrator once and it will keep asking you for episodes to analyze until you close the window.

          Click image for larger version

Name:	image.png
Views:	447
Size:	48.4 KB
ID:	458134

          Source code:

          Code:
          @echo off
          setlocal EnableDelayedExpansion
          for /f "delims=" %%a in ('echo prompt $E^|cmd') do set "ESC=%%a"
          echo.
          echo %ESC%[1;37m ****************************************************%ESC%[0m
          echo %ESC%[1;37m *   Individual Season/Episode Analysis MOD v1.02   *%ESC%[0m
          echo %ESC%[1;37m *           For StreamFab's Amazon Module          *%ESC%[0m
          echo %ESC%[1;37m *                Script by Chikan72                *%ESC%[0m
          echo %ESC%[1;37m *       Based on idea and code by 0xFeedBeef       *%ESC%[0m
          echo %ESC%[1;37m ****************************************************%ESC%[0m
          echo.
          echo %ESC%[1;37mChecking if Individual Analysis MOD is installed...%ESC%[0m
          echo.
          CD "C:\Program Files\DVDFab\StreamFab\script"
          for /f "tokens=*" %%b in ('powershell -Command "(Get-Content -Path 'amazon_get_seasons_info.py') | Select-String -Pattern '.*if episode\[\"seq\"\]\s\=\=\s\d+\:' -Quiet"') do (
            goto mod
          )
          echo %ESC%[1;31m *** Unmodified amazon_get_seasons_info.py has been detected! ***%ESC%[0m
          echo.
          echo %ESC%[1;37mPlease install the modified file in order to use this script.%ESC%[0m
          goto no_mod
          :mod
          echo %ESC%[1;32m *** Modified amazon_get_seasons_info.py has been detected! ***%ESC%[0m
          echo.
          :mod_loop
          set /p "episode_number=Enter the episode number you'd like to analyze: "
          echo.
          echo %ESC%[1;34m *** Updating amazon_get_seasons_info.py to analyse episode !episode_number!...%ESC%[0m
          powershell -Command "(Get-Content amazon_get_seasons_info.py) -replace '(.*if episode\[\"seq\"\]\s\=\=)\s\d+(\:)', '$1 !episode_number!$2' | Out-File -encoding ASCII amazon_get_seasons_info.py"
          echo %ESC%[1;34m *** Done. %ESC%[0m
          echo.
          echo You can now analyze the episode and add it to the queue. When done, & pause
          goto mod_loop
          :no_mod
          Echo.
          pause
          endlocal​
          I added the new file inside a different zip file and it is in that same GoFile folder

          Comment


            #6
            Remember there been a py mod to reverse order of episodes so the latest is showing first at the top. Does anyone remember what it was and which script to change.

            Comment


            • jpp72
              jpp72 commented
              Editing a comment
              It's literally linked in the OP

            #7
            Originally posted by Radical553 View Post
            Remember there been a py mod to reverse order of episodes so the latest is showing first at the top. Does anyone remember what it was and which script to change.
            it's in the brain surgery

            Comment


              #8
              jpp72

              I would like to ask again about your statement, it may be that it is translated incorrectly!

              "Different episodes within a season have very different bitrates available. StreamFab will download the highest bitrate if it doesn't find the one you selected from another episode."

              Example:

              In the selection window Season 1, Episode 1 (which is actually analyzed) I have 1080p Bitrate 1,000, Bitrate 5,000, Bitrate 10,000 to choose from.

              I choose 10,000 because I want the maximum.

              There is no 10,000 for Episode 5. What does Streamfab do then, does it download the 5,000 or the 1,000?

              My guess was always that it downloads the 1,000.​

              Comment


                #9
                Originally posted by Sebastian001 View Post
                jpp72

                I would like to ask again about your statement, it may be that it is translated incorrectly!

                "Different episodes within a season have very different bitrates available. StreamFab will download the highest bitrate if it doesn't find the one you selected from another episode."

                Example:

                In the selection window Season 1, Episode 1 (which is actually analyzed) I have 1080p Bitrate 1,000, Bitrate 5,000, Bitrate 10,000 to choose from.

                I choose 10,000 because I want the maximum.

                There is no 10,000 for Episode 5. What does Streamfab do then, does it download the 5,000 or the 1,000?

                My guess was always that it downloads the 1,000.​
                No it's the opposite.

                For H264, i don't mind getting the highest bitrate. But for H265, some of the bitrates just insane.

                Why would i need an H265 file with an 8000kbps video track when it's a sitcom or a reality show?

                Let's take a fictitious TV Show where when you scan Episode 1, and it returns 8000/5000/3000kbps. Select all Episodes and choose 3000kbps. The bitrates in green are what StreamFab will download.

                Bitrate 1 Bitrate 2 Bitrate 3
                Episode 1 8000kbps 5000kbps 3000kbps
                Episode 2 8000kbps 5000kbps 3000kbps
                Episode 3 8000kbps 5000kbps 3000kbps
                Episode 4 8000kbps 5000kbps
                Episode 5 8000kbps 5000kbps


                In my opinion, the commonsense thing to do for Episodes 4 and 5 would be to download 5000kbps no? I mean it's pretty obvious to see!

                If you go to the store to buy 12 eggs but they only have the cartons of 18 eggs and 30 eggs, are you going to buy the 30 or the 18? It's so freaking obvious that it grinds my gear to no end. Then, when you realize you have a bunch of oversized downloads, you go back to download specific episodes, and you are denied because you ran out of tokens for the day. It's supposed to NOT charge you for episodes you already downloaded the same day, but it does the check AFTER the download so that's useless to people who have no tokens. It should check BEFORE the download.

                Anyway, these are only a few of the reasons for my user title. I could go on and on but there is literally no point. I try to improve my user experience with external tools and homemade scripts such as this one. Unfortunately, not everything is user modifiable, so we just have to grin and bear it.

                Comment


                  #10
                  Originally posted by jpp72 View Post

                  No it's the opposite.

                  For H264, i don't mind getting the highest bitrate. But for H265, some of the bitrates just insane.

                  Why would i need an H265 file with an 8000kbps video track when it's a sitcom or a reality show?

                  Let's take a fictitious TV Show where when you scan Episode 1, and it returns 8000/5000/3000kbps. Select all Episodes and choose 3000kbps. The bitrates in green are what StreamFab will download.
                  Bitrate 1 Bitrate 2 Bitrate 3
                  Episode 1 8000kbps 5000kbps 3000kbps
                  Episode 2 8000kbps 5000kbps 3000kbps
                  Episode 3 8000kbps 5000kbps 3000kbps
                  Episode 4 8000kbps 5000kbps
                  Episode 5 8000kbps 5000kbps

                  In my opinion, the commonsense thing to do for Episodes 4 and 5 would be to download 5000kbps no? I mean it's pretty obvious to see!

                  If you go to the store to buy 12 eggs but they only have the cartons of 18 eggs and 30 eggs, are you going to buy the 30 or the 18? It's so freaking obvious that it grinds my gear to no end. Then, when you realize you have a bunch of oversized downloads, you go back to download specific episodes, and you are denied because you ran out of tokens for the day. It's supposed to NOT charge you for episodes you already downloaded the same day, but it does the check AFTER the download so that's useless to people who have no tokens. It should check BEFORE the download.

                  Anyway, these are only a few of the reasons for my user title. I could go on and on but there is literally no point. I try to improve my user experience with external tools and homemade scripts such as this one. Unfortunately, not everything is user modifiable, so we just have to grin and bear it.
                  Thanks for your explanation, well, it's actually ideal for me because I want the maximum bitrate. Unfortunately, with Amazon, the newer the upload, the lower the bitrate.

                  This is how I handle it with the token. I only download 99 per day, so I can download the same episode as often as I want, but I don't know whether a different bitrate selection won't be counted again.

                  I always download everything twice to rule out errors. With my 99 episodes today, there were many that weren't loaded or processed correctly. It was a bad day :-)​

                  Comment


                  • Germania
                    Germania commented
                    Editing a comment
                    > but I don't know whether a different bitrate selection won't be counted again.

                    not on the same (SF) day

                  #11
                  Originally posted by Sebastian001 View Post

                  Thanks for your explanation, well, it's actually ideal for me because I want the maximum bitrate. Unfortunately, with Amazon, the newer the upload, the lower the bitrate.

                  Don't be fooled by the bitrate as an indicator of quality of an encode- newer chips don't get as hot as previous generations so they don't produce as much (or at all) noise and old film had grain that was bitrate killer. I encode my own H.265s and only ever use constant quantizer (and never change it between encodes unless it's a really grainy source)- the bitrates vary wildly depending on the source, sometimes hitting >15Mbps with older heavily grained stuff, and all the way down to 800kbps for newer stuff, and that's all with 1080p frame.

                  Comment

                  Working...
                  X