Private GIT
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SickRage-1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vlbox
SickRage-1
Commits
c83abad8
Commit
c83abad8
authored
9 years ago
by
medariox
Browse files
Options
Downloads
Patches
Plain Diff
Adds support for subtitles with language for PP
parent
84abf22f
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
sickbeard/postProcessor.py
+15
-4
15 additions, 4 deletions
sickbeard/postProcessor.py
with
15 additions
and
4 deletions
sickbeard/postProcessor.py
+
15
−
4
View file @
c83abad8
...
@@ -39,6 +39,7 @@ from sickbeard.name_parser.parser import NameParser, InvalidNameException, Inval
...
@@ -39,6 +39,7 @@ from sickbeard.name_parser.parser import NameParser, InvalidNameException, Inval
from
sickrage.helper.encoding
import
ek
from
sickrage.helper.encoding
import
ek
from
sickrage.helper.exceptions
import
EpisodeNotFoundException
,
EpisodePostProcessingFailedException
,
ex
from
sickrage.helper.exceptions
import
EpisodeNotFoundException
,
EpisodePostProcessingFailedException
,
ex
from
sickrage.helper.exceptions
import
ShowDirectoryNotFoundException
from
sickrage.helper.exceptions
import
ShowDirectoryNotFoundException
from
babelfish
import
language_converters
import
adba
import
adba
from
sickbeard.helpers
import
verify_freespace
from
sickbeard.helpers
import
verify_freespace
...
@@ -190,9 +191,16 @@ class PostProcessor(object):
...
@@ -190,9 +191,16 @@ class PostProcessor(object):
checklist
=
glob
.
glob
(
ek
(
os
.
path
.
join
,
ek
(
os
.
path
.
dirname
,
globbable_file_path
),
'
*
'
))
# get a list of all the files in the folder
checklist
=
glob
.
glob
(
ek
(
os
.
path
.
join
,
ek
(
os
.
path
.
dirname
,
globbable_file_path
),
'
*
'
))
# get a list of all the files in the folder
for
filefound
in
checklist
:
# loop through all the files in the folder, and check if they are the same name even when the cases don't match
for
filefound
in
checklist
:
# loop through all the files in the folder, and check if they are the same name even when the cases don't match
file_name
=
filefound
.
rpartition
(
'
.
'
)[
0
]
file_name
=
filefound
.
rpartition
(
'
.
'
)[
0
]
file_extension
=
filefound
.
rpartition
(
'
.
'
)[
2
]
if
not
base_name_only
:
if
not
base_name_only
:
file_name
=
file_name
+
'
.
'
new_file_name
=
file_name
+
'
.
'
if
file_name
.
lower
()
==
base_name
.
lower
().
replace
(
'
[[]
'
,
'
[
'
).
replace
(
'
[]]
'
,
'
]
'
):
# if there's no difference in the filename add it to the filelist
if
new_file_name
.
lower
()
==
base_name
.
lower
().
replace
(
'
[[]
'
,
'
[
'
).
replace
(
'
[]]
'
,
'
]
'
):
# if there's no difference in the filename add it to the filelist
filelist
.
append
(
filefound
)
elif
file_extension
in
common
.
subtitleExtensions
:
language_extensions
=
tuple
(
'
.
'
+
c
for
c
in
language_converters
[
'
opensubtitles
'
].
codes
)
if
file_name
.
lower
().
endswith
(
language_extensions
)
and
(
len
(
filefound
.
rsplit
(
'
.
'
,
2
)[
1
])
is
2
or
3
):
filelist
.
append
(
filefound
)
elif
file_name
.
lower
().
endswith
(
'
pt-br
'
)
and
len
(
filefound
.
rsplit
(
'
.
'
,
2
)[
1
])
is
5
:
filelist
.
append
(
filefound
)
filelist
.
append
(
filefound
)
for
associated_file_path
in
filelist
:
for
associated_file_path
in
filelist
:
...
@@ -299,7 +307,10 @@ class PostProcessor(object):
...
@@ -299,7 +307,10 @@ class PostProcessor(object):
# check if file have subtitles language
# check if file have subtitles language
if
os
.
path
.
splitext
(
cur_extension
)[
1
][
1
:]
in
common
.
subtitleExtensions
:
if
os
.
path
.
splitext
(
cur_extension
)[
1
][
1
:]
in
common
.
subtitleExtensions
:
cur_lang
=
os
.
path
.
splitext
(
cur_extension
)[
0
]
cur_lang
=
os
.
path
.
splitext
(
cur_extension
)[
0
]
if
cur_lang
in
sickbeard
.
subtitles
.
wantedLanguages
():
if
cur_lang
:
cur_lang
=
cur_lang
.
lower
()
if
cur_lang
==
'
pt-br
'
:
cur_lang
=
'
pt-BR
'
cur_extension
=
cur_lang
+
os
.
path
.
splitext
(
cur_extension
)[
1
]
cur_extension
=
cur_lang
+
os
.
path
.
splitext
(
cur_extension
)[
1
]
# replace .nfo with .nfo-orig to avoid conflicts
# replace .nfo with .nfo-orig to avoid conflicts
...
@@ -313,7 +324,7 @@ class PostProcessor(object):
...
@@ -313,7 +324,7 @@ class PostProcessor(object):
else
:
else
:
new_file_name
=
helpers
.
replaceExtension
(
cur_file_name
,
cur_extension
)
new_file_name
=
helpers
.
replaceExtension
(
cur_file_name
,
cur_extension
)
if
sickbeard
.
SUBTITLES_DIR
and
cur_extension
in
common
.
subtitleExtensions
:
if
sickbeard
.
SUBTITLES_DIR
and
cur_extension
[
-
3
:]
in
common
.
subtitleExtensions
:
subs_new_path
=
ek
(
os
.
path
.
join
,
new_path
,
sickbeard
.
SUBTITLES_DIR
)
subs_new_path
=
ek
(
os
.
path
.
join
,
new_path
,
sickbeard
.
SUBTITLES_DIR
)
dir_exists
=
helpers
.
makeDir
(
subs_new_path
)
dir_exists
=
helpers
.
makeDir
(
subs_new_path
)
if
not
dir_exists
:
if
not
dir_exists
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment