MediaBrowser / Emby

Emby Server is a personal media server with apps on just about every device.
https://emby.media
GNU General Public License v2.0
4.1k stars 798 forks source link

Emby creates bogus seasons from subfolderss #1225

Closed TwoD closed 6 years ago

TwoD commented 8 years ago

Emby incorrectly assumes any subfolder containing one or more episodes within a show is its own season, completely separate from the actual season an episode belongs to. The episode correctly shows up under the actual season it belongs to, but also once more under a new "season" named after its parent folder, with nothing else in it.

So if each episode of some show is contained in its own folder to keep metadata and images neatly organized, a show will end up with one additional "season" per episode, which only contains that single episode. This becomes insane quite soon as there is no way to get rid of the bogus seasons.

Example structure:

 \Series
    \Glee
          \Glee S01E01
              Glee.S01E01.mp4
              Glee.S01E01-thumb.jpg
          \Glee S01E02
              Glee.S01E02.mp4
              Glee.S01E02-thumb.jpg
          Glee.S01E03.mp4
          Glee.S01E03-thumb.jpg

In this example you will have "Season 1" containing all 3 episodes, and two additional seasons named "Glee S01E01" and "Glee S01E02" containing one episode each. No metadata provider will recognize the two latter seasons, but the first one works as it should. This happens on all series and the naming of the subfolders containing the episodes is irrelevant, they may just as well have been called "Foo" and "Bar" and that would have been used as the names for the "seasons", nothing else changes.

The server is running Arch Linux and Emby Server v3.0.5724.6. The "TV" category is used for the parent folder containing all series. I add files to it manually and have Emby set up to watch that folder structure for changes, but it happens with a manually triggered update as well.

softworkz commented 8 years ago

Each series folder must have season subfolders by convention. That's how it is designed currently. Otherwise it won't work right.

TwoD commented 8 years ago

No, that is not the case according to all the documentation, the code, or when actually testing it.

Emby works fine with or without season folders. It just makes a mess of any other folder in there, while it should simply ignore unparsable folder names and look at the actual media files inside them.

I read through the code in the sub-project which handles name parsing and the problem is not there, but likely in the code using it. Just downloading the report took ages because of all the binary blobs in there, and having to pull each sub-project individually (vs simple git submodules) and find where things are took longer than the time I had available to dig deeper right then.

I may try digging through it again later if I get time to test more. This bug currently makes finding media really annoying because of all the duplicates and missing/incorrect artwork and metadata.

softworkz commented 8 years ago

Emby works fine with or without season folders. It just makes a mess of any other folder in there, while > it should simply ignore unparsable folder names and look at the actual media files inside them.

That is a contradiction. You can't say it is working fine and it's making a mess at the same time.

If you would create season folders it should work fine. That's the currently favored structure. It may also work when all episodes are contained in a single folder, but obiously not when each episode is contained in its own folder directly below the series folder without season folders. That's the current design. But any design can be modified or improved. If you decide to contribute to Emby and submit some improved code, there are good chances that it may be accepted.

Alternatively you could simply create season folders, or use the autoorganize feature, which let's you put all new episodes into a single incoming folder from which they are automatically copied to the appropriate series/season folder.

RedshirtMB commented 8 years ago

Emby doesn't support nested episodes. https://github.com/MediaBrowser/Emby/blob/master/MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs#L33

Nested episodes aren't described in the wiki either. https://github.com/MediaBrowser/Wiki/wiki/TV%20naming

@softworkz Season folders are optional, in this case TwoD is just not following the library structure guidelines.

TwoD commented 8 years ago

@RedshirtMB It's not explicitly supported, no. But why the heck does it think any folder is a season? Surely a bug, no? I'd even be happier if it didn't traverse into folders it could not parse.

Auto-organize is not a solution, I don't want to move files around when they are also tracked by other programs, and there's no technical or organizational reason to do so when only Emby (AFAIK) has issues with it.

If I can find the code doing the traversing of the folder structure, I will indeed try to fix this.

ebr11 commented 8 years ago

It isn't a bug but, rather, an unsupported structure.

It's possible that structure could get supported in the future but it isn't now.

TwoD commented 8 years ago

I didn't see the link to the code above, thanks.

@ebr11, if simply laid out as "a folder which is not a season is detected as such anyway", it sounds like a pretty obvious bug to me. That sounded a bit sarcastic, but that's not intentional. I also maintain projects so I get the "not supported" part, somewhere you have to draw a line. The behavior I expected was either that the episode wasn't picked up, or that the folder was not parsed as any media-related "entity" and just an organizational detail.

I'll put aside some time to figure out how navigate this source (to me it currently just looks like a bunch of random classes not doing much) and see if I can find a way to make it less keen on accepting anything as a season.

LukePulverenti commented 6 years ago

I have a solution to handle the specialized case of this kind of sub-folder: \Glee S01E01

When both a season number and episode number are detected in the folder name, we can avoid creating a season based on that.

However, if the season folder name is "foo", then we will leave this alone as expected behavior because there is a positive here in that it allows customized season folder names that are not based on a numeric value.

TwoD commented 6 years ago

@LukePulverenti Thanks, this fixed some of the issues, but not all. It seems this is still broken for episodes numbered 9 and above. If I name the parent folder so it containsSXXE[01-08] they correctly get excluded from the Seasons listing, but S09-> produce weird seasons same as before (with the exact same folder contents).

Update: The "cutoff" point in episode numbers seems to be differerent for different series, and possibly depending on what else is in the name. Got two instances of one E10 of a series, one with a slightly longer name and Emby only creates one extra Season for that one and correctly skips the instance with a shorter name. For the same series I also have two instances of E09, with the same naming schemes as for E10, and there Emby correctly skips both of them.