mdhiggins / sickbeard_mp4_automator

Automatically convert video files to a standardized format with metadata tagging to create a beautiful and uniform media library
MIT License
1.53k stars 200 forks source link

Duplicate files - incorrect config? #272

Closed ghost closed 9 years ago

ghost commented 9 years ago

Firstly apologies as I am unsure whether this is a bug or bad config.

I am getting the same issue with SAB -> CouchPotato and Deluge -> CouchPotato however for the purpose of this I will stick with Deluge as I have all the logs to hand etc. As per the readme I have setup SAB, CP and SR for MP4_automator. The processing seems to work however I am ending up with duplicate files in the final directory in the form of [Moive] cd1.mp4 and [Moive] cd4.mp4.

What appears to be happening is deluge completes the download and triggers delugePostProcess.py, this them creates temp_dir and converts the download. It then calls the CP api to process the downloads directory which imports the original MKV (or MP4 if the original was MP4) and the newly created MP4 as two separate parts for the same film. CP then runs its own MP4_automator PostProcess script which seems to convert the movie again which I dont understand?... Is it a bad config causing the duplicates or a bug? Below are snippets from the logs.

CP log: 05-28 22:43:32 INFO [hpotato.core.plugins.base] Opening url: get https://api.couchpota.to/search/Ex+Machina+2015/?limit=1, data: [] 05-28 22:43:32 INFO [hpotato.core.plugins.base] Opening url: get http://www.omdbapi.com/?type=movie&y=2015&t=ex+machina, data: [] 05-28 22:43:32 INFO [hpotato.core.plugins.base] Opening url: get http://api.themoviedb.org/3/search/movie?api_key=xxx&search_type=phrase&query=ex+machina&year=2015, data: [] 05-28 22:43:32 INFO [ie.providers.info.omdbapi] Found: Ex Machina (2015) 05-28 22:43:32 INFO [hpotato.core.plugins.base] Opening url: get http://api.themoviedb.org/3/movie/264660?api_key=xxx&append_to_response=alternative_titles, data: [] 05-28 22:43:32 INFO [providers.info.themoviedb] Found: [u'Ex Machina (2015)'] 05-28 22:43:32 INFO [tato.core.plugins.scanner] Found 1 movies in the folder /data/downloads/complete/cinematic 05-28 22:43:32 INFO [hpotato.core.plugins.base] Opening url: get https://api.couchpota.to/info/tt0470752/, data: [] 05-28 22:43:32 INFO [hpotato.core.plugins.base] Opening url: get http://www.omdbapi.com/?type=movie&i=tt0470752, data: [] 05-28 22:43:33 INFO [ie.providers.info.omdbapi] Found: Ex Machina (2015) 05-28 22:43:33 INFO [hpotato.core.plugins.base] Opening url: get http://api.themoviedb.org/3/movie/tt0470752?api_key=xxx&append_to_response=alternative_titles, data: [] 05-28 22:43:33 INFO [tato.core.plugins.renamer] Removing lesser or not wanted quality Ex Machina for brrip. 05-28 22:43:33 INFO [tato.core.plugins.renamer] Removing "/data/movies/Ex Machina/Ex Machina.nfo" 05-28 22:43:33 INFO [tato.core.plugins.renamer] Removing "/data/movies/Ex Machina/Ex Machina cd1.mp4" 05-28 22:43:33 INFO [tato.core.plugins.renamer] Removing "/data/movies/Ex Machina/Ex Machina cd2.mp4" 05-28 22:43:33 INFO [tato.core.plugins.renamer] Removing "/data/downloads/complete/cinematic/Ex Machina (2015)/WWW.YTS.TO.jpg" 05-28 22:43:33 INFO [tato.core.plugins.renamer] Moving "/data/downloads/complete/cinematic/temp_dir/Ex.Machina.2015.720p.BluRay.x264.YIFY.mp4" to "/data/movies/Ex Machina/Ex Machina cd2.mp4" 05-28 22:43:37 INFO [tato.core.plugins.renamer] Moving "/data/downloads/complete/cinematic/Ex Machina (2015)/Ex.Machina.2015.720p.BluRay.x264.YIFY.mp4" to "/data/movies/Ex Machina/Ex Machina cd1.mp4" 05-28 22:43:45 INFO [tato.core.plugins.renamer] Deleting folder: /data/downloads/complete/cinematic/temp_dir 05-28 22:43:45 INFO [e.providers.metadata.base] Creating XBMC metadata. 05-28 22:43:45 INFO [hpotato.core.plugins.base] Opening url: get http://api.themoviedb.org/3/movie/tt0470752?api_key=xxx&append_to_response=alternative_titles%2Cimages%2Ccasts, data: [] 05-28 22:43:45 INFO [ie.providers.info.omdbapi] Found: Ex Machina (2015) 05-28 22:43:45 INFO [hpotato.core.plugins.base] Opening url: get http://webservice.fanart.tv/v3/movies/tt0470752?api_key=xxx 05-28 22:43:45 INFO [ PostProcess] MP4 Automator Post Processing script initialized version 2 05-28 22:43:45 WARNING Audio bitrate was invalid, defaulting to 256 per channel. 05-28 22:43:45 INFO [ PostProcess] Processing file: /data/movies/Ex Machina/Ex Machina cd2.mp4 05-28 22:43:45 INFO [ PostProcess] File is valid 05-28 22:43:46 INFO [ PostProcess] Tagging file with IMDB ID tt0470752 05-28 22:43:46 INFO Starting new HTTPS connection (1): api.themoviedb.org 05-28 22:43:46 INFO Starting new HTTPS connection (1): api.themoviedb.org 05-28 22:43:46 INFO Starting new HTTPS connection (1): api.themoviedb.org 05-28 22:43:47 INFO Starting new HTTPS connection (1): api.themoviedb.org 05-28 22:43:47 INFO Tagging file: /data/movies/Ex Machina/Ex Machina cd2.mp4. 05-28 22:43:47 INFO Trying to write tags. 05-28 22:44:17 INFO Tags written successfully. 05-28 22:44:17 INFO Relocating MOOV atom to start of file. 05-28 22:44:17 INFO This file appears to already be setup for streaming! 05-28 22:44:17 WARNING QT FastStart did not run - perhaps moov atom was at the start already. 05-28 22:44:17 INFO [ PostProcess] Processing file: /data/movies/Ex Machina/Ex Machina cd1.mp4 05-28 22:44:17 INFO [ PostProcess] File is valid 05-28 22:44:18 INFO [ PostProcess] Tagging file with IMDB ID tt0470752 05-28 22:44:18 INFO Starting new HTTPS connection (1): api.themoviedb.org 05-28 22:44:18 INFO Starting new HTTPS connection (1): api.themoviedb.org 05-28 22:44:19 INFO Starting new HTTPS connection (1): api.themoviedb.org 05-28 22:44:19 INFO Starting new HTTPS connection (1): api.themoviedb.org 05-28 22:44:19 INFO Tagging file: /data/movies/Ex Machina/Ex Machina cd1.mp4. 05-28 22:44:19 INFO Trying to write tags. 05-28 22:44:47 INFO Tags written successfully. 05-28 22:44:47 INFO Relocating MOOV atom to start of file. 05-28 22:44:47 INFO This file appears to already be setup for streaming! 05-28 22:44:47 WARNING QT FastStart did not run - perhaps moov atom was at the start already. 05-28 22:44:47 INFO [ PostProcess] Processing file: /data/movies/Ex Machina/Ex Machina.nfo 05-28 22:44:47 INFO [ PostProcess] File is invalid 05-28 22:44:48 INFO [hpotato.core.plugins.base] Opening url: get http://www.hd-trailers.net/movie/ex-machina/, data: [] 05-28 22:44:52 INFO [hpotato.core.plugins.base] Opening url: get http://movietrailers.apple.com/movies/independent/exmachina/exmachina-tsr1_h720p.mov, data: [] 05-28 22:45:03 INFO [tato.core.plugins.scanner] Found 1 movies in the folder /data/movies/Ex Machina

