Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add regex for movies to allow periods in name #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions other/movie-tv2folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# Movie Title (2017) 1080p.mkv
# Movie Title (2017) anything else.*
# Movie Title (2017).*
# Movie.Title.2017.*
# Movie Title.mkv --> **would not be moved, since missing (year)**
#
# Series: (scans 2 folders deep)
Expand Down Expand Up @@ -81,10 +82,10 @@ def do_it(src_path, dst_path, depth):
continue

#movies
if depth == 0:
r = re.match("^(.+?\\([0-9]{4}\\)).*", name, re.I)
if depth == 0:
r = re.match("^(.+?)\W(\d{4})", name, re.I) #adds ability to see movies files split by periods (.) versus just spaces and parenthesis
if r:
dst_pathname = os.path.join(os.path.join(dst_path, str(r.group(1))), name)
dst_pathname = os.path.join(os.path.join(dst_path, str(r.group(1).replace(".", "")).strip()+" ("+str(r.group(2))+")"), name)
print("files2folders.py: movie: " + pathname + " -> " + dst_pathname)
my_rename(pathname, dst_pathname)
continue
Expand All @@ -98,5 +99,4 @@ def do_it(src_path, dst_path, depth):

break; #abort recursion in os.walk()


do_it(src_root_path, dst_root_path, 0)