Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

download() on a file with multiple Media options clobbers itself #1208

Open
MikeBishop opened this issue Aug 6, 2023 · 1 comment
Open
Labels

Comments

@MikeBishop
Copy link

Describe the Bug

When a downloadable item (e.g. Episode) is available in multiple quality/encoding options, calling download() is supposed to download all of them. However, if keep_original_filenames=False (the default), each Media item gets downloaded to the same friendly name, with subsequent downloads overwriting the previous ones. All the data is transferred, but only one remains on the file system after the function returns.

If keep_original_filenames=True, all files are downloaded because the target filenames are (likely to be) different.

Code Snippets

episode = series.onDeck()
files = episode.download()
assert len(files) == len(episode.media)

Expected Behavior

One or both of:

  • Only one media is downloaded, and I can select which one it is
    • Maybe by passing arguments into .download()?
    • Maybe by using episode.media[0].download(), which doesn't currently exist?
  • All media options are downloaded with different names.

Additional Context

Appending something like "[4K-20Mbps]" or "[1080p-8Mbps]" to the friendly name when a discriminator is needed would be a nice touch, but even "-0", "-1", etc. would keep the overwrite from happening.

Operating System and Version

Ubuntu 22.04 on WSL

Plex Media Server Version

1.31.2.6783

Python Version

3.10.6

PlexAPI Version

4.15.0

@JonnyWong16
Copy link
Collaborator

My ideas since the current download method just loops over all parts.

  1. Move the logic in the download() method to MediaPart to allow downloading a single part.
  2. Add a download() method to Media that calls the method in MediaPart to downloads all parts in that media. Add part discriminators (maybe -ptX to follow Plex's convention?) where necessary.
  3. Update the base download() method that calls the method in Media to download all parts in all media. Add media discriminators (maybe resolution and bitrate to match Plex's version dialogue?) where necessary (this would need to work in conjuntion with the part discriminator).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants