diff --git a/README.md b/README.md index 7418d67..bf5137e 100644 --- a/README.md +++ b/README.md @@ -6,15 +6,45 @@ Modified to remove Playready DRM instead of Widevine. - Progress Bars for decryption ([mp4decrypt](https://github.com/chu23465/bentoOldFork), Shaka) - Refresh Token fixed for Amazon service - Reprovision .prd after a week - - ISM manifest support (Microsoft Smooth Streaming) (Few features to be added) + - ISM manifest support (Microsoft Smooth Streaming) (WIP/Experimental) - N_m3u8DL-RE downloader support +## Broken + - `--bitrate CVBR+CBR` is currently broken + - Atmos audio with ISM manifest (Amazon) is currently broken (Needs a working init.mp4). If the title has the atmos audio in MPD then it should work. + - ATVP service is currently broken in dev branch + - Netflix service is currently broken (will probably be fixed Soon™) + +If anyone has any idea how to fix above issues, feel free to open a pull request. ## Usage -1. Run `install.bat` +1. Make sure git is installed in your system by running `git --version`. If not refer to [link](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) + +2. Choose a branch, either `dev` or `main`. Use below command to download. (Recommended instead of downloading zip) + ```bash + git clone -b --single-branch https://github.com/chu23465/VT-PR + ``` -2. Activate venv using `venv.cmd`. +3. Navigate and find `install.bat` + +4. Run `install.bat` + +5. Activate venv using `venv.cmd`. + +6. Run desired command using poetry. + + +## Updating + +1. Backup your `vinetrimmer/Cookies/`, `vinetrimmer/Cache/`, `/Downloads` directories just in case. + +2. Open a command prompt and navigate your `VT-PR` directory. + +3. Recall the branch you downloaded and modify below command accordingly: + ```bash + git pull origin + ``` ### Config @@ -124,7 +154,7 @@ Below flags to be passed after the `AMZN` or `Amazon` keyword in command. | -ism, --ism | Set manifest override to SmoothStreaming. Defaults to DASH w/o this flag. | | -?, -h, --help | Show this message and exit. | -To get UHD/4k with Amazon, navigate to - +To get Atmos/UHD/4k with Amazon, navigate to - ``` https://www.primevideo.com/region/eu/ontv/code?ref_=atv_auth_red_aft diff --git a/linux_binaries/N_m3u8DL-RE b/linux_binaries/N_m3u8DL-RE new file mode 100644 index 0000000..22d4867 Binary files /dev/null and b/linux_binaries/N_m3u8DL-RE differ diff --git a/linux_binaries/mkvtoolnix.AppImage b/linux_binaries/mkvtoolnix.AppImage new file mode 100644 index 0000000..cb9b0f8 Binary files /dev/null and b/linux_binaries/mkvtoolnix.AppImage differ diff --git a/linux_binaries/mp4decrypt b/linux_binaries/mp4decrypt new file mode 100644 index 0000000..82a97e0 Binary files /dev/null and b/linux_binaries/mp4decrypt differ diff --git a/linux_binaries/mp4dump b/linux_binaries/mp4dump new file mode 100644 index 0000000..594e76b Binary files /dev/null and b/linux_binaries/mp4dump differ diff --git a/linux_binaries/packager b/linux_binaries/packager new file mode 100644 index 0000000..b0bcffc Binary files /dev/null and b/linux_binaries/packager differ diff --git a/vinetrimmer/commands/dl.py b/vinetrimmer/commands/dl.py index 871c3e4..93877e6 100644 --- a/vinetrimmer/commands/dl.py +++ b/vinetrimmer/commands/dl.py @@ -98,7 +98,7 @@ def get_cdm(log, service, profile=None, cdm_name=None): device = Device.load(os.path.join(directories.devices, f"{cdm_name}.wvd")) except: device_path = os.path.abspath(os.path.join(directories.devices, f"{cdm_name}.prd")) - if ( int( time.time() ) - int( os.path.getmtime( device_path ) ) ) > 600000: #roughly a week + if ( int( time.time() ) - int( os.path.getmtime( device_path ) ) ) > 160000: #roughly 2 days try: reprovision_device(device_path) log.info(f" + Reprovisioned Playready Device (.prd) file, {cdm_name}") diff --git a/vinetrimmer/parsers/ism.py b/vinetrimmer/parsers/ism.py index 4f9690c..c174ecd 100644 --- a/vinetrimmer/parsers/ism.py +++ b/vinetrimmer/parsers/ism.py @@ -217,6 +217,7 @@ def parse(*, url=None, data=None, source, session=None, downloader=None): # extra extra=(list(quality_level), list(stream_info),) # Either set size as a attribute of VideoTrack or append to extra here. )) + """ elif type_info == 'audio': atmos = ( str( quality_level.get('@HasAtmos', 'N/A') ).lower() == "true" ) or ( "ATM" in stream_info.get('@Name', 'N/A') ) tracks.append(AudioTrack( @@ -224,7 +225,7 @@ def parse(*, url=None, data=None, source, session=None, downloader=None): source=source, url=url, # metadata - codec=(codec or "").split(".")[0], + codec="E-AC3" if codec == "EC-3" else (codec or "").split(".")[0], language=lang, bitrate=bitrate, channels=quality_level.get('@Channels', 'N/A'), @@ -232,11 +233,12 @@ def parse(*, url=None, data=None, source, session=None, downloader=None): # switches/options descriptor=Track.Descriptor.ISM, # decryption - needs_repack=False, # Necessary + needs_repack=True, # Necessary encrypted=encrypted, pssh=pssh, kid=kid, # extra extra=(dict(quality_level), dict(stream_info),) )) + """ return tracks diff --git a/vinetrimmer/services/amazon.py b/vinetrimmer/services/amazon.py index b4c218a..643ca2e 100644 --- a/vinetrimmer/services/amazon.py +++ b/vinetrimmer/services/amazon.py @@ -1,5 +1,7 @@ from __future__ import annotations +from sys import platform + import base64 import hashlib import json @@ -75,7 +77,7 @@ class Amazon(BaseService): @click.option("-c", "--cdn", default=None, type=str, help="CDN to download from, defaults to the CDN with the highest weight set by Amazon.") # UHD, HD, SD. UHD only returns HEVC, ever, even for <=HD only content - @click.option("-vq", "--vquality", default="UHD", + @click.option("-vq", "--vquality", default="HD", type=click.Choice(["SD", "HD", "UHD"], case_sensitive=False), help="Manifest quality to request.") @click.option("-s", "--single", is_flag=True, default=False, @@ -83,7 +85,7 @@ class Amazon(BaseService): @click.option("-am", "--amanifest", default="H265", type=click.Choice(["CVBR", "CBR", "H265"], case_sensitive=False), help="Manifest to use for audio. Defaults to H265 if the video manifest is missing 640k audio.") - @click.option("-aq", "--aquality", default="SD", + @click.option("-aq", "--aquality", default="HD", type=click.Choice(["SD", "HD", "UHD"], case_sensitive=False), help="Manifest quality to request for audio. Defaults to the same as --quality.") @click.option("-ism", "--ism", is_flag=True, default=False, @@ -115,7 +117,11 @@ class Amazon(BaseService): self.cdm = ctx.obj.cdm self.profile = ctx.obj.profile - + if "linux" in platform: + import yaml + #Read YAML file + with open("/content/vinetrimmer/config/Services/amazon.yml", 'r') as stream: + self.config = yaml.safe_load(stream) self.region: dict[str, str] = {} self.endpoints: dict[str, str] = {} self.device: dict[str, str] = {} @@ -411,6 +417,7 @@ class Amazon(BaseService): video_codec="H265" if manifest_type == "H265" else "H264", bitrate_mode="CVBR" if manifest_type != "CBR" else "CBR", quality=self.aquality or self.vquality, + manifest_type="DASH", hdr=None, ignore_errors=True ) @@ -506,7 +513,8 @@ class Amazon(BaseService): # replace the audio tracks with DV manifest version if atmos is present if any(x for x in uhd_audio_mpd.audios if x.atmos): - tracks.audios = uhd_audio_mpd.audios + print("Hello") + tracks.audios = uhd_audio_mpd.audios for video in tracks.videos: try: diff --git a/vinetrimmer/services/max.py b/vinetrimmer/services/max.py index 5f80c38..fbbf392 100644 --- a/vinetrimmer/services/max.py +++ b/vinetrimmer/services/max.py @@ -62,6 +62,7 @@ class Max(BaseService): self.acodec = ctx.parent.params["acodec"] self.range = ctx.parent.params["range_"] self.alang = ctx.parent.params["alang"] + self.quality = ctx.parent.params["quality"] or 1080 # self.api_region = self.config.get(ctx.obj.profile, {}).get('api_region', 'comet-latam') # self.license_api = None diff --git a/vinetrimmer/utils/io.py b/vinetrimmer/utils/io.py index 855703c..e611c44 100644 --- a/vinetrimmer/utils/io.py +++ b/vinetrimmer/utils/io.py @@ -15,6 +15,7 @@ import yaml from vinetrimmer import config from vinetrimmer.utils.collections import as_list +from sys import platform def load_yaml(path): if not os.path.isfile(path): @@ -239,12 +240,11 @@ async def saldl(uri, out, headers=None, proxy=None): async def m3u8dl(uri: str, out: str, track): - executable = shutil.which("N_m3u8DL-RE") or shutil.which("m3u8DL") + executable = shutil.which("N_m3u8DL-RE") or shutil.which("m3u8DL") or "/usr/bin/N_m3u8DL-RE" if not executable: raise EnvironmentError("N_m3u8DL-RE executable not found...") - ffmpeg_binary = shutil.which("ffmpeg") - + ffmpeg_binary = shutil.which("ffmpeg") or "/usr/bin/ffmpeg" arguments = [ executable, uri, @@ -257,11 +257,10 @@ async def m3u8dl(uri: str, out: str, track): "--download-retry-count", "8", "--ffmpeg-binary-path", ffmpeg_binary, "--binary-merge", - "--decryption-engine", "SHAKA_PACKAGER", - "--http-request-timeout", "8", - "--live-real-time-merge" ] - + if not ("linux" in platform): + arguments.append("--http-request-timeout") + arguments.append("8") if track.__class__.__name__ == "VideoTrack": if track.height: arguments.extend([