Skip to content

Instantly share code, notes, and snippets.

@TiloGit
Last active October 27, 2025 05:04
Show Gist options
  • Select an option

  • Save TiloGit/51ba118216561f7acdda96522d5d4db2 to your computer and use it in GitHub Desktop.

Select an option

Save TiloGit/51ba118216561f7acdda96522d5d4db2 to your computer and use it in GitHub Desktop.

Revisions

  1. TiloGit renamed this gist Oct 27, 2025. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. TiloGit created this gist Oct 27, 2025.
    40 changes: 40 additions & 0 deletions download_show.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@
    #in bash run this for env
    #source my-venv/bin/activate
    #python

    from datetime import datetime
    import os
    from plexapi.server import PlexServer
    baseurl = 'https://50-____removed____2a1922.plex.direct:32400'
    token = 'X---removed---Kb'
    plex = PlexServer(baseurl, token)


    print(datetime.now().isoformat() + " _______START SCRIPT ")
    # --- Search for the show ---
    item_name = "Balu" # Change this to the show you want
    itemlist = plex.library.search(item_name, libtype='show')
    for item in itemlist:
    print(datetime.now().isoformat() + " with: "+ item.title)
    ##action list size
    total_size = 0
    for episode in item.episodes():
    #print(datetime.now().isoformat() + " with Ep: "+ episode.title)
    for media in episode.media:
    for part in media.parts:
    if part.size:
    print(datetime.now().isoformat() + " Now: " + episode.title +" with size: " + f"{part.size / (1024 ** 2):.2f} MB ")
    total_size += part.size

    print(f"Show: {item.title}")
    print(f"Total size: {total_size / (1024 ** 3):.2f}")
    ##download Now
    # --- Set download directory ---
    download_dir = os.path.expanduser(f"/media/joedoe/SSDdata/TVshows/{item.title}")
    os.makedirs(download_dir, exist_ok=True)
    downloaded_files = item.download(download_dir, keep_original_name=False,subfolders=True)
    print(datetime.now().isoformat() + " ✅ Download complete!: "+ item.title)

    for f in downloaded_files:
    print("📁", f)
    print(datetime.now().isoformat() + " ________END SCRIPT ")