dbr / tvnamer

Automatic TV episode file renamer, uses data from thetvdb.com via tvdb_api
https://pypi.python.org/pypi/tvnamer/
The Unlicense
909 stars 115 forks source link

--dry-run does not work and renames the files #164

Closed bepcyc closed 4 years ago

bepcyc commented 4 years ago

Despite the closed #112 I still see that --dry-run is being ignored. Here is an example where the file was renamed even though I did use --dry-run. You can see that the file name has a dotted pattern before tvnamer dry run and this file is renamed after a run:

$ python3 -m pip install --user tvnamer
Requirement already satisfied: tvnamer in ./.local/lib/python3.5/site-packages (2.5)
Requirement already satisfied: tvdb-api>=2.0 in ./.local/lib/python3.5/site-packages (from tvnamer) (2.0)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from tvdb-api>=2.0->tvnamer) (2.21.0)
Requirement already satisfied: requests-cache in ./.local/lib/python3.5/site-packages (from tvdb-api>=2.0->tvnamer) (0.5.2)

$ ls -lh files/West.Park.S120.1080p.WEB-DL.H.264.Parahill/West.Park.S120E02.Spank.Bunt.1080p.WEB-DL.H.264.Parahill.mkv                                                                                                                                                                                                                
-rw-r--r-- 1 myuser myuser 871M Nov 21 14:29 files/West.Park.S20.1080p.WEB-DL.H.264.Parahill/West.Park.S20E02.Skank.Hunt.1080p.WEB-DL.H.264.Parahill.mkv

$ tvnamer -b --dry-run files/West.Park.S120.1080p.WEB-DL.H.264.Parahill/West.Park.S120E02.Spank.Bunt.1080p.WEB-DL.H.264.Parahill.mkv
####################                   
# Starting tvnamer                                          
# Found 1 episode                                                                    
####################             
# Processing file: West.Park.S120E02.Spank.Bunt.1080p.WEB-DL.H.264.Parahill.mkv
# Detected series: West Park (season: 120, episode: 2)                       
####################                                                   
Old filename: West.Park.S120E02.Spank.Bunt.1080p.WEB-DL.H.264.Parahill.mkv
New filename: West Park - [120x02] - Spank Bunt.mkv                           
New path: /home/myuser/files/West.Park.S120.1080p.WEB-DL.H.264.Parahill/West Park - [120x02] - Spank Bunt.mkv
rename /home/myuser/files/West.Park.S120.1080p.WEB-DL.H.264.Parahill/West.Park.S120E02.Spank.Bunt.1080p.WEB-DL.H.264.Parahill.mkv to /home/myuser/files/West.Park.S120.1080p.WEB-DL.H.264.Parahill/West Park - [120x02] - Spank Bunt.mkv

####################                                            
# Done  

$ ls -lh files/West.Park.S120.1080p.WEB-DL.H.264.Parahill/West.Park.S120E02.Skank.Hunt.1080p.WEB-DL.H.264.Parahill.mkv
ls: cannot access 'files/West.Park.S120.1080p.WEB-DL.H.264.Parahill/West.Park.S120E02.Skank.Hunt.1080p.WEB-DL.H.264.Parahill.mkv': No such file or directory

$ ls -lh files/West.Park.S120.1080p.WEB-DL.H.264.Parahill/West\ Park\ -\ \[120x02\]\ -\ Spank\ Bunt.mkv 
-rw-r--r-- 1 myuser myuser 871M Nov 21 14:29 'files/West.Park.S120.1080p.WEB-DL.H.264.Parahill/West Park - [120x02] - Spank Bunt.mkv'

Please note that show name and season number are fictional.

bepcyc commented 4 years ago

I think I found the problem. That happens only when batch mode is enabled. I didn't check the code yet, but replacing -b with --not-batch --selectfirst in my example works as expected. The issue is now narrowed down to using batch mode only.

mpkogli commented 4 years ago

Confirming that --dry-run does not work in batch mode.

dbr commented 4 years ago

Version 3.0 was released today which contains this fix!