mp4_automator.log: 2015-05-28 22:42:23 - delugePostProcess - INFO - Deluge post processing started. 2015-05-28 22:42:23 - readSettings - WARNING - Audio bitrate was invalid, defaulting to 256 per channel. 2015-05-28 22:42:23 - delugePostProcess - INFO - Converting file /data/downloads/complete/cinematic/Ex Machina (2015)/Ex.Machina.2015.720p.BluRay.x264.YIFY.mp4 at location /data/downloads/complete/cinematic/temp_dir. 2015-05-28 22:42:26 - delugePostProcess - INFO - Passing /data/downloads/complete/cinematic/temp_dir directory to Couch Potato. 2015-05-28 22:42:26 - autoprocess.autoProcessMovie - INFO - Waiting for 65.0 seconds to allow CPS to process newly extracted files. 2015-05-28 22:43:31 - autoprocess.autoProcessMovie - INFO - Opening URL: http://localhost:8083/api/xxxxxxxxxxxxx/renamer.scan. 2015-05-28 22:45:03 - autoprocess.autoProcessMovie - INFO - CouchPotatoServer returned {u'success': True}. 2015-05-28 22:45:03 - autoprocess.autoProcessMovie - INFO - renamer.scan started on CouchPotatoServer for None.

dir listings: # ls -l total 1 drwxrwx--- 2 deluge deluge 4 May 28 15:27 Ex Machina (2015) drwxrwx--- 2 deluge deluge 3 May 28 15:28 temp_dir

# ls -l Ex\ Machina\ \(2015\)/ total 826318 -rw-rw---- 1 deluge deluge 847344617 May 28 15:28 Ex.Machina.2015.720p.BluRay.x264.YIFY.mp4 -rw-rw---- 1 deluge deluge 105983 May 28 15:27 WWW.YTS.TO.jpg

# ls -l temp_dir/ total 8981 -rw-rw---- 1 deluge deluge 10878976 May 28 15:28 Ex.Machina.2015.720p.BluRay.x264.YIFY.mp4 (Ignore the file sizes - this was captured when the conversion was still running)

ghost commented 9 years ago

Figured it out and I think its a bug. In delugePostProcess.py there is:

settings.delete = False

Which is either a separate setting or is overriding delete_original=True from autoProcess.ini.

I commented out settings.delete and it is now working as expected.

mdhiggins commented 9 years ago

Not deleting torrents is an intended behavior since torrent clients are generally seeding and it causes problems with the active torrent client, so overriding the delete_original to false is intended. But commenting it out is a good way to bypass this behavior.

ghost commented 9 years ago

Ah OK, that makes sense then! Thanks for letting me know