Organize deletes files

New to nzbdrone and having an issue with organizing my file names. When I run ‘Organize & Rename’ on already existing files, it generally just deletes all the files instead of renames them. Only cost me about 400GB of Game of Thrones episodes lol.

Some information about my setup:

Intel NUC i5 running XBMCbuntu

  • running nzbdrone (2.0.0.1690)
  • mono (version 3.2.3)
  • connected via SMB to the file server
  • also happens when connected via NFSv4

Here’s 2 different logs related to the delete:

14-7-28 21:06:07.1|Info|RenameEpisodeFileService|Renaming 1 files for Adventure Time
14-7-28 21:06:07.3|Error|RenameEpisodeFileService|Failed to rename file: /home/timstephens24/TV Shows/Adventure Time/Season 5/Adventure Time.S05E21-22.The Suitor + The Party’s Over, Isla de Sen?orita.m4v

System.IO.FileNotFoundException: Could not find file ""
at System.IO.File.Move (System.String sourceFileName, System.String destFileName) [0x00000] in :0
at NzbDrone.Common.Disk.DiskProviderBase.MoveFile (System.String source, System.String destination) [0x00000] in :0
at NzbDrone.Core.MediaFiles.EpisodeFileMovingService.TransferFile (NzbDrone.Core.MediaFiles.EpisodeFile episodeFile, NzbDrone.Core.Tv.Series series, System.Collections.Generic.List1 episodes, System.String destinationFilename, Boolean copyOnly) [0x00000] in <filename unknown>:0 at NzbDrone.Core.MediaFiles.EpisodeFileMovingService.MoveEpisodeFile (NzbDrone.Core.MediaFiles.EpisodeFile episodeFile, NzbDrone.Core.Tv.Series series) [0x00000] in <filename unknown>:0 at NzbDrone.Core.MediaFiles.RenameEpisodeFileService.RenameFiles (System.Collections.Generic.List1 episodeFiles, NzbDrone.Core.Tv.Series series) [0x00000] in :0

14-7-28 21:06:07.4|Info|RenameEpisodeFileService|Selected episode files renamed for Adventure Time

14-7-28 21:31:23.6|Error|RenameEpisodeFileService|Failed to rename file: /home/timstephens24/TV Shows/Game of Thrones/Season 1/Game of Thrones.S01E01.Winter is Coming.mkv

System.IO.FileNotFoundException: Could not find file ""
at System.IO.File.Move (System.String sourceFileName, System.String destFileName) [0x00000] in :0
at NzbDrone.Common.Disk.DiskProviderBase.MoveFile (System.String source, System.String destination) [0x00000] in :0
at NzbDrone.Core.MediaFiles.EpisodeFileMovingService.TransferFile (NzbDrone.Core.MediaFiles.EpisodeFile episodeFile, NzbDrone.Core.Tv.Series series, System.Collections.Generic.List1 episodes, System.String destinationFilename, Boolean copyOnly) [0x00000] in <filename unknown>:0 at NzbDrone.Core.MediaFiles.EpisodeFileMovingService.MoveEpisodeFile (NzbDrone.Core.MediaFiles.EpisodeFile episodeFile, NzbDrone.Core.Tv.Series series) [0x00000] in <filename unknown>:0 at NzbDrone.Core.MediaFiles.RenameEpisodeFileService.RenameFiles (System.Collections.Generic.List1 episodeFiles, NzbDrone.Core.Tv.Series series) [0x00000] in :0
14-7-28 21:31:26.4|Info|RenameEpisodeFileService|Selected episode files renamed for Game of Thrones

EDIT:

Just to add the two filenames:

/home/user/TV Shows/Adventure Time.S05E21-22.The Suitor + The Party’s Over, Isla de Señorita.m4v
/home/user/TV Shows/Game of Thrones.S01E01.Winter is Coming.mkv

Without mono running in debug and debug logs, there isn’t a lot of information to go on and not enough to see why it would have deleted instead of moving.

What was the path drone was attempting to rename each of these files to? Were they the same? The same path should be skipped, but the only time drone deletes a file during a rename is if the destination filename is the same as drone is attempting to rename to (usually caused by an import).

It’s not a big rename and it’s going to the same path. For the name it’s going from “Game of Thrones.S01E01.Winter is Coming.mkv” to “Game of Thrones.S01E01.Winter Is Coming.mkv” Is there a different location for the debug logs than the normal logs folder?

Here’s where I ran mono with —debug=casts —debug=mdb-optimizations

14-7-29 06:06:57.5|Info|RefreshSeriesService|Updating Info for Game of Thrones
14-7-29 06:06:58.0|Info|RenameEpisodeFileService|Renaming 1 files for Game of Thrones
14-7-29 06:06:58.2|Error|RenameEpisodeFileService|Failed to rename file: /home/timstephens24/TV Shows/Game of Thrones/Season 1/Game of Thrones.S01E01.Winter is Coming.mkv

