Random things of a random world

Sami's Page

  • Join Us on Facebook!
  • Follow Us on Twitter!
  • LinkedIn
  • Subcribe to Our RSS Feed

Sort Files for Emby

I've been testing using Emby for my media needs since Plex was a bit iffy sometimes, especially on my "smart" TV. Now that I have my gaming PC connected to my TV I can try out new things.

I tried Emby on a server that's always on and holds the media and Kodi on the PC. It works quite ok, but I did have to patch Emby to be a bit smarter about folder names. It expects them to be quite perfect and usually they aren't. More about that later if needed.

The next issue was that Emby skips all videos that are in the root of the video folder. It expects everything to be nicely in folders. So what to do? Fire up PowerShell and get it sorted out! I'm not at all experienced in PowerShell, but this is what I concocted:

Get-ChildItem .\* -include *.mkv, *.mov, *.mp4, *.avi|  ForEach-Object { $dir = (($_.FullName -replace '\.[^.]+$','') -replace 'S[0-9]+E[0-9]+.*$', ''); if(!(Test-Path -Path $dir)) { md -Path $dir|Out-Null }; $dir = Get-Item "$dir"; Move-Item $_.FullName $dir.FullName }

The idea is to take all mkv, mov, mp4, avi files, strip the extension, if they have any series/episode info strip that out too (including anything after it), create folder based on that name and put the files in there.

Works nicely, except for some reason files with angle brackets in them [] don't work. Didn't have many so manual editing was enough.

Now Emby can actually detect all the videos properly. I could've of course patched the code but this was simpler since I don't know much about Emby's internals.


Comments (1) -

  • Alice

    9/22/2020 3:49:59 PM | Reply

    Those that don't have a lot of experience with roulette will benefit from learning the rules before they play, although this definitely isn't mandatory. The Online  <a href="https://77kasino.com";>77kasino</a> Casino point of roulette is to make a prediction about which number will come up on the roulette wheel

Add comment