Previously some methods were just returning null or empty values in case
of encountered errors; as a consequence, the actual reason for failure
was never written to the auto-organize log.
Instead, only a generic message like "Unable to sort xxx because target
path could not be determined." was displayed.
After this change, the actual reason for failure will be saved to the
auto-organize log or displayed in the UI (when completing the organize
dialog).
This information is very important for the user. Examples are "No
permission", "Target folder not available", "Disk full", etc..
When a filename cannot be auto-matched to an existing series name, the
organization must be performed manually.
Unfortunately not just once, but again and again for each episode coming
in.
This change proposes a simple but solid method to optionally persist the
matching condition from within the manual organization dialog.
This approach will make Emby "learn" how to organize files in the future
without user interaction.
This new episode provider implementation does not bulk-download or cache
episode data. It is only meant to be a backup source for situations
where media is not recognized by the default provider (TheTvDb).
PathTooLongException can not only occur with long destination paths but
also with too long file names of files contained in a watch folder.
Previously this condition caused the auto-organize task to break.
With this change, we still log the exception, but auto-organize
processing will continue to handle all other files.
Conflicts:
MediaBrowser.Server.Implementations/FileOrganization/TvFolderOrganizer.cs
Especially with Multi-Episodes, the EpisodeTitle can become quite long,
since all comprised titles get concatenated into it.
By default, the EpisodeTitle is included in the single and multi-episode
naming patterns and this in turn can quickly lead to a
PathTooLongException.
This fix tries to keep as much as possible from the title string while
keeping the final path within the allowed limit.
During Auto-Organize, Emby should maintain a list of folders which were
processed successfully. Only these folders should be used with the
DeleteLeftOverFiles and DeleteEmptyFolders functions.