System.IO.FileNotFoundException: Could not find file ""
at System.IO.File.Move (System.String sourceFileName, System.String destFileName) [0x0013a] in /root/install/mono-3.2.3/mono-3.2.3/mcs/class/corlib/System.IO/File.cs:319
at NzbDrone.Common.Disk.DiskProviderBase.MoveFile (System.String source, System.String destination) [0x000c4] in m:\BuildAgent2\work\328d72309b633a8\src\NzbDrone.Common\Disk\DiskProviderBase.cs:271
at NzbDrone.Core.MediaFiles.EpisodeFileMovingService.TransferFile (NzbDrone.Core.MediaFiles.EpisodeFile episodeFile, NzbDrone.Core.Tv.Series series, System.Collections.Generic.List1 episodes, System.String destinationFilename, Boolean copyOnly) [0x001fa] in m:\BuildAgent2\work\328d72309b633a8\src\NzbDrone.Core\MediaFiles\EpisodeFileMovingService.cs:125 at NzbDrone.Core.MediaFiles.EpisodeFileMovingService.MoveEpisodeFile (NzbDrone.Core.MediaFiles.EpisodeFile episodeFile, NzbDrone.Core.Tv.Series series) [0x00057] in m:\BuildAgent2\work\328d72309b633a8\src\NzbDrone.Core\MediaFiles\EpisodeFileMovingService.cs:57 at NzbDrone.Core.MediaFiles.RenameEpisodeFileService.RenameFiles (System.Collections.Generic.List1 episodeFiles, NzbDrone.Core.Tv.Series series) [0x0002c] in m:\BuildAgent2\work\328d72309b633a8\src\NzbDrone.Core\MediaFiles\RenameEpisodeFileService.cs:115

14-7-29 06:06:58.2|Info|RenameEpisodeFileService|Selected episode files renamed for Game of Thrones

Here’s where I added —debug=casts —debug=mdb-optimizations —verbose (they look the same)

14-7-29 06:14:42.6|Info|RefreshSeriesService|Updating Info for Game of Thrones
14-7-29 06:14:44.2|Info|RefreshEpisodeService|Starting episode info refresh for: [121361][Game of Thrones]
14-7-29 06:14:44.3|Info|RefreshEpisodeService|Finished episode refresh for series: [121361][Game of Thrones].
14-7-29 06:14:44.3|Info|DiskScanService|Scanning disk for Game of Thrones
14-7-29 06:14:44.5|Info|DiskScanService|Completed scanning disk for Game of Thrones
14-7-29 06:15:18.0|Info|RenameEpisodeFileService|Renaming 1 files for Game of Thrones
14-7-29 06:15:18.2|Error|RenameEpisodeFileService|Failed to rename file: /home/timstephens24/TV Shows/Game of Thrones/Season 1/Game of Thrones.S01E01.Winter is Coming.mkv

System.IO.FileNotFoundException: Could not find file ""
at System.IO.File.Move (System.String sourceFileName, System.String destFileName) [0x0013a] in /root/install/mono-3.2.3/mono-3.2.3/mcs/class/corlib/System.IO/File.cs:319
at NzbDrone.Common.Disk.DiskProviderBase.MoveFile (System.String source, System.String destination) [0x000c4] in m:\BuildAgent2\work\328d72309b633a8\src\NzbDrone.Common\Disk\DiskProviderBase.cs:271
at NzbDrone.Core.MediaFiles.EpisodeFileMovingService.TransferFile (NzbDrone.Core.MediaFiles.EpisodeFile episodeFile, NzbDrone.Core.Tv.Series series, System.Collections.Generic.List1 episodes, System.String destinationFilename, Boolean copyOnly) [0x001fa] in m:\BuildAgent2\work\328d72309b633a8\src\NzbDrone.Core\MediaFiles\EpisodeFileMovingService.cs:125 at NzbDrone.Core.MediaFiles.EpisodeFileMovingService.MoveEpisodeFile (NzbDrone.Core.MediaFiles.EpisodeFile episodeFile, NzbDrone.Core.Tv.Series series) [0x00057] in m:\BuildAgent2\work\328d72309b633a8\src\NzbDrone.Core\MediaFiles\EpisodeFileMovingService.cs:57 at NzbDrone.Core.MediaFiles.RenameEpisodeFileService.RenameFiles (System.Collections.Generic.List1 episodeFiles, NzbDrone.Core.Tv.Series series) [0x0002c] in m:\BuildAgent2\work\328d72309b633a8\src\NzbDrone.Core\MediaFiles\RenameEpisodeFileService.cs:115

14-7-29 06:15:18.2|Info|RenameEpisodeFileService|Selected episode files renamed for Game of Thrones

No the location is the same, they have to be enabled though (Settings -> General).

Looking at the code, drone will log a Trace message if it is deleting a file, I need to know if that is being logged when it tries to rename. Enable Trace logs, clear the log files (keeps the noise down) and then try a rename again (just one episode). Then pastebin the resulting log file.

Pastebin dumb:

http://pastebin.com/yK0TcjWd

File server is windows right? Or at least a case-insensitive filesystem.

markus, file server is treating ‘Is’ and ‘is’ as the same in File.Exists. It’s crap, we gotta move the file to a temporary name first.

The file server is a Mac OS X. I’m connected to it via SMB.

What filesystem is running on OS X?

@Taloth yeah, needed to be better than this, for sure.

I’m running the default HFS+ (Mac OS Extended - Journaled).

@timstephens24 we have identified a couple issues and we’re working on resolving them to prevent this from happening again. Thanks for all the information!

We’ll let you know when we have some changes to test out.

Awesome, thanks @markus101. I’ll gladly test anything if you need.

@timstephens24 the fixes are in develop now, it will now prevent the files from being deleted.

Let us know if you have any issues or if its all working.

Just tested it out and haven’t had an issue with anything I’ve run it against. Thanks for fixing this.

Thanks for reporting it and working with us to resolve